OLD | NEW |
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_DETAILS_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ |
6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
9 #include "ash/common/system/tray/special_popup_row.h" | 11 #include "ash/common/system/tray/special_popup_row.h" |
| 12 #include "ash/common/system/tray/tray_constants.h" |
10 #include "ash/common/system/tray/view_click_listener.h" | 13 #include "ash/common/system/tray/view_click_listener.h" |
11 #include "base/macros.h" | 14 #include "base/macros.h" |
12 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
13 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
14 | 17 |
| 18 namespace base { |
| 19 class OneShotTimer; |
| 20 } // namespace base |
| 21 |
15 namespace views { | 22 namespace views { |
16 class BoxLayout; | 23 class BoxLayout; |
17 class CustomButton; | 24 class CustomButton; |
18 class Label; | 25 class Label; |
19 class ProgressBar; | 26 class ProgressBar; |
20 class ScrollView; | 27 class ScrollView; |
21 } // namespace views | 28 } // namespace views |
22 | 29 |
23 namespace ash { | 30 namespace ash { |
24 namespace test { | 31 namespace test { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // Overridden to handle button presses on subclass-specific buttons. | 110 // Overridden to handle button presses on subclass-specific buttons. |
104 virtual void HandleButtonPressed(views::Button* sender, | 111 virtual void HandleButtonPressed(views::Button* sender, |
105 const ui::Event& event); | 112 const ui::Event& event); |
106 | 113 |
107 // Creates and adds subclass-specific buttons to the title row. | 114 // Creates and adds subclass-specific buttons to the title row. |
108 virtual void CreateExtraTitleRowButtons(); | 115 virtual void CreateExtraTitleRowButtons(); |
109 | 116 |
110 // Transition to default view from details view. If |title_row_| has focus | 117 // Transition to default view from details view. If |title_row_| has focus |
111 // before transition, the default view should focus on the owner of this | 118 // before transition, the default view should focus on the owner of this |
112 // details view. | 119 // details view. |
| 120 // |
| 121 // In Material Design the actual transition is intentionally delayed to allow |
| 122 // the user to perceive the ink drop animation on the clicked target. |
113 void TransitionToDefaultView(); | 123 void TransitionToDefaultView(); |
114 | 124 |
| 125 // Actually transitions to the default view. |
| 126 void DoTransitionToDefaultView(); |
| 127 |
115 // Helper function which creates and returns the back button used in the | 128 // Helper function which creates and returns the back button used in the |
116 // material design top-most header row. The caller assumes ownership of the | 129 // material design top-most header row. The caller assumes ownership of the |
117 // returned button. | 130 // returned button. |
118 views::Button* CreateBackButton(); | 131 views::Button* CreateBackButton(); |
119 | 132 |
120 SystemTrayItem* owner_; | 133 SystemTrayItem* owner_; |
121 views::BoxLayout* box_layout_; | 134 views::BoxLayout* box_layout_; |
122 SpecialPopupRow* title_row_; // Not used in material design. | 135 SpecialPopupRow* title_row_; // Not used in material design. |
123 FixedSizedScrollView* scroller_; | 136 FixedSizedScrollView* scroller_; |
124 views::View* scroll_content_; | 137 views::View* scroll_content_; |
125 views::ProgressBar* progress_bar_; | 138 views::ProgressBar* progress_bar_; |
126 | 139 |
127 ScrollBorder* scroll_border_; // Weak reference | 140 ScrollBorder* scroll_border_; // Weak reference |
128 | 141 |
129 // The container view for the top-most title row in material design. | 142 // The container view for the top-most title row in material design. |
130 TriView* tri_view_; | 143 TriView* tri_view_; |
131 | 144 |
132 // The label used in the top-most title row for material design. | 145 // The label used in the top-most title row for material design. |
133 views::Label* label_; | 146 views::Label* label_; |
134 | 147 |
135 // The back button that appears in the material design title row. Not owned. | 148 // The back button that appears in the material design title row. Not owned. |
136 views::Button* back_button_; | 149 views::Button* back_button_; |
137 | 150 |
| 151 // Used to delay the transition to the default view. |
| 152 std::unique_ptr<base::OneShotTimer> transition_delay_timer_; |
| 153 |
138 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); | 154 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); |
139 }; | 155 }; |
140 | 156 |
141 } // namespace ash | 157 } // namespace ash |
142 | 158 |
143 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ | 159 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ |
OLD | NEW |