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

Side by Side Diff: ash/system/power/tray_power.cc

Issue 10694043: Handle gesture events in notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
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/power/tray_power.h" 5 #include "ash/system/power/tray_power.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/system/date/date_view.h" 9 #include "ash/system/date/date_view.h"
10 #include "ash/system/power/power_status_view.h" 10 #include "ash/system/power/power_status_view.h"
11 #include "ash/system/power/power_supply_status.h" 11 #include "ash/system/power/power_supply_status.h"
12 #include "ash/system/tray/system_tray_delegate.h" 12 #include "ash/system/tray/system_tray_delegate.h"
13 #include "ash/system/tray/tray_constants.h" 13 #include "ash/system/tray/tray_constants.h"
14 #include "ash/system/tray/tray_notification_view.h"
14 #include "ash/system/tray/tray_views.h" 15 #include "ash/system/tray/tray_views.h"
15 #include "base/command_line.h" 16 #include "base/command_line.h"
16 #include "base/string_number_conversions.h" 17 #include "base/string_number_conversions.h"
17 #include "base/stringprintf.h" 18 #include "base/stringprintf.h"
18 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
19 #include "grit/ash_strings.h" 20 #include "grit/ash_strings.h"
20 #include "grit/ui_resources_standard.h" 21 #include "grit/ui_resources_standard.h"
21 #include "third_party/skia/include/core/SkRect.h" 22 #include "third_party/skia/include/core/SkRect.h"
22 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/base/resource/resource_bundle.h" 24 #include "ui/base/resource/resource_bundle.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 85 }
85 86
86 PowerSupplyStatus supply_status_; 87 PowerSupplyStatus supply_status_;
87 88
88 DISALLOW_COPY_AND_ASSIGN(PowerTrayView); 89 DISALLOW_COPY_AND_ASSIGN(PowerTrayView);
89 }; 90 };
90 91
91 class PowerNotificationView : public TrayNotificationView { 92 class PowerNotificationView : public TrayNotificationView {
92 public: 93 public:
93 explicit PowerNotificationView(TrayPower* tray) 94 explicit PowerNotificationView(TrayPower* tray)
94 : TrayNotificationView(0), 95 : TrayNotificationView(tray, 0) {
95 tray_(tray) {
96 power_status_view_ = 96 power_status_view_ =
97 new PowerStatusView(PowerStatusView::VIEW_NOTIFICATION); 97 new PowerStatusView(PowerStatusView::VIEW_NOTIFICATION);
98 InitView(power_status_view_); 98 InitView(power_status_view_);
99 } 99 }
100 100
101 void UpdatePowerStatus(const PowerSupplyStatus& status) { 101 void UpdatePowerStatus(const PowerSupplyStatus& status) {
102 SetIconImage(TrayPower::GetBatteryImage(status, ICON_DARK)); 102 SetIconImage(TrayPower::GetBatteryImage(status, ICON_DARK));
103 power_status_view_->UpdatePowerStatus(status); 103 power_status_view_->UpdatePowerStatus(status);
104 } 104 }
105 105
106 // Overridden from TrayNotificationView:
107 virtual void OnClose() OVERRIDE {
108 tray_->HideNotificationView();
109 }
110
111 private: 106 private:
112 TrayPower* tray_;
113 PowerStatusView* power_status_view_; 107 PowerStatusView* power_status_view_;
114 108
115 DISALLOW_COPY_AND_ASSIGN(PowerNotificationView); 109 DISALLOW_COPY_AND_ASSIGN(PowerNotificationView);
116 }; 110 };
117 111
118 } // namespace tray 112 } // namespace tray
119 113
120 using tray::PowerNotificationView; 114 using tray::PowerNotificationView;
121 115
122 TrayPower::TrayPower() 116 TrayPower::TrayPower()
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 return false; 245 return false;
252 case NOTIFICATION_CRITICAL: 246 case NOTIFICATION_CRITICAL:
253 return false; 247 return false;
254 } 248 }
255 NOTREACHED(); 249 NOTREACHED();
256 return false; 250 return false;
257 } 251 }
258 252
259 } // namespace internal 253 } // namespace internal
260 } // namespace ash 254 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698