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 CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ |
7 | 7 |
8 #include "chrome/browser/extensions/extension_toolbar_model.h" | 8 #include "chrome/browser/extensions/extension_toolbar_model.h" |
9 #include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_contro
ller.h" | 9 #include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_contro
ller.h" |
10 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" | 10 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" |
11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
12 #include "ui/base/animation/animation_delegate.h" | 12 #include "ui/base/animation/animation_delegate.h" |
13 #include "ui/base/animation/tween.h" | 13 #include "ui/base/animation/tween.h" |
14 #include "ui/views/controls/button/menu_button.h" | 14 #include "ui/views/controls/button/menu_button.h" |
15 #include "ui/views/controls/button/menu_button_listener.h" | 15 #include "ui/views/controls/button/menu_button_listener.h" |
16 #include "ui/views/controls/resize_area_delegate.h" | 16 #include "ui/views/controls/resize_area_delegate.h" |
17 #include "ui/views/drag_controller.h" | 17 #include "ui/views/drag_controller.h" |
18 #include "ui/views/view.h" | 18 #include "ui/views/view.h" |
19 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget_observer.h" |
20 | 20 |
21 class BrowserActionButton; | 21 class BrowserActionButton; |
22 class ExtensionPopup; | 22 class ExtensionPopup; |
23 | 23 |
24 namespace ui { | 24 namespace ui { |
25 class SlideAnimation; | 25 class SlideAnimation; |
26 } | 26 } |
27 | 27 |
28 namespace views { | 28 namespace views { |
29 class ResizeArea; | 29 class ResizeArea; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // | 102 // |
103 //////////////////////////////////////////////////////////////////////////////// | 103 //////////////////////////////////////////////////////////////////////////////// |
104 class BrowserActionsContainer | 104 class BrowserActionsContainer |
105 : public views::View, | 105 : public views::View, |
106 public views::MenuButtonListener, | 106 public views::MenuButtonListener, |
107 public views::DragController, | 107 public views::DragController, |
108 public views::ResizeAreaDelegate, | 108 public views::ResizeAreaDelegate, |
109 public ui::AnimationDelegate, | 109 public ui::AnimationDelegate, |
110 public ExtensionToolbarModel::Observer, | 110 public ExtensionToolbarModel::Observer, |
111 public BrowserActionOverflowMenuController::Observer, | 111 public BrowserActionOverflowMenuController::Observer, |
112 public views::Widget::Observer { | 112 public views::WidgetObserver { |
113 public: | 113 public: |
114 BrowserActionsContainer(Browser* browser, views::View* owner_view); | 114 BrowserActionsContainer(Browser* browser, views::View* owner_view); |
115 virtual ~BrowserActionsContainer(); | 115 virtual ~BrowserActionsContainer(); |
116 | 116 |
117 void Init(); | 117 void Init(); |
118 | 118 |
119 // Get the number of browser actions being displayed. | 119 // Get the number of browser actions being displayed. |
120 int num_browser_actions() const { return browser_action_views_.size(); } | 120 int num_browser_actions() const { return browser_action_views_.size(); } |
121 | 121 |
122 // Whether we are performing resize animation on the container. | 122 // Whether we are performing resize animation on the container. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 virtual void OnResize(int resize_amount, bool done_resizing) OVERRIDE; | 192 virtual void OnResize(int resize_amount, bool done_resizing) OVERRIDE; |
193 | 193 |
194 // Overridden from ui::AnimationDelegate: | 194 // Overridden from ui::AnimationDelegate: |
195 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 195 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
196 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 196 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
197 | 197 |
198 // Overridden from BrowserActionOverflowMenuController::Observer: | 198 // Overridden from BrowserActionOverflowMenuController::Observer: |
199 virtual void NotifyMenuDeleted( | 199 virtual void NotifyMenuDeleted( |
200 BrowserActionOverflowMenuController* controller) OVERRIDE; | 200 BrowserActionOverflowMenuController* controller) OVERRIDE; |
201 | 201 |
202 // Overridden from views::Widget::Observer | 202 // Overridden from views::WidgetObserver: |
203 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | 203 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
204 | 204 |
205 // Moves a browser action with |id| to |new_index|. | 205 // Moves a browser action with |id| to |new_index|. |
206 void MoveBrowserAction(const std::string& extension_id, size_t new_index); | 206 void MoveBrowserAction(const std::string& extension_id, size_t new_index); |
207 | 207 |
208 // Hide the current popup. | 208 // Hide the current popup. |
209 void HidePopup(); | 209 void HidePopup(); |
210 | 210 |
211 // Simulate a click on a browser action button. This should only be | 211 // Simulate a click on a browser action button. This should only be |
212 // used by unit tests. | 212 // used by unit tests. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 base::WeakPtrFactory<BrowserActionsContainer> task_factory_; | 364 base::WeakPtrFactory<BrowserActionsContainer> task_factory_; |
365 | 365 |
366 // Handles delayed showing of the overflow menu when hovering. | 366 // Handles delayed showing of the overflow menu when hovering. |
367 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_; | 367 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_; |
368 | 368 |
369 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); | 369 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); |
370 }; | 370 }; |
371 | 371 |
372 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ | 372 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ |
OLD | NEW |