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

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

Issue 11415014: Stop using shell::GetInstance()->system_tray() in system tray items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modified CL to provide TrayItems and Tray*Views with parent pointers instead. Created 8 years, 1 month 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 #ifndef ASH_SYSTEM_POWER_TRAY_POWER_H_ 5 #ifndef ASH_SYSTEM_POWER_TRAY_POWER_H_
6 #define ASH_SYSTEM_POWER_TRAY_POWER_H_ 6 #define ASH_SYSTEM_POWER_TRAY_POWER_H_
7 7
8 #include "ash/system/power/power_status_observer.h" 8 #include "ash/system/power/power_status_observer.h"
9 #include "ash/system/tray/system_tray_item.h" 9 #include "ash/system/tray/system_tray_item.h"
10 10
11 class SkBitmap; 11 class SkBitmap;
12 12
13 namespace gfx { 13 namespace gfx {
14 class ImageSkia; 14 class ImageSkia;
15 } 15 }
16 16
17 namespace ash { 17 namespace ash {
18
19 class SystemTray;
20
18 namespace internal { 21 namespace internal {
19 22
20 namespace tray { 23 namespace tray {
21 class PowerNotificationView; 24 class PowerNotificationView;
22 class PowerTrayView; 25 class PowerTrayView;
23 } 26 }
24 27
25 enum IconSet { 28 enum IconSet {
26 ICON_LIGHT, 29 ICON_LIGHT,
27 ICON_DARK 30 ICON_DARK
28 }; 31 };
29 32
30 class TrayPower : public SystemTrayItem, 33 class TrayPower : public SystemTrayItem,
31 public PowerStatusObserver { 34 public PowerStatusObserver {
32 public: 35 public:
33 TrayPower(); 36 explicit TrayPower(SystemTray* system_tray);
34 virtual ~TrayPower(); 37 virtual ~TrayPower();
35 38
36 // Gets the icon index in the battery icon array image based on 39 // Gets the icon index in the battery icon array image based on
37 // |supply_status|. If |supply_status| is uncertain about the power state, 40 // |supply_status|. If |supply_status| is uncertain about the power state,
38 // returns -1. 41 // returns -1.
39 static int GetBatteryImageIndex(const PowerSupplyStatus& supply_status); 42 static int GetBatteryImageIndex(const PowerSupplyStatus& supply_status);
40 43
41 // Looks up the actual icon in the icon array image for |image_index|. 44 // Looks up the actual icon in the icon array image for |image_index|.
42 static gfx::ImageSkia GetBatteryImage(int image_index, IconSet icon_set); 45 static gfx::ImageSkia GetBatteryImage(int image_index, IconSet icon_set);
43 46
(...skipping 26 matching lines...) Expand all
70 tray::PowerNotificationView* notification_view_; 73 tray::PowerNotificationView* notification_view_;
71 NotificationState notification_state_; 74 NotificationState notification_state_;
72 75
73 DISALLOW_COPY_AND_ASSIGN(TrayPower); 76 DISALLOW_COPY_AND_ASSIGN(TrayPower);
74 }; 77 };
75 78
76 } // namespace internal 79 } // namespace internal
77 } // namespace ash 80 } // namespace ash
78 81
79 #endif // ASH_SYSTEM_POWER_TRAY_POWER_H_ 82 #endif // ASH_SYSTEM_POWER_TRAY_POWER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698