Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: ash/system/tray_update.cc

Issue 224113005: Eliminate ash::internal namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/tray_update.h ('k') | ash/system/user/tray_user.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/system/tray_update.h" 5 #include "ash/system/tray_update.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shelf/shelf_layout_manager.h" 8 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shelf/shelf_widget.h" 9 #include "ash/shelf/shelf_widget.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 case ash::UpdateObserver::UPDATE_SEVERE_RED: 54 case ash::UpdateObserver::UPDATE_SEVERE_RED:
55 return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK_RED : 55 return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK_RED :
56 IDR_AURA_UBER_TRAY_UPDATE_RED; 56 IDR_AURA_UBER_TRAY_UPDATE_RED;
57 } 57 }
58 58
59 NOTREACHED() << "Unknown update severity level."; 59 NOTREACHED() << "Unknown update severity level.";
60 return 0; 60 return 0;
61 } 61 }
62 62
63 class UpdateView : public ash::internal::ActionableView { 63 class UpdateView : public ash::ActionableView {
64 public: 64 public:
65 explicit UpdateView(ash::UpdateObserver::UpdateSeverity severity) { 65 explicit UpdateView(ash::UpdateObserver::UpdateSeverity severity) {
66 SetLayoutManager(new 66 SetLayoutManager(new
67 views::BoxLayout(views::BoxLayout::kHorizontal, 67 views::BoxLayout(views::BoxLayout::kHorizontal,
68 ash::kTrayPopupPaddingHorizontal, 0, 68 ash::kTrayPopupPaddingHorizontal, 0,
69 ash::kTrayPopupPaddingBetweenItems)); 69 ash::kTrayPopupPaddingBetweenItems));
70 70
71 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 71 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
72 views::ImageView* image = 72 views::ImageView* image =
73 new ash::internal::FixedSizedImageView(0, ash::kTrayPopupItemHeight); 73 new ash::FixedSizedImageView(0, ash::kTrayPopupItemHeight);
74 image->SetImage(bundle.GetImageNamed(DecideResource(severity, true)). 74 image->SetImage(bundle.GetImageNamed(DecideResource(severity, true)).
75 ToImageSkia()); 75 ToImageSkia());
76 76
77 AddChildView(image); 77 AddChildView(image);
78 AddChildView(new views::Label( 78 AddChildView(new views::Label(
79 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE))); 79 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE)));
80 SetAccessibleName(bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE)); 80 SetAccessibleName(bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE));
81 } 81 }
82 82
83 virtual ~UpdateView() {} 83 virtual ~UpdateView() {}
84 84
85 private: 85 private:
86 // Overridden from ActionableView. 86 // Overridden from ActionableView.
87 virtual bool PerformAction(const ui::Event& event) OVERRIDE { 87 virtual bool PerformAction(const ui::Event& event) OVERRIDE {
88 ash::Shell::GetInstance()-> 88 ash::Shell::GetInstance()->
89 system_tray_delegate()->RequestRestartForUpdate(); 89 system_tray_delegate()->RequestRestartForUpdate();
90 return true; 90 return true;
91 } 91 }
92 92
93 DISALLOW_COPY_AND_ASSIGN(UpdateView); 93 DISALLOW_COPY_AND_ASSIGN(UpdateView);
94 }; 94 };
95 95
96 } 96 }
97 97
98 namespace ash { 98 namespace ash {
99 namespace internal {
100
101 namespace tray { 99 namespace tray {
102 100
103 class UpdateNagger : public ui::LayerAnimationObserver { 101 class UpdateNagger : public ui::LayerAnimationObserver {
104 public: 102 public:
105 explicit UpdateNagger(SystemTrayItem* owner) 103 explicit UpdateNagger(SystemTrayItem* owner)
106 : owner_(owner) { 104 : owner_(owner) {
107 RestartTimer(); 105 RestartTimer();
108 owner_->system_tray()->GetWidget()->GetNativeView()->layer()-> 106 owner_->system_tray()->GetWidget()->GetNativeView()->layer()->
109 GetAnimator()->AddObserver(this); 107 GetAnimator()->AddObserver(this);
110 } 108 }
111 109
112 virtual ~UpdateNagger() { 110 virtual ~UpdateNagger() {
113 internal::StatusAreaWidget* status_area = 111 StatusAreaWidget* status_area =
114 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); 112 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget();
115 if (status_area) { 113 if (status_area) {
116 status_area->system_tray()->GetWidget()->GetNativeView()->layer()-> 114 status_area->system_tray()->GetWidget()->GetNativeView()->layer()->
117 GetAnimator()->RemoveObserver(this); 115 GetAnimator()->RemoveObserver(this);
118 } 116 }
119 } 117 }
120 118
121 void RestartTimer() { 119 void RestartTimer() {
122 timer_.Stop(); 120 timer_.Stop();
123 timer_.Start(FROM_HERE, 121 timer_.Start(FROM_HERE,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 severity_ = severity; 192 severity_ = severity;
195 SetImageFromResourceId(DecideResource(severity_, false)); 193 SetImageFromResourceId(DecideResource(severity_, false));
196 tray_view()->SetVisible(true); 194 tray_view()->SetVisible(true);
197 if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() && 195 if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() &&
198 !nagger_.get()) { 196 !nagger_.get()) {
199 // The shelf is not visible, and there is no nagger scheduled. 197 // The shelf is not visible, and there is no nagger scheduled.
200 nagger_.reset(new tray::UpdateNagger(this)); 198 nagger_.reset(new tray::UpdateNagger(this));
201 } 199 }
202 } 200 }
203 201
204 } // namespace internal
205 } // namespace ash 202 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray_update.h ('k') | ash/system/user/tray_user.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698