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

Side by Side Diff: ash/common/system/tray/tray_item_more.h

Issue 2244003002: Materialized font style for TrayItemMore type system tray rows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated TrayPopupItemStyle to use the default FontList. Created 4 years, 3 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
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_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_
6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_
7 7
8 #include <memory>
tdanderson 2016/09/12 18:51:47 is this needed?
bruthig 2016/09/15 18:56:29 Yup, for unique_ptr<>.
9
8 #include "ash/common/system/tray/actionable_view.h" 10 #include "ash/common/system/tray/actionable_view.h"
11 #include "ash/common/system/tray/tray_popup_item_style.h"
12 #include "ash/common/system/tray/tray_popup_item_style_observer.h"
9 #include "base/macros.h" 13 #include "base/macros.h"
10 #include "ui/views/view.h" 14 #include "ui/views/view.h"
11 15
12 namespace views { 16 namespace views {
13 class ImageView; 17 class ImageView;
14 class Label; 18 class Label;
15 class View; 19 class View;
16 } 20 }
17 21
18 namespace ash { 22 namespace ash {
19 class SystemTrayItem; 23 class SystemTrayItem;
20 24
21 // A view with a chevron ('>') on the right edge. Clicking on the view brings up 25 // A view with a 'more' arrow icon on the right edge. Clicking on the view
22 // the detailed view of the tray-item that owns it. 26 // brings up the detailed view of the tray-item that owns it.
23 class TrayItemMore : public ActionableView { 27 class TrayItemMore : public ActionableView, public TrayPopupItemStyleObserver {
24 public: 28 public:
25 TrayItemMore(SystemTrayItem* owner, bool show_more); 29 TrayItemMore(SystemTrayItem* owner, bool show_more);
26 ~TrayItemMore() override; 30 ~TrayItemMore() override;
27 31
28 SystemTrayItem* owner() const { return owner_; } 32 SystemTrayItem* owner() const { return owner_; }
29 33
30 void SetLabel(const base::string16& label); 34 void SetLabel(const base::string16& label);
31 void SetImage(const gfx::ImageSkia& image_skia); 35 void SetImage(const gfx::ImageSkia& image_skia);
32 void SetAccessibleName(const base::string16& name); 36 void SetAccessibleName(const base::string16& name);
33 37
38 // Set the current visual style of this item. OnTrayPopupItemStyleUpdated()
39 // will be called.
40 void SetStyle(std::unique_ptr<TrayPopupItemStyle> style);
41
34 protected: 42 protected:
35 // Replaces the default icon (on the left of the label), and allows a custom 43 // TrayPopupItemStyleObserver:
36 // view to be placed there. Once the default icon is replaced, |SetImage| 44 void OnTrayPopupItemStyleUpdated() override;
37 // should never be called. 45
38 void ReplaceIcon(views::View* view); 46 TrayPopupItemStyle* style() const { return style_.get(); }
47
48 // Update the content of this (e.g. Label text, font, color, etc).
49 virtual void UpdateContent();
39 50
40 private: 51 private:
41 // Overridden from ActionableView. 52 // Overridden from ActionableView.
tdanderson 2016/09/12 18:51:47 nit: just "// ActionableView:" while you're here.
bruthig 2016/09/15 18:56:29 Done.
42 bool PerformAction(const ui::Event& event) override; 53 bool PerformAction(const ui::Event& event) override;
43 54
44 // Overridden from views::View. 55 // Overridden from views::View.
45 void Layout() override; 56 void Layout() override;
46 void GetAccessibleState(ui::AXViewState* state) override; 57 void GetAccessibleState(ui::AXViewState* state) override;
58 void OnThemeChanged() override;
47 59
48 SystemTrayItem* owner_; 60 SystemTrayItem* owner_;
49 // True if |more_| should be shown. 61 // True if |more_| should be shown.
50 bool show_more_; 62 bool show_more_;
51 views::ImageView* icon_; 63 views::ImageView* icon_;
52 views::Label* label_; 64 views::Label* label_;
53 views::ImageView* more_; 65 views::ImageView* more_;
54 base::string16 accessible_name_; 66 base::string16 accessible_name_;
55 67
68 // Current visual style of this item. This only applies when system menu is
69 // using the material design look and feel.
70 std::unique_ptr<TrayPopupItemStyle> style_;
71
56 DISALLOW_COPY_AND_ASSIGN(TrayItemMore); 72 DISALLOW_COPY_AND_ASSIGN(TrayItemMore);
57 }; 73 };
58 74
59 } // namespace ash 75 } // namespace ash
60 76
61 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ 77 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698