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

Side by Side Diff: ash/system/tray/tray_item_more.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_TRAY_ITEM_MORE_H_ 5 #ifndef ASH_SYSTEM_TRAY_TRAY_ITEM_MORE_H_
6 #define ASH_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ 6 #define ASH_SYSTEM_TRAY_TRAY_ITEM_MORE_H_
7 7
8 #include "ash/system/tray/tray_views.h" 8 #include "ash/system/tray/tray_views.h"
9 #include "ui/views/view.h" 9 #include "ui/views/view.h"
10 10
11 namespace views { 11 namespace views {
12 class ImageView; 12 class ImageView;
13 class Label; 13 class Label;
14 class View; 14 class View;
15 } 15 }
16 16
17 namespace ash { 17 namespace ash {
18 18
19 class SystemTrayItem; 19 class SystemTrayItem;
20 20
21 namespace internal { 21 namespace internal {
22 22
23 // A view with a chevron ('>') on the right edge. Clicking on the view brings up 23 // A view with a chevron ('>') on the right edge. Clicking on the view brings up
24 // the detailed view of the tray-item that owns it. 24 // the detailed view of the tray-item that owns it.
25 class TrayItemMore : public ActionableView { 25 class TrayItemMore : public ActionableView {
26 public: 26 public:
27 TrayItemMore(SystemTrayItem* owner, bool show_more); 27 TrayItemMore(SystemTrayItem* tray, bool show_more);
28 virtual ~TrayItemMore(); 28 virtual ~TrayItemMore();
29 29
30 SystemTrayItem* tray() const { return tray_; }
31
30 void SetLabel(const string16& label); 32 void SetLabel(const string16& label);
31 void SetImage(const gfx::ImageSkia* image_skia); 33 void SetImage(const gfx::ImageSkia* image_skia);
32 void SetAccessibleName(const string16& name); 34 void SetAccessibleName(const string16& name);
33 35
34 protected: 36 protected:
35 // Replaces the default icon (on the left of the label), and allows a custom 37 // Replaces the default icon (on the left of the label), and allows a custom
36 // view to be placed there. Once the default icon is replaced, |SetImage| 38 // view to be placed there. Once the default icon is replaced, |SetImage|
37 // should never be called. 39 // should never be called.
38 void ReplaceIcon(views::View* view); 40 void ReplaceIcon(views::View* view);
39 41
40 private: 42 private:
41 // Overridden from ActionableView. 43 // Overridden from ActionableView.
42 virtual bool PerformAction(const ui::Event& event) OVERRIDE; 44 virtual bool PerformAction(const ui::Event& event) OVERRIDE;
43 45
44 // Overridden from views::View. 46 // Overridden from views::View.
45 virtual void Layout() OVERRIDE; 47 virtual void Layout() OVERRIDE;
46 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 48 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
47 49
48 SystemTrayItem* owner_; 50 SystemTrayItem* tray_;
49 // True if |more_| should be shown. 51 // True if |more_| should be shown.
50 bool show_more_; 52 bool show_more_;
51 views::ImageView* icon_; 53 views::ImageView* icon_;
52 views::Label* label_; 54 views::Label* label_;
53 views::ImageView* more_; 55 views::ImageView* more_;
54 string16 accessible_name_; 56 string16 accessible_name_;
55 57
56 DISALLOW_COPY_AND_ASSIGN(TrayItemMore); 58 DISALLOW_COPY_AND_ASSIGN(TrayItemMore);
57 }; 59 };
58 60
59 } // namespace internal 61 } // namespace internal
60 } // namespace ash 62 } // namespace ash
61 63
62 #endif // ASH_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ 64 #endif // ASH_SYSTEM_TRAY_TRAY_ITEM_MORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698