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

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

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs Created 3 years, 9 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
« no previous file with comments | « ash/common/system/tray/tray_constants.cc ('k') | ash/common/system/tray/tray_details_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_
6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_
7
8 #include <memory>
9
10 #include "ash/ash_export.h"
11 #include "ash/common/system/tray/special_popup_row.h"
12 #include "ash/common/system/tray/tray_constants.h"
13 #include "ash/common/system/tray/view_click_listener.h"
14 #include "base/macros.h"
15 #include "base/timer/timer.h"
16 #include "ui/views/controls/button/button.h"
17 #include "ui/views/view.h"
18
19 namespace views {
20 class BoxLayout;
21 class CustomButton;
22 class ProgressBar;
23 class ScrollView;
24 } // namespace views
25
26 namespace ash {
27 namespace test {
28 class TrayDetailsViewTest;
29 } // namespace test
30
31 class ScrollBorder;
32 class SystemTrayItem;
33 class TriView;
34
35 class ASH_EXPORT TrayDetailsView : public views::View,
36 public ViewClickListener,
37 public views::ButtonListener {
38 public:
39 explicit TrayDetailsView(SystemTrayItem* owner);
40 ~TrayDetailsView() override;
41
42 // ViewClickListener:
43 // Don't override this --- override HandleViewClicked.
44 void OnViewClicked(views::View* sender) final;
45
46 // views::ButtonListener:
47 // Don't override this --- override HandleButtonPressed.
48 void ButtonPressed(views::Button* sender, const ui::Event& event) final;
49
50 SystemTrayItem* owner() { return owner_; }
51 SpecialPopupRow* title_row() { return title_row_; }
52 views::ScrollView* scroller() { return scroller_; }
53 views::View* scroll_content() { return scroll_content_; }
54
55 protected:
56 // views::View:
57 void Layout() override;
58 int GetHeightForWidth(int width) const override;
59 void OnPaintBorder(gfx::Canvas* canvas) override;
60
61 // Exposes the layout manager of this view to give control to subclasses.
62 views::BoxLayout* box_layout() { return box_layout_; }
63
64 // Creates the row containing the back button and title. For material design
65 // this appears at the top of the view, for non-material design it appears
66 // at the bottom.
67 void CreateTitleRow(int string_id);
68
69 // Creates a scrollable list. The list has a border at the bottom if there is
70 // any other view between the list and the footer row at the bottom.
71 void CreateScrollableList();
72
73 // Adds a separator in scrollable list.
74 void AddScrollSeparator();
75
76 // Removes (and destroys) all child views.
77 void Reset();
78
79 // Shows or hides the progress bar below the title row. It occupies the same
80 // space as the separator, so when shown the separator is hidden. If
81 // |progress_bar_| doesn't already exist it will be created.
82 void ShowProgress(double value, bool visible);
83
84 // Helper functions which create and return the settings and help buttons,
85 // respectively, used in the material design top-most header row. The caller
86 // assumes ownership of the returned buttons.
87 views::CustomButton* CreateSettingsButton(LoginStatus status,
88 int setting_accessible_name_id);
89 views::CustomButton* CreateHelpButton(LoginStatus status);
90
91 TriView* tri_view() { return tri_view_; }
92
93 private:
94 friend class test::TrayDetailsViewTest;
95
96 // Overridden to handle clicks on subclass-specific views.
97 virtual void HandleViewClicked(views::View* view);
98
99 // Overridden to handle button presses on subclass-specific buttons.
100 virtual void HandleButtonPressed(views::Button* sender,
101 const ui::Event& event);
102
103 // Creates and adds subclass-specific buttons to the title row.
104 virtual void CreateExtraTitleRowButtons();
105
106 // Transition to default view from details view. If |title_row_| has focus
107 // before transition, the default view should focus on the owner of this
108 // details view.
109 //
110 // In Material Design the actual transition is intentionally delayed to allow
111 // the user to perceive the ink drop animation on the clicked target.
112 void TransitionToDefaultView();
113
114 // Actually transitions to the default view.
115 void DoTransitionToDefaultView();
116
117 // Helper function which creates and returns the back button used in the
118 // material design top-most header row. The caller assumes ownership of the
119 // returned button.
120 views::Button* CreateBackButton();
121
122 SystemTrayItem* owner_;
123 views::BoxLayout* box_layout_;
124 SpecialPopupRow* title_row_; // Not used in material design.
125 views::ScrollView* scroller_;
126 views::View* scroll_content_;
127 views::ProgressBar* progress_bar_;
128
129 ScrollBorder* scroll_border_; // Weak reference
130
131 // The container view for the top-most title row in material design.
132 TriView* tri_view_;
133
134 // The back button that appears in the material design title row. Not owned.
135 views::Button* back_button_;
136
137 // Used to delay the transition to the default view.
138 base::OneShotTimer transition_delay_timer_;
139
140 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView);
141 };
142
143 } // namespace ash
144
145 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_
OLDNEW
« no previous file with comments | « ash/common/system/tray/tray_constants.cc ('k') | ash/common/system/tray/tray_details_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698