Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/linked_ptr.h" 13 #include "base/memory/linked_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/extensions/extension_toolbar_model.h" 15 #include "chrome/browser/extensions/extension_toolbar_model.h"
16 #include "chrome/browser/ui/gtk/custom_button.h" 16 #include "chrome/browser/ui/gtk/custom_button.h"
17 #include "chrome/browser/ui/gtk/menu_gtk.h" 17 #include "chrome/browser/ui/gtk/menu_gtk.h"
18 #include "chrome/browser/ui/gtk/overflow_button.h" 18 #include "chrome/browser/ui/gtk/overflow_button.h"
19 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
21 #include "ui/base/animation/animation_delegate.h" 21 #include "ui/base/animation/animation_delegate.h"
22 #include "ui/base/animation/slide_animation.h" 22 #include "ui/base/animation/slide_animation.h"
23 #include "ui/base/gtk/gtk_signal.h" 23 #include "ui/base/gtk/gtk_signal.h"
24 #include "ui/base/gtk/gtk_signal_registrar.h" 24 #include "ui/base/gtk/gtk_signal_registrar.h"
25 #include "ui/base/gtk/owned_widget_gtk.h" 25 #include "ui/base/gtk/owned_widget_gtk.h"
26 #include "ui/base/models/simple_menu_model.h" 26 #include "ui/base/models/simple_menu_model.h"
27 27
28 class Browser; 28 class Browser;
29 class BrowserActionButton; 29 class BrowserActionButton;
30 class Extension;
31 class GtkThemeService; 30 class GtkThemeService;
32 class Profile; 31 class Profile;
33 32
33 namespace extensions {
34 class Extension;
35 }
36
34 typedef struct _GdkDragContext GdkDragContext; 37 typedef struct _GdkDragContext GdkDragContext;
35 typedef struct _GtkWidget GtkWidget; 38 typedef struct _GtkWidget GtkWidget;
36 39
37 class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer, 40 class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer,
38 public ui::AnimationDelegate, 41 public ui::AnimationDelegate,
39 public MenuGtk::Delegate, 42 public MenuGtk::Delegate,
40 public ui::SimpleMenuModel::Delegate, 43 public ui::SimpleMenuModel::Delegate,
41 public content::NotificationObserver { 44 public content::NotificationObserver {
42 public: 45 public:
43 explicit BrowserActionsToolbarGtk(Browser* browser); 46 explicit BrowserActionsToolbarGtk(Browser* browser);
44 virtual ~BrowserActionsToolbarGtk(); 47 virtual ~BrowserActionsToolbarGtk();
45 48
46 GtkWidget* widget() { return hbox_.get(); } 49 GtkWidget* widget() { return hbox_.get(); }
47 GtkWidget* chevron() { return overflow_button_->widget(); } 50 GtkWidget* chevron() { return overflow_button_->widget(); }
48 51
49 // Returns the widget in use by the BrowserActionButton corresponding to 52 // Returns the widget in use by the BrowserActionButton corresponding to
50 // |extension|. Used in positioning the ExtensionInstalledBubble for 53 // |extension|. Used in positioning the ExtensionInstalledBubble for
51 // BrowserActions. 54 // BrowserActions.
52 GtkWidget* GetBrowserActionWidget(const Extension* extension); 55 GtkWidget* GetBrowserActionWidget(const extensions::Extension* extension);
53 56
54 int button_count() { return extension_button_map_.size(); } 57 int button_count() { return extension_button_map_.size(); }
55 58
56 Browser* browser() { return browser_; } 59 Browser* browser() { return browser_; }
57 60
58 ExtensionToolbarModel* model() { return model_; } 61 ExtensionToolbarModel* model() { return model_; }
59 62
60 // Returns the currently selected tab ID, or -1 if there is none. 63 // Returns the currently selected tab ID, or -1 if there is none.
61 int GetCurrentTabId(); 64 int GetCurrentTabId();
62 65
(...skipping 17 matching lines...) Expand all
80 83
81 // Query the extensions service for all extensions with browser actions, 84 // Query the extensions service for all extensions with browser actions,
82 // and create the UI for them. 85 // and create the UI for them.
83 void CreateAllButtons(); 86 void CreateAllButtons();
84 87
85 // Sets the width of the container and overflow state according to the model. 88 // Sets the width of the container and overflow state according to the model.
86 void SetContainerWidth(); 89 void SetContainerWidth();
87 90
88 // Create the UI for a single browser action. This will stick the button 91 // Create the UI for a single browser action. This will stick the button
89 // at the end of the toolbar. 92 // at the end of the toolbar.
90 void CreateButtonForExtension(const Extension* extension, int index); 93 void CreateButtonForExtension(const extensions::Extension* extension,
94 int index);
91 95
92 // Delete resources associated with UI for a browser action. 96 // Delete resources associated with UI for a browser action.
93 void RemoveButtonForExtension(const Extension* extension); 97 void RemoveButtonForExtension(const extensions::Extension* extension);
94 98
95 // Change the visibility of widget() based on whether we have any buttons 99 // Change the visibility of widget() based on whether we have any buttons
96 // to show. 100 // to show.
97 void UpdateVisibility(); 101 void UpdateVisibility();
98 102
99 // Hide the extension popup, if any. 103 // Hide the extension popup, if any.
100 void HidePopup(); 104 void HidePopup();
101 105
102 // Animate the toolbar to show the given number of icons. This assumes the 106 // Animate the toolbar to show the given number of icons. This assumes the
103 // visibility of the overflow button will not change. 107 // visibility of the overflow button will not change.
104 void AnimateToShowNIcons(int count); 108 void AnimateToShowNIcons(int count);
105 109
106 // Returns true if this extension should be shown in this toolbar. This can 110 // Returns true if this extension should be shown in this toolbar. This can
107 // return false if we are in an incognito window and the extension is disabled 111 // return false if we are in an incognito window and the extension is disabled
108 // for incognito. 112 // for incognito.
109 bool ShouldDisplayBrowserAction(const Extension* extension); 113 bool ShouldDisplayBrowserAction(const extensions::Extension* extension);
110 114
111 // ExtensionToolbarModel::Observer implementation. 115 // ExtensionToolbarModel::Observer implementation.
112 virtual void BrowserActionAdded(const Extension* extension, 116 virtual void BrowserActionAdded(const extensions::Extension* extension,
113 int index) OVERRIDE; 117 int index) OVERRIDE;
114 virtual void BrowserActionRemoved(const Extension* extension) OVERRIDE; 118 virtual void BrowserActionRemoved(
115 virtual void BrowserActionMoved(const Extension* extension, 119 const extensions::Extension* extension) OVERRIDE;
120 virtual void BrowserActionMoved(const extensions::Extension* extension,
116 int index) OVERRIDE; 121 int index) OVERRIDE;
117 virtual void ModelLoaded() OVERRIDE; 122 virtual void ModelLoaded() OVERRIDE;
118 123
119 // ui::AnimationDelegate implementation. 124 // ui::AnimationDelegate implementation.
120 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 125 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
121 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 126 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
122 127
123 // SimpleMenuModel::Delegate implementation. 128 // SimpleMenuModel::Delegate implementation.
124 // In our case, |command_id| is be the index into the model's extension list. 129 // In our case, |command_id| is be the index into the model's extension list.
125 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 130 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 ui::GtkSignalRegistrar signals_; 224 ui::GtkSignalRegistrar signals_;
220 225
221 content::NotificationRegistrar registrar_; 226 content::NotificationRegistrar registrar_;
222 227
223 base::WeakPtrFactory<BrowserActionsToolbarGtk> weak_factory_; 228 base::WeakPtrFactory<BrowserActionsToolbarGtk> weak_factory_;
224 229
225 DISALLOW_COPY_AND_ASSIGN(BrowserActionsToolbarGtk); 230 DISALLOW_COPY_AND_ASSIGN(BrowserActionsToolbarGtk);
226 }; 231 };
227 232
228 #endif // CHROME_BROWSER_UI_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_ 233 #endif // CHROME_BROWSER_UI_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/fullscreen_exit_bubble_type.cc ('k') | chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698