OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/common/system/chromeos/tray_tracing.h" | 5 #include "ash/common/system/chromeos/tray_tracing.h" |
6 | 6 |
7 #include "ash/common/system/tray/actionable_view.h" | 7 #include "ash/common/system/tray/actionable_view.h" |
8 #include "ash/common/system/tray/fixed_sized_image_view.h" | 8 #include "ash/common/system/tray/fixed_sized_image_view.h" |
9 #include "ash/common/system/tray/system_tray_delegate.h" | 9 #include "ash/common/system/tray/system_tray_delegate.h" |
10 #include "ash/common/system/tray/system_tray_notifier.h" | 10 #include "ash/common/system/tray/system_tray_notifier.h" |
11 #include "ash/common/system/tray/tray_constants.h" | 11 #include "ash/common/system/tray/tray_constants.h" |
12 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
13 #include "ash/system/tray/system_tray.h" | 13 #include "ash/system/tray/system_tray.h" |
14 #include "grit/ash_resources.h" | 14 #include "grit/ash_resources.h" |
15 #include "grit/ash_strings.h" | 15 #include "grit/ash_strings.h" |
16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
18 #include "ui/views/controls/image_view.h" | 18 #include "ui/views/controls/image_view.h" |
19 #include "ui/views/controls/label.h" | 19 #include "ui/views/controls/label.h" |
20 #include "ui/views/layout/box_layout.h" | 20 #include "ui/views/layout/box_layout.h" |
21 | 21 |
22 namespace ash { | 22 namespace ash { |
23 namespace tray { | 23 namespace tray { |
24 | 24 |
25 class DefaultTracingView : public ActionableView { | 25 class DefaultTracingView : public ActionableView { |
26 public: | 26 public: |
27 DefaultTracingView() { | 27 DefaultTracingView() { |
28 SetLayoutManager(new views::BoxLayout( | 28 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, |
29 views::BoxLayout::kHorizontal, | 29 kTrayPopupPaddingHorizontal, 0, |
30 kTrayPopupPaddingHorizontal, 0, | 30 kTrayPopupPaddingBetweenItems)); |
31 kTrayPopupPaddingBetweenItems)); | |
32 | 31 |
33 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 32 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
34 image_ = new FixedSizedImageView(0, kTrayPopupItemHeight); | 33 image_ = new FixedSizedImageView(0, kTrayPopupItemHeight); |
35 image_->SetImage( | 34 image_->SetImage( |
36 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_TRACING).ToImageSkia()); | 35 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_TRACING).ToImageSkia()); |
37 AddChildView(image_); | 36 AddChildView(image_); |
38 | 37 |
39 label_ = new views::Label(); | 38 label_ = new views::Label(); |
40 label_->SetMultiLine(true); | 39 label_->SetMultiLine(true); |
41 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 40 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
(...skipping 15 matching lines...) Expand all Loading... |
57 | 56 |
58 DISALLOW_COPY_AND_ASSIGN(DefaultTracingView); | 57 DISALLOW_COPY_AND_ASSIGN(DefaultTracingView); |
59 }; | 58 }; |
60 | 59 |
61 } // namespace tray | 60 } // namespace tray |
62 | 61 |
63 //////////////////////////////////////////////////////////////////////////////// | 62 //////////////////////////////////////////////////////////////////////////////// |
64 // ash::TrayTracing | 63 // ash::TrayTracing |
65 | 64 |
66 TrayTracing::TrayTracing(SystemTray* system_tray) | 65 TrayTracing::TrayTracing(SystemTray* system_tray) |
67 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_TRACING), | 66 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_TRACING), default_(NULL) { |
68 default_(NULL) { | |
69 DCHECK(system_tray); | 67 DCHECK(system_tray); |
70 WmShell::Get()->system_tray_notifier()->AddTracingObserver(this); | 68 WmShell::Get()->system_tray_notifier()->AddTracingObserver(this); |
71 } | 69 } |
72 | 70 |
73 TrayTracing::~TrayTracing() { | 71 TrayTracing::~TrayTracing() { |
74 WmShell::Get()->system_tray_notifier()->RemoveTracingObserver(this); | 72 WmShell::Get()->system_tray_notifier()->RemoveTracingObserver(this); |
75 } | 73 } |
76 | 74 |
77 void TrayTracing::SetTrayIconVisible(bool visible) { | 75 void TrayTracing::SetTrayIconVisible(bool visible) { |
78 if (tray_view()) | 76 if (tray_view()) |
(...skipping 12 matching lines...) Expand all Loading... |
91 } | 89 } |
92 | 90 |
93 views::View* TrayTracing::CreateDetailedView(LoginStatus status) { | 91 views::View* TrayTracing::CreateDetailedView(LoginStatus status) { |
94 return NULL; | 92 return NULL; |
95 } | 93 } |
96 | 94 |
97 void TrayTracing::DestroyDefaultView() { | 95 void TrayTracing::DestroyDefaultView() { |
98 default_ = NULL; | 96 default_ = NULL; |
99 } | 97 } |
100 | 98 |
101 void TrayTracing::DestroyDetailedView() { | 99 void TrayTracing::DestroyDetailedView() {} |
102 } | |
103 | 100 |
104 void TrayTracing::OnTracingModeChanged(bool value) { | 101 void TrayTracing::OnTracingModeChanged(bool value) { |
105 SetTrayIconVisible(value); | 102 SetTrayIconVisible(value); |
106 } | 103 } |
107 | 104 |
108 } // namespace ash | 105 } // namespace ash |
OLD | NEW |