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

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

Issue 2429923002: Implement all system menu title row buttons for Ash MD (Closed)
Patch Set: Created 4 years, 2 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_SPECIAL_POPUP_ROW_H_ 5 #ifndef ASH_COMMON_SYSTEM_TRAY_SPECIAL_POPUP_ROW_H_
6 #define ASH_COMMON_SYSTEM_TRAY_SPECIAL_POPUP_ROW_H_ 6 #define ASH_COMMON_SYSTEM_TRAY_SPECIAL_POPUP_ROW_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/common/login_status.h"
9 #include "ash/resources/vector_icons/vector_icons.h" 10 #include "ash/resources/vector_icons/vector_icons.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
12 #include "ui/views/view.h" 13 #include "ui/views/view.h"
13 14
14 namespace views { 15 namespace views {
15 class Button; 16 class Button;
16 class ButtonListener; 17 class ButtonListener;
17 class Label; 18 class Label;
18 class ToggleButton; 19 class ToggleButton;
(...skipping 23 matching lines...) Expand all
42 // Sets |content_| to be |view| and adds |content_| as a child view of this 43 // Sets |content_| to be |view| and adds |content_| as a child view of this
43 // row. This should only be called once, upon initialization of the row. 44 // row. This should only be called once, upon initialization of the row.
44 // TODO(tdanderson): Make this private when material design is enabled by 45 // TODO(tdanderson): Make this private when material design is enabled by
45 // default. See crbug.com/614453. 46 // default. See crbug.com/614453.
46 void SetContent(views::View* view); 47 void SetContent(views::View* view);
47 48
48 // Creates UI elements for the material design title row and adds them to 49 // Creates UI elements for the material design title row and adds them to
49 // the view hierarchy rooted at |this|. Returns a pointer to the created 50 // the view hierarchy rooted at |this|. Returns a pointer to the created
50 // view. 51 // view.
51 views::Button* AddBackButton(views::ButtonListener* listener); 52 views::Button* AddBackButton(views::ButtonListener* listener);
52 views::Button* AddSettingsButton(views::ButtonListener* listener); 53 views::Button* AddSettingsButton(views::ButtonListener* listener,
tdanderson 2016/10/18 20:57:47 Ben, I'm thinking of killing off these Add*Button(
bruthig 2016/10/19 15:43:09 As discussed offline, I think we should keep them.
tdanderson 2016/10/19 19:49:31 Acknowledged.
54 LoginStatus status);
55 views::Button* AddHelpButton(views::ButtonListener* listener,
56 LoginStatus status);
53 views::ToggleButton* AddToggleButton(views::ButtonListener* listener); 57 views::ToggleButton* AddToggleButton(views::ButtonListener* listener);
54 58
59 // Adds |view| after this row's content.
60 void AddViewToTitleRow(views::View* view);
61
55 // Adds |view| after this row's content, optionally with a separator. Only 62 // Adds |view| after this row's content, optionally with a separator. Only
56 // used for non-MD. 63 // used for non-MD.
57 // TODO(tdanderson): Remove this when material design is enabled by default. 64 // TODO(tdanderson): Remove this when material design is enabled by default.
58 // See crbug.com/614453. 65 // See crbug.com/614453.
59 void AddViewToRowNonMd(views::View* view, bool add_separator); 66 void AddViewToRowNonMd(views::View* view, bool add_separator);
60 67
61 // TODO(tdanderson): Remove this accessor when material design is enabled by 68 // TODO(tdanderson): Remove this accessor when material design is enabled by
62 // default. See crbug.com/614453. 69 // default. See crbug.com/614453.
63 views::View* content() const { return content_; } 70 views::View* content() const { return content_; }
64 71
65 private: 72 private:
66 // views::View: 73 // views::View:
67 gfx::Size GetPreferredSize() const override; 74 gfx::Size GetPreferredSize() const override;
68 int GetHeightForWidth(int width) const override; 75 int GetHeightForWidth(int width) const override;
69 void Layout() override; 76 void Layout() override;
70 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 77 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
71 78
72 // Updates the style of |label_|, if it exists. Only used in material design. 79 // Updates the style of |label_|, if it exists. Only used in material design.
73 void UpdateStyle(); 80 void UpdateStyle();
74 81
75 // Used to add views to |views_before_content_container_| and 82 // Used to add views to |views_before_content_container_| and
76 // |views_after_content_container_|, respectively. Views are added to both 83 // |views_after_content_container_|, respectively. Views are added to both
77 // containers in a left-to-right order. 84 // containers in a left-to-right order.
78 void AddViewBeforeContent(views::View* view); 85 void AddViewBeforeContent(views::View* view);
79 void AddViewAfterContent(views::View* view); 86 void AddViewAfterContent(views::View* view);
80 void AddViewAfterContent(views::View* view, bool add_separator); 87 void AddViewAfterContent(views::View* view, bool add_separator);
81 88
82 void SetTextLabelMd(int string_id, ViewClickListener* listener); 89 void SetTextLabelMd(int string_id, ViewClickListener* listener);
83 void SetTextLabelNonMd(int string_id, ViewClickListener* listener); 90 void SetTextLabelNonMd(int string_id, ViewClickListener* listener);
84 SystemMenuButton* AddSystemMenuButton(views::ButtonListener* listener,
85 const gfx::VectorIcon& icon,
86 int accessible_name_id,
87 bool after_content);
88 91
89 // The container for the views positioned before |content_|. 92 // The container for the views positioned before |content_|.
90 views::View* views_before_content_container_; 93 views::View* views_before_content_container_;
91 94
92 // The main content of this row, typically a label. 95 // The main content of this row, typically a label.
93 views::View* content_; 96 views::View* content_;
94 97
95 // The container for the views positioned after |content_|. 98 // The container for the views positioned after |content_|.
96 views::View* views_after_content_container_; 99 views::View* views_after_content_container_;
97 100
98 // A pointer to the label which is parented to |content_|; this is non-null 101 // A pointer to the label which is parented to |content_|; this is non-null
99 // only if this row's content is a single label. Not owned. 102 // only if this row's content is a single label. Not owned.
100 views::Label* label_; 103 views::Label* label_;
101 104
102 DISALLOW_COPY_AND_ASSIGN(SpecialPopupRow); 105 DISALLOW_COPY_AND_ASSIGN(SpecialPopupRow);
103 }; 106 };
104 107
105 } // namespace ash 108 } // namespace ash
106 109
107 #endif // ASH_COMMON_SYSTEM_TRAY_SPECIAL_POPUP_ROW_H_ 110 #endif // ASH_COMMON_SYSTEM_TRAY_SPECIAL_POPUP_ROW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698