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 <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class ContentsSwitcherView : public views::View, | 21 class ContentsSwitcherView : public views::View, |
22 public views::ButtonListener, | 22 public views::ButtonListener, |
23 public PaginationModelObserver { | 23 public PaginationModelObserver { |
24 public: | 24 public: |
25 explicit ContentsSwitcherView(ContentsView* contents_view); | 25 explicit ContentsSwitcherView(ContentsView* contents_view); |
26 virtual ~ContentsSwitcherView(); | 26 virtual ~ContentsSwitcherView(); |
27 | 27 |
28 ContentsView* contents_view() const { return contents_view_; } | 28 ContentsView* contents_view() const { return contents_view_; } |
29 | 29 |
30 // Adds a switcher button using |resource_id| as the button's image, which | 30 // Adds a switcher button using |resource_id| as the button's image, which |
31 // opens the page with index |page_index| in the ContentsView. |resource_id| | 31 // opens the page with index |page_index| in the ContentsView. |
32 // is ignored if it is 0. | |
33 void AddSwitcherButton(int resource_id, int page_index); | 32 void AddSwitcherButton(int resource_id, int page_index); |
34 | 33 |
35 private: | 34 private: |
36 // Overridden from views::ButtonListener: | 35 // Overridden from views::ButtonListener: |
37 virtual void ButtonPressed(views::Button* sender, | 36 virtual void ButtonPressed(views::Button* sender, |
38 const ui::Event& event) OVERRIDE; | 37 const ui::Event& event) OVERRIDE; |
39 | 38 |
40 // Overridden from PaginationModelObserver: | 39 // Overridden from PaginationModelObserver: |
41 virtual void TotalPagesChanged() OVERRIDE; | 40 virtual void TotalPagesChanged() OVERRIDE; |
42 virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; | 41 virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; |
43 virtual void TransitionStarted() OVERRIDE; | 42 virtual void TransitionStarted() OVERRIDE; |
44 virtual void TransitionChanged() OVERRIDE; | 43 virtual void TransitionChanged() OVERRIDE; |
45 | 44 |
46 ContentsView* contents_view_; // Owned by views hierarchy. | 45 ContentsView* contents_view_; // Owned by views hierarchy. |
47 | 46 |
48 // Maps page indices to Views owned by views hierarchy. | 47 // Maps page indices to Views owned by views hierarchy. |
49 std::map<int, views::View*> page_active_indicators_; | 48 std::map<int, views::View*> page_active_indicators_; |
50 | 49 |
51 DISALLOW_COPY_AND_ASSIGN(ContentsSwitcherView); | 50 DISALLOW_COPY_AND_ASSIGN(ContentsSwitcherView); |
52 }; | 51 }; |
53 | 52 |
54 } // namespace app_list | 53 } // namespace app_list |
55 | 54 |
56 #endif // UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ | 55 #endif // UI_APP_LIST_VIEWS_CONTENTS_SWITCHER_VIEW_H_ |
OLD | NEW |