| 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> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #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" | 12 #include "ash/common/system/tray/tray_constants.h" |
| 13 #include "ash/common/system/tray/view_click_listener.h" | 13 #include "ash/common/system/tray/view_click_listener.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
| 16 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class OneShotTimer; | 19 class OneShotTimer; |
| 20 } // namespace base | 20 } // namespace base |
| 21 | 21 |
| 22 namespace views { | 22 namespace views { |
| 23 class BoxLayout; | 23 class BoxLayout; |
| 24 class CustomButton; | 24 class CustomButton; |
| 25 class ProgressBar; | 25 class ProgressBar; |
| 26 class ScrollView; |
| 26 } // namespace views | 27 } // namespace views |
| 27 | 28 |
| 28 namespace ash { | 29 namespace ash { |
| 29 namespace test { | 30 namespace test { |
| 30 class TrayDetailsViewTest; | 31 class TrayDetailsViewTest; |
| 31 } // namespace test | 32 } // namespace test |
| 32 | 33 |
| 33 class FixedSizedScrollView; | |
| 34 class ScrollBorder; | 34 class ScrollBorder; |
| 35 class SystemTrayItem; | 35 class SystemTrayItem; |
| 36 class TriView; | 36 class TriView; |
| 37 | 37 |
| 38 class ASH_EXPORT TrayDetailsView : public views::View, | 38 class ASH_EXPORT TrayDetailsView : public views::View, |
| 39 public ViewClickListener, | 39 public ViewClickListener, |
| 40 public views::ButtonListener { | 40 public views::ButtonListener { |
| 41 public: | 41 public: |
| 42 explicit TrayDetailsView(SystemTrayItem* owner); | 42 explicit TrayDetailsView(SystemTrayItem* owner); |
| 43 ~TrayDetailsView() override; | 43 ~TrayDetailsView() override; |
| 44 | 44 |
| 45 // ViewClickListener: | 45 // ViewClickListener: |
| 46 // Don't override this --- override HandleViewClicked. | 46 // Don't override this --- override HandleViewClicked. |
| 47 void OnViewClicked(views::View* sender) final; | 47 void OnViewClicked(views::View* sender) final; |
| 48 | 48 |
| 49 // views::ButtonListener: | 49 // views::ButtonListener: |
| 50 // Don't override this --- override HandleButtonPressed. | 50 // Don't override this --- override HandleButtonPressed. |
| 51 void ButtonPressed(views::Button* sender, const ui::Event& event) final; | 51 void ButtonPressed(views::Button* sender, const ui::Event& event) final; |
| 52 | 52 |
| 53 SystemTrayItem* owner() { return owner_; } | 53 SystemTrayItem* owner() { return owner_; } |
| 54 SpecialPopupRow* title_row() { return title_row_; } | 54 SpecialPopupRow* title_row() { return title_row_; } |
| 55 FixedSizedScrollView* scroller() { return scroller_; } | 55 views::ScrollView* scroller() { return scroller_; } |
| 56 views::View* scroll_content() { return scroll_content_; } | 56 views::View* scroll_content() { return scroll_content_; } |
| 57 | 57 |
| 58 protected: | 58 protected: |
| 59 // views::View: | 59 // views::View: |
| 60 void Layout() override; | 60 void Layout() override; |
| 61 int GetHeightForWidth(int width) const override; | 61 int GetHeightForWidth(int width) const override; |
| 62 void OnPaintBorder(gfx::Canvas* canvas) override; | 62 void OnPaintBorder(gfx::Canvas* canvas) override; |
| 63 | 63 |
| 64 // Exposes the layout manager of this view to give control to subclasses. | 64 // Exposes the layout manager of this view to give control to subclasses. |
| 65 views::BoxLayout* box_layout() { return box_layout_; } | 65 views::BoxLayout* box_layout() { return box_layout_; } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void DoTransitionToDefaultView(); | 117 void DoTransitionToDefaultView(); |
| 118 | 118 |
| 119 // Helper function which creates and returns the back button used in the | 119 // Helper function which creates and returns the back button used in the |
| 120 // material design top-most header row. The caller assumes ownership of the | 120 // material design top-most header row. The caller assumes ownership of the |
| 121 // returned button. | 121 // returned button. |
| 122 views::Button* CreateBackButton(); | 122 views::Button* CreateBackButton(); |
| 123 | 123 |
| 124 SystemTrayItem* owner_; | 124 SystemTrayItem* owner_; |
| 125 views::BoxLayout* box_layout_; | 125 views::BoxLayout* box_layout_; |
| 126 SpecialPopupRow* title_row_; // Not used in material design. | 126 SpecialPopupRow* title_row_; // Not used in material design. |
| 127 FixedSizedScrollView* scroller_; | 127 views::ScrollView* scroller_; |
| 128 views::View* scroll_content_; | 128 views::View* scroll_content_; |
| 129 views::ProgressBar* progress_bar_; | 129 views::ProgressBar* progress_bar_; |
| 130 | 130 |
| 131 ScrollBorder* scroll_border_; // Weak reference | 131 ScrollBorder* scroll_border_; // Weak reference |
| 132 | 132 |
| 133 // The container view for the top-most title row in material design. | 133 // The container view for the top-most title row in material design. |
| 134 TriView* tri_view_; | 134 TriView* tri_view_; |
| 135 | 135 |
| 136 // The back button that appears in the material design title row. Not owned. | 136 // The back button that appears in the material design title row. Not owned. |
| 137 views::Button* back_button_; | 137 views::Button* back_button_; |
| 138 | 138 |
| 139 // Used to delay the transition to the default view. | 139 // Used to delay the transition to the default view. |
| 140 std::unique_ptr<base::OneShotTimer> transition_delay_timer_; | 140 std::unique_ptr<base::OneShotTimer> transition_delay_timer_; |
| 141 | 141 |
| 142 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); | 142 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 } // namespace ash | 145 } // namespace ash |
| 146 | 146 |
| 147 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ | 147 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ |
| OLD | NEW |