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

Side by Side Diff: ash/system/tray_caps_lock.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_TRAY_CAPS_LOCK_H_ 5 #ifndef ASH_SYSTEM_TRAY_CAPS_LOCK_H_
6 #define ASH_SYSTEM_TRAY_CAPS_LOCK_H_ 6 #define ASH_SYSTEM_TRAY_CAPS_LOCK_H_
7 7
8 #include "ash/system/tray/tray_image_item.h" 8 #include "ash/system/tray/tray_image_item.h"
9 9
10 namespace views { 10 namespace views {
11 class ImageView; 11 class ImageView;
12 class View; 12 class View;
13 } 13 }
14 14
15 namespace ash { 15 namespace ash {
16 16
17 class SystemTray;
18
17 class ASH_EXPORT CapsLockObserver { 19 class ASH_EXPORT CapsLockObserver {
18 public: 20 public:
19 virtual ~CapsLockObserver() {} 21 virtual ~CapsLockObserver() {}
20 22
21 virtual void OnCapsLockChanged(bool enabled, 23 virtual void OnCapsLockChanged(bool enabled,
22 bool search_mapped_to_caps_lock) = 0; 24 bool search_mapped_to_caps_lock) = 0;
23 }; 25 };
24 26
25 namespace internal { 27 namespace internal {
26 28
27 class CapsLockDefaultView; 29 class CapsLockDefaultView;
28 30
29 class TrayCapsLock : public TrayImageItem, 31 class TrayCapsLock : public TrayImageItem,
30 public CapsLockObserver { 32 public CapsLockObserver {
31 public: 33 public:
32 TrayCapsLock(); 34 explicit TrayCapsLock(SystemTray* system_tray);
33 virtual ~TrayCapsLock(); 35 virtual ~TrayCapsLock();
34 36
35 private: 37 private:
36 // Overridden from TrayImageItem. 38 // Overridden from TrayImageItem.
37 virtual bool GetInitialVisibility() OVERRIDE; 39 virtual bool GetInitialVisibility() OVERRIDE;
38 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; 40 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE;
39 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; 41 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE;
40 virtual void DestroyDefaultView() OVERRIDE; 42 virtual void DestroyDefaultView() OVERRIDE;
41 virtual void DestroyDetailedView() OVERRIDE; 43 virtual void DestroyDetailedView() OVERRIDE;
42 44
43 // Overridden from CapsLockObserver. 45 // Overridden from CapsLockObserver.
44 virtual void OnCapsLockChanged(bool enabled, 46 virtual void OnCapsLockChanged(bool enabled,
45 bool search_mapped_to_caps_lock) OVERRIDE; 47 bool search_mapped_to_caps_lock) OVERRIDE;
46 48
47 CapsLockDefaultView* default_; 49 CapsLockDefaultView* default_;
48 views::View* detailed_; 50 views::View* detailed_;
49 51
50 bool search_mapped_to_caps_lock_; 52 bool search_mapped_to_caps_lock_;
51 bool caps_lock_enabled_; 53 bool caps_lock_enabled_;
52 bool message_shown_; 54 bool message_shown_;
53 55
54 DISALLOW_COPY_AND_ASSIGN(TrayCapsLock); 56 DISALLOW_COPY_AND_ASSIGN(TrayCapsLock);
55 }; 57 };
56 58
57 } // namespace internal 59 } // namespace internal
58 } // namespace ash 60 } // namespace ash
59 61
60 #endif // ASH_SYSTEM_TRAY_CAPS_LOCK_H_ 62 #endif // ASH_SYSTEM_TRAY_CAPS_LOCK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698