| 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 "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/common/system/tray/special_popup_row.h" | 9 #include "ash/common/system/tray/special_popup_row.h" |
| 10 #include "ash/common/system/tray/view_click_listener.h" | 10 #include "ash/common/system/tray/view_click_listener.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
| 13 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 class BoxLayout; | 16 class BoxLayout; |
| 17 class CustomButton; |
| 18 class Label; |
| 19 class ProgressBar; |
| 17 class ScrollView; | 20 class ScrollView; |
| 18 class ProgressBar; | |
| 19 } // namespace views | 21 } // namespace views |
| 20 | 22 |
| 21 namespace ash { | 23 namespace ash { |
| 22 namespace test { | 24 namespace test { |
| 23 class TrayDetailsViewTest; | 25 class TrayDetailsViewTest; |
| 24 } // namespace test | 26 } // namespace test |
| 25 | 27 |
| 26 class FixedSizedScrollView; | 28 class FixedSizedScrollView; |
| 27 class ScrollBorder; | 29 class ScrollBorder; |
| 28 class SystemTrayItem; | 30 class SystemTrayItem; |
| 31 class TriView; |
| 29 | 32 |
| 30 class ASH_EXPORT TrayDetailsView : public views::View, | 33 class ASH_EXPORT TrayDetailsView : public views::View, |
| 31 public ViewClickListener, | 34 public ViewClickListener, |
| 32 public views::ButtonListener { | 35 public views::ButtonListener { |
| 33 public: | 36 public: |
| 34 explicit TrayDetailsView(SystemTrayItem* owner); | 37 explicit TrayDetailsView(SystemTrayItem* owner); |
| 35 ~TrayDetailsView() override; | 38 ~TrayDetailsView() override; |
| 36 | 39 |
| 37 // ViewClickListener: | 40 // ViewClickListener: |
| 38 // Don't override this --- override HandleViewClicked. | 41 // Don't override this --- override HandleViewClicked. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 69 void AddScrollSeparator(); | 72 void AddScrollSeparator(); |
| 70 | 73 |
| 71 // Removes (and destroys) all child views. | 74 // Removes (and destroys) all child views. |
| 72 void Reset(); | 75 void Reset(); |
| 73 | 76 |
| 74 // Shows or hides the progress bar below the title row. It occupies the same | 77 // Shows or hides the progress bar below the title row. It occupies the same |
| 75 // space as the separator, so when shown the separator is hidden. If | 78 // space as the separator, so when shown the separator is hidden. If |
| 76 // |progress_bar_| doesn't already exist it will be created. | 79 // |progress_bar_| doesn't already exist it will be created. |
| 77 void ShowProgress(double value, bool visible); | 80 void ShowProgress(double value, bool visible); |
| 78 | 81 |
| 82 // Helper functions which create and return the settings and help buttons, |
| 83 // respectively, used in the material design top-most header row. The caller |
| 84 // assumes ownership of the returned buttons. |
| 85 views::CustomButton* CreateSettingsButton(LoginStatus status); |
| 86 views::CustomButton* CreateHelpButton(LoginStatus status); |
| 87 |
| 88 TriView* tri_view() { return tri_view_; } |
| 89 |
| 79 private: | 90 private: |
| 80 friend class test::TrayDetailsViewTest; | 91 friend class test::TrayDetailsViewTest; |
| 81 | 92 |
| 93 // views::View: |
| 94 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 95 |
| 96 // Updates the style of |label_| based on the current native theme, if it |
| 97 // exists. Only used for material design. |
| 98 void UpdateStyle(); |
| 99 |
| 82 // Overridden to handle clicks on subclass-specific views. | 100 // Overridden to handle clicks on subclass-specific views. |
| 83 virtual void HandleViewClicked(views::View* view); | 101 virtual void HandleViewClicked(views::View* view); |
| 84 | 102 |
| 85 // Overridden to handle button presses on subclass-specific buttons. | 103 // Overridden to handle button presses on subclass-specific buttons. |
| 86 virtual void HandleButtonPressed(views::Button* sender, | 104 virtual void HandleButtonPressed(views::Button* sender, |
| 87 const ui::Event& event); | 105 const ui::Event& event); |
| 88 | 106 |
| 89 // Creates and adds subclass-specific buttons to the title row. | 107 // Creates and adds subclass-specific buttons to the title row. |
| 90 virtual void CreateExtraTitleRowButtons(); | 108 virtual void CreateExtraTitleRowButtons(); |
| 91 | 109 |
| 92 // Transition to default view from details view. If |title_row_| has focus | 110 // Transition to default view from details view. If |title_row_| has focus |
| 93 // before transition, the default view should focus on the owner of this | 111 // before transition, the default view should focus on the owner of this |
| 94 // details view. | 112 // details view. |
| 95 void TransitionToDefaultView(); | 113 void TransitionToDefaultView(); |
| 96 | 114 |
| 115 // 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 |
| 117 // returned button. |
| 118 views::Button* CreateBackButton(); |
| 119 |
| 97 SystemTrayItem* owner_; | 120 SystemTrayItem* owner_; |
| 98 views::BoxLayout* box_layout_; | 121 views::BoxLayout* box_layout_; |
| 99 SpecialPopupRow* title_row_; | 122 SpecialPopupRow* title_row_; // Not used in material design. |
| 100 FixedSizedScrollView* scroller_; | 123 FixedSizedScrollView* scroller_; |
| 101 views::View* scroll_content_; | 124 views::View* scroll_content_; |
| 102 views::ProgressBar* progress_bar_; | 125 views::ProgressBar* progress_bar_; |
| 103 | 126 |
| 104 ScrollBorder* scroll_border_; // Weak reference | 127 ScrollBorder* scroll_border_; // Weak reference |
| 105 | 128 |
| 129 // The container view for the top-most title row in material design. |
| 130 TriView* tri_view_; |
| 131 |
| 132 // The label used in the top-most title row for material design. |
| 133 views::Label* label_; |
| 134 |
| 106 // The back button that appears in the material design title row. Not owned. | 135 // The back button that appears in the material design title row. Not owned. |
| 107 views::Button* back_button_; | 136 views::Button* back_button_; |
| 108 | 137 |
| 109 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); | 138 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); |
| 110 }; | 139 }; |
| 111 | 140 |
| 112 } // namespace ash | 141 } // namespace ash |
| 113 | 142 |
| 114 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ | 143 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ |
| OLD | NEW |