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_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/extensions/extension_toolbar_model.h" | 14 #include "chrome/browser/extensions/extension_toolbar_model.h" |
15 #include "chrome/browser/ui/gtk/custom_button.h" | 15 #include "chrome/browser/ui/gtk/custom_button.h" |
16 #include "chrome/browser/ui/gtk/menu_gtk.h" | 16 #include "chrome/browser/ui/gtk/menu_gtk.h" |
17 #include "chrome/browser/ui/gtk/overflow_button.h" | 17 #include "chrome/browser/ui/gtk/overflow_button.h" |
18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
20 #include "ui/base/animation/animation_delegate.h" | |
21 #include "ui/base/animation/slide_animation.h" | |
22 #include "ui/base/gtk/gtk_signal.h" | 20 #include "ui/base/gtk/gtk_signal.h" |
23 #include "ui/base/gtk/gtk_signal_registrar.h" | 21 #include "ui/base/gtk/gtk_signal_registrar.h" |
24 #include "ui/base/gtk/owned_widget_gtk.h" | 22 #include "ui/base/gtk/owned_widget_gtk.h" |
25 #include "ui/base/models/simple_menu_model.h" | 23 #include "ui/base/models/simple_menu_model.h" |
| 24 #include "ui/gfx/animation/animation_delegate.h" |
| 25 #include "ui/gfx/animation/slide_animation.h" |
26 | 26 |
27 class Browser; | 27 class Browser; |
28 class BrowserActionButton; | 28 class BrowserActionButton; |
29 class GtkThemeService; | 29 class GtkThemeService; |
30 class Profile; | 30 class Profile; |
31 | 31 |
32 namespace extensions { | 32 namespace extensions { |
33 class Extension; | 33 class Extension; |
34 } | 34 } |
35 | 35 |
36 typedef struct _GdkDragContext GdkDragContext; | 36 typedef struct _GdkDragContext GdkDragContext; |
37 typedef struct _GtkWidget GtkWidget; | 37 typedef struct _GtkWidget GtkWidget; |
38 | 38 |
39 class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer, | 39 class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer, |
40 public ui::AnimationDelegate, | 40 public gfx::AnimationDelegate, |
41 public MenuGtk::Delegate, | 41 public MenuGtk::Delegate, |
42 public ui::SimpleMenuModel::Delegate, | 42 public ui::SimpleMenuModel::Delegate, |
43 public content::NotificationObserver { | 43 public content::NotificationObserver { |
44 public: | 44 public: |
45 explicit BrowserActionsToolbarGtk(Browser* browser); | 45 explicit BrowserActionsToolbarGtk(Browser* browser); |
46 virtual ~BrowserActionsToolbarGtk(); | 46 virtual ~BrowserActionsToolbarGtk(); |
47 | 47 |
48 GtkWidget* widget() { return hbox_.get(); } | 48 GtkWidget* widget() { return hbox_.get(); } |
49 GtkWidget* chevron() { return overflow_button_->widget(); } | 49 GtkWidget* chevron() { return overflow_button_->widget(); } |
50 | 50 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 // ExtensionToolbarModel::Observer implementation. | 114 // ExtensionToolbarModel::Observer implementation. |
115 virtual void BrowserActionAdded(const extensions::Extension* extension, | 115 virtual void BrowserActionAdded(const extensions::Extension* extension, |
116 int index) OVERRIDE; | 116 int index) OVERRIDE; |
117 virtual void BrowserActionRemoved( | 117 virtual void BrowserActionRemoved( |
118 const extensions::Extension* extension) OVERRIDE; | 118 const extensions::Extension* extension) OVERRIDE; |
119 virtual void BrowserActionMoved(const extensions::Extension* extension, | 119 virtual void BrowserActionMoved(const extensions::Extension* extension, |
120 int index) OVERRIDE; | 120 int index) OVERRIDE; |
121 virtual void ModelLoaded() OVERRIDE; | 121 virtual void ModelLoaded() OVERRIDE; |
122 | 122 |
123 // ui::AnimationDelegate implementation. | 123 // gfx::AnimationDelegate implementation. |
124 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 124 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
125 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 125 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; |
126 | 126 |
127 // SimpleMenuModel::Delegate implementation. | 127 // SimpleMenuModel::Delegate implementation. |
128 // In our case, |command_id| is be the index into the model's extension list. | 128 // In our case, |command_id| is be the index into the model's extension list. |
129 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 129 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
130 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 130 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
131 virtual bool GetAcceleratorForCommandId( | 131 virtual bool GetAcceleratorForCommandId( |
132 int command_id, | 132 int command_id, |
133 ui::Accelerator* accelerator) OVERRIDE; | 133 ui::Accelerator* accelerator) OVERRIDE; |
134 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 134 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; |
135 | 135 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 int drop_index_; | 207 int drop_index_; |
208 | 208 |
209 // Map from extension ID to BrowserActionButton, which is a wrapper for | 209 // Map from extension ID to BrowserActionButton, which is a wrapper for |
210 // a chrome button and related functionality. There should be one entry | 210 // a chrome button and related functionality. There should be one entry |
211 // for every extension that has a browser action. | 211 // for every extension that has a browser action. |
212 typedef std::map<std::string, linked_ptr<BrowserActionButton> > | 212 typedef std::map<std::string, linked_ptr<BrowserActionButton> > |
213 ExtensionButtonMap; | 213 ExtensionButtonMap; |
214 ExtensionButtonMap extension_button_map_; | 214 ExtensionButtonMap extension_button_map_; |
215 | 215 |
216 // We use this animation for the smart resizing of the toolbar. | 216 // We use this animation for the smart resizing of the toolbar. |
217 ui::SlideAnimation resize_animation_; | 217 gfx::SlideAnimation resize_animation_; |
218 // This is the final width we are animating towards. | 218 // This is the final width we are animating towards. |
219 int desired_width_; | 219 int desired_width_; |
220 // This is the width we were at when we started animating. | 220 // This is the width we were at when we started animating. |
221 int start_width_; | 221 int start_width_; |
222 | 222 |
223 ui::GtkSignalRegistrar signals_; | 223 ui::GtkSignalRegistrar signals_; |
224 | 224 |
225 content::NotificationRegistrar registrar_; | 225 content::NotificationRegistrar registrar_; |
226 | 226 |
227 base::WeakPtrFactory<BrowserActionsToolbarGtk> weak_factory_; | 227 base::WeakPtrFactory<BrowserActionsToolbarGtk> weak_factory_; |
228 | 228 |
229 DISALLOW_COPY_AND_ASSIGN(BrowserActionsToolbarGtk); | 229 DISALLOW_COPY_AND_ASSIGN(BrowserActionsToolbarGtk); |
230 }; | 230 }; |
231 | 231 |
232 #endif // CHROME_BROWSER_UI_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_ | 232 #endif // CHROME_BROWSER_UI_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_ |
OLD | NEW |