| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ |
| 6 #define UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "ui/app_list/pagination_model_observer.h" |
| 9 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
| 10 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
| 11 | 12 |
| 12 namespace app_list { | 13 namespace app_list { |
| 13 | 14 |
| 14 class ContentsView; | 15 class ContentsView; |
| 15 | 16 |
| 16 // A view that contains buttons to switch the displayed view in the given | 17 // A view that contains buttons to switch the displayed view in the given |
| 17 // ContentsView. | 18 // ContentsView. |
| 18 class ContentsSwitcherView : public views::View, public views::ButtonListener { | 19 class ContentsSwitcherView : public views::View, |
| 20 public views::ButtonListener, |
| 21 public PaginationModelObserver { |
| 19 public: | 22 public: |
| 20 explicit ContentsSwitcherView(ContentsView* contents_view); | 23 explicit ContentsSwitcherView(ContentsView* contents_view); |
| 21 virtual ~ContentsSwitcherView(); | 24 virtual ~ContentsSwitcherView(); |
| 22 | 25 |
| 23 ContentsView* contents_view() const { return contents_view_; } | 26 ContentsView* contents_view() const { return contents_view_; } |
| 24 | 27 |
| 25 // Adds a switcher button using |resource_id| as the button's image, which | 28 // Adds a switcher button using |resource_id| as the button's image, which |
| 26 // opens the page with index |page_index| in the ContentsView. |resource_id| | 29 // opens the page with index |page_index| in the ContentsView. |resource_id| |
| 27 // is ignored if it is 0. | 30 // is ignored if it is 0. |
| 28 void AddSwitcherButton(int resource_id, int page_index); | 31 void AddSwitcherButton(int resource_id, int page_index); |
| 29 | 32 |
| 30 private: | 33 private: |
| 31 // Overridden from views::View: | 34 // Overridden from views::View: |
| 32 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 35 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
| 33 virtual void Layout() OVERRIDE; | 36 virtual void Layout() OVERRIDE; |
| 34 | 37 |
| 35 // Overridden from views::ButtonListener: | 38 // Overridden from views::ButtonListener: |
| 36 virtual void ButtonPressed(views::Button* sender, | 39 virtual void ButtonPressed(views::Button* sender, |
| 37 const ui::Event& event) OVERRIDE; | 40 const ui::Event& event) OVERRIDE; |
| 38 | 41 |
| 42 // Overridden from PaginationModelObserver: |
| 43 virtual void TotalPagesChanged() OVERRIDE; |
| 44 virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; |
| 45 virtual void TransitionStarted() OVERRIDE; |
| 46 virtual void TransitionChanged() OVERRIDE; |
| 47 |
| 39 ContentsView* contents_view_; // Owned by views hierarchy. | 48 ContentsView* contents_view_; // Owned by views hierarchy. |
| 40 views::View* buttons_; // Owned by views hierarchy. | 49 views::View* buttons_; // Owned by views hierarchy. |
| 50 // Stores Views owned by views hierarchy. |
| 51 std::vector<views::View*> page_active_indicators_; |
| 41 | 52 |
| 42 DISALLOW_COPY_AND_ASSIGN(ContentsSwitcherView); | 53 DISALLOW_COPY_AND_ASSIGN(ContentsSwitcherView); |
| 43 }; | 54 }; |
| 44 | 55 |
| 45 } // namespace app_list | 56 } // namespace app_list |
| 46 | 57 |
| 47 #endif // UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ | 58 #endif // UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ |
| OLD | NEW |