diff options
author | Andras Becsi <andras.becsi@digia.com> | 2014-03-18 13:16:26 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-03-20 15:55:39 +0100 |
commit | 3f0f86b0caed75241fa71c95a5d73bc0164348c5 (patch) | |
tree | 92b9fb00f2e9e90b0be2262093876d4f43b6cd13 /chromium/ash/system/chromeos/tray_tracing.cc | |
parent | e90d7c4b152c56919d963987e2503f9909a666d2 (diff) |
Update to new stable branch 1750
This also includes an updated ninja and chromium dependencies
needed on Windows.
Change-Id: Icd597d80ed3fa4425933c9f1334c3c2e31291c42
Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu>
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'chromium/ash/system/chromeos/tray_tracing.cc')
-rw-r--r-- | chromium/ash/system/chromeos/tray_tracing.cc | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/chromium/ash/system/chromeos/tray_tracing.cc b/chromium/ash/system/chromeos/tray_tracing.cc new file mode 100644 index 00000000000..eddeac7fcfa --- /dev/null +++ b/chromium/ash/system/chromeos/tray_tracing.cc @@ -0,0 +1,113 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/system/chromeos/tray_tracing.h" + +#include "ash/shell.h" +#include "ash/system/tray/actionable_view.h" +#include "ash/system/tray/fixed_sized_image_view.h" +#include "ash/system/tray/system_tray.h" +#include "ash/system/tray/system_tray_delegate.h" +#include "ash/system/tray/system_tray_notifier.h" +#include "ash/system/tray/tray_constants.h" +#include "grit/ash_resources.h" +#include "grit/ash_strings.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/image/image.h" +#include "ui/views/controls/image_view.h" +#include "ui/views/controls/label.h" +#include "ui/views/layout/box_layout.h" + +namespace ash { +namespace internal { + +namespace tray { + +class DefaultTracingView : public internal::ActionableView { + public: + DefaultTracingView() { + SetLayoutManager(new views::BoxLayout( + views::BoxLayout::kHorizontal, + kTrayPopupPaddingHorizontal, 0, + kTrayPopupPaddingBetweenItems)); + + ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); + image_ = new internal::FixedSizedImageView(0, kTrayPopupItemHeight); + image_->SetImage( + bundle.GetImageNamed(IDR_AURA_UBER_TRAY_TRACING).ToImageSkia()); + AddChildView(image_); + + label_ = new views::Label(); + label_->SetMultiLine(true); + label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); + label_->SetText(bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_TRACING)); + AddChildView(label_); + } + + virtual ~DefaultTracingView() {} + + private: + // Overridden from ActionableView. + virtual bool PerformAction(const ui::Event& event) OVERRIDE { + Shell::GetInstance()->system_tray_delegate()->ShowChromeSlow(); + return true; + } + + views::ImageView* image_; + views::Label* label_; + + DISALLOW_COPY_AND_ASSIGN(DefaultTracingView); +}; + +} // namespace tray + +//////////////////////////////////////////////////////////////////////////////// +// ash::internal::TrayTracing + +TrayTracing::TrayTracing(SystemTray* system_tray) + : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_TRACING), + default_(NULL) { + DCHECK(Shell::GetInstance()->delegate()); + DCHECK(system_tray); + Shell::GetInstance()->system_tray_notifier()->AddTracingObserver(this); +} + +TrayTracing::~TrayTracing() { + Shell::GetInstance()->system_tray_notifier()->RemoveTracingObserver(this); +} + +void TrayTracing::SetTrayIconVisible(bool visible) { + if (tray_view()) + tray_view()->SetVisible(visible); +} + +bool TrayTracing::GetInitialVisibility() { + return false; +} + +views::View* TrayTracing::CreateDefaultView(user::LoginStatus status) { + CHECK(default_ == NULL); + if (tray_view() && tray_view()->visible()) + default_ = new tray::DefaultTracingView(); + return default_; +} + +views::View* TrayTracing::CreateDetailedView(user::LoginStatus status) { + return NULL; +} + +void TrayTracing::DestroyDefaultView() { + default_ = NULL; +} + +void TrayTracing::DestroyDetailedView() { +} + +void TrayTracing::OnTracingModeChanged(bool value) { + SetTrayIconVisible(value); +} + +} // namespace internal +} // namespace ash |