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_LAUNCHER_LAUNCHER_VIEW_H_ | 5 #ifndef ASH_LAUNCHER_LAUNCHER_VIEW_H_ |
6 #define ASH_LAUNCHER_LAUNCHER_VIEW_H_ | 6 #define ASH_LAUNCHER_LAUNCHER_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 23 matching lines...) Expand all Loading... | |
34 class LauncherButton; | 34 class LauncherButton; |
35 | 35 |
36 class ASH_EXPORT LauncherView : public views::View, | 36 class ASH_EXPORT LauncherView : public views::View, |
37 public LauncherModelObserver, | 37 public LauncherModelObserver, |
38 public views::ButtonListener, | 38 public views::ButtonListener, |
39 public LauncherButtonHost, | 39 public LauncherButtonHost, |
40 public views::ContextMenuController, | 40 public views::ContextMenuController, |
41 public views::FocusTraversable { | 41 public views::FocusTraversable { |
42 public: | 42 public: |
43 // Use the api in this class for testing only. | 43 // Use the api in this class for testing only. |
44 class ASH_EXPORT TestAPI { | 44 class ASH_EXPORT TestAPI { |
sky
2012/04/13 22:00:04
Can you move this into a separate file and make it
xiyuan
2012/04/23 18:08:53
Done.
| |
45 public: | 45 public: |
46 explicit TestAPI(LauncherView* launcher_view) | 46 explicit TestAPI(LauncherView* launcher_view) |
47 : launcher_view_(launcher_view) { | 47 : launcher_view_(launcher_view) { |
48 } | 48 } |
49 | |
49 // Number of icons displayed. | 50 // Number of icons displayed. |
50 int GetButtonCount(); | 51 int GetButtonCount(); |
52 | |
51 // Retrieve the button at |index|. | 53 // Retrieve the button at |index|. |
52 LauncherButton* GetButton(int index); | 54 LauncherButton* GetButton(int index); |
53 | 55 |
56 // Last visible button index. | |
57 int GetLastVisibleIndex(); | |
58 | |
59 // Returns true if overflow button is visible. | |
60 bool IsOverflowButtonVisible(); | |
61 | |
62 // Sets animation duration in milliseconds for test. | |
63 void SetAnimationDuration(int duration_ms); | |
64 | |
65 // Runs message loop and waits until all add/remove animations are done. | |
66 void RunMessageLoopUntilAnimationsDone(); | |
67 | |
54 private: | 68 private: |
55 LauncherView* launcher_view_; | 69 LauncherView* launcher_view_; |
56 | 70 |
57 DISALLOW_COPY_AND_ASSIGN(TestAPI); | 71 DISALLOW_COPY_AND_ASSIGN(TestAPI); |
58 }; | 72 }; |
59 | 73 |
60 LauncherView(LauncherModel* model, LauncherDelegate* delegate); | 74 LauncherView(LauncherModel* model, LauncherDelegate* delegate); |
61 virtual ~LauncherView(); | 75 virtual ~LauncherView(); |
62 | 76 |
63 void Init(); | 77 void Init(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 // The model; owned by Launcher. | 176 // The model; owned by Launcher. |
163 LauncherModel* model_; | 177 LauncherModel* model_; |
164 | 178 |
165 // Delegate; owned by Launcher. | 179 // Delegate; owned by Launcher. |
166 LauncherDelegate* delegate_; | 180 LauncherDelegate* delegate_; |
167 | 181 |
168 // Used to manage the set of active launcher buttons. There is a view per | 182 // Used to manage the set of active launcher buttons. There is a view per |
169 // item in |model_|. | 183 // item in |model_|. |
170 scoped_ptr<views::ViewModel> view_model_; | 184 scoped_ptr<views::ViewModel> view_model_; |
171 | 185 |
186 // Index of the last visible launcher button (does not go into overflow). | |
187 int last_visible_index_; | |
188 | |
172 scoped_ptr<views::BoundsAnimator> bounds_animator_; | 189 scoped_ptr<views::BoundsAnimator> bounds_animator_; |
173 | 190 |
174 views::ImageButton* overflow_button_; | 191 views::ImageButton* overflow_button_; |
175 | 192 |
176 // Are we dragging? This is only set if the mouse is dragged far enough to | 193 // Are we dragging? This is only set if the mouse is dragged far enough to |
177 // trigger a drag. | 194 // trigger a drag. |
178 bool dragging_; | 195 bool dragging_; |
179 | 196 |
180 // The view being dragged. This is set immediately when the mouse is pressed. | 197 // The view being dragged. This is set immediately when the mouse is pressed. |
181 // |dragging_| is set only if the mouse is dragged far enough. | 198 // |dragging_| is set only if the mouse is dragged far enough. |
(...skipping 16 matching lines...) Expand all Loading... | |
198 scoped_ptr<views::MenuRunner> launcher_menu_runner_; | 215 scoped_ptr<views::MenuRunner> launcher_menu_runner_; |
199 #endif | 216 #endif |
200 | 217 |
201 DISALLOW_COPY_AND_ASSIGN(LauncherView); | 218 DISALLOW_COPY_AND_ASSIGN(LauncherView); |
202 }; | 219 }; |
203 | 220 |
204 } // namespace internal | 221 } // namespace internal |
205 } // namespace ash | 222 } // namespace ash |
206 | 223 |
207 #endif // ASH_LAUNCHER_LAUNCHER_VIEW_H_ | 224 #endif // ASH_LAUNCHER_LAUNCHER_VIEW_H_ |
OLD | NEW |