| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/browser/extensions/extension_toolbar_model.h" | 15 #include "chrome/browser/extensions/extension_toolbar_model.h" |
| 15 #include "chrome/browser/ui/gtk/custom_button.h" | 16 #include "chrome/browser/ui/gtk/custom_button.h" |
| 16 #include "chrome/browser/ui/gtk/menu_gtk.h" | 17 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 17 #include "chrome/browser/ui/gtk/overflow_button.h" | 18 #include "chrome/browser/ui/gtk/overflow_button.h" |
| 18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 20 #include "ui/base/animation/animation_delegate.h" | 21 #include "ui/base/animation/animation_delegate.h" |
| 21 #include "ui/base/animation/slide_animation.h" | 22 #include "ui/base/animation/slide_animation.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 57 |
| 57 // Returns the currently selected tab ID, or -1 if there is none. | 58 // Returns the currently selected tab ID, or -1 if there is none. |
| 58 int GetCurrentTabId(); | 59 int GetCurrentTabId(); |
| 59 | 60 |
| 60 // Update the display of all buttons. | 61 // Update the display of all buttons. |
| 61 void Update(); | 62 void Update(); |
| 62 | 63 |
| 63 // content::NotificationObserver implementation. | 64 // content::NotificationObserver implementation. |
| 64 virtual void Observe(int type, | 65 virtual void Observe(int type, |
| 65 const content::NotificationSource& source, | 66 const content::NotificationSource& source, |
| 66 const content::NotificationDetails& details); | 67 const content::NotificationDetails& details) OVERRIDE; |
| 67 | 68 |
| 68 bool animating() { | 69 bool animating() { |
| 69 return resize_animation_.is_animating(); | 70 return resize_animation_.is_animating(); |
| 70 } | 71 } |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 friend class BrowserActionButton; | 74 friend class BrowserActionButton; |
| 74 | 75 |
| 75 // Initialize drag and drop. | 76 // Initialize drag and drop. |
| 76 void SetupDrags(); | 77 void SetupDrags(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 99 // Animate the toolbar to show the given number of icons. This assumes the | 100 // Animate the toolbar to show the given number of icons. This assumes the |
| 100 // visibility of the overflow button will not change. | 101 // visibility of the overflow button will not change. |
| 101 void AnimateToShowNIcons(int count); | 102 void AnimateToShowNIcons(int count); |
| 102 | 103 |
| 103 // Returns true if this extension should be shown in this toolbar. This can | 104 // Returns true if this extension should be shown in this toolbar. This can |
| 104 // return false if we are in an incognito window and the extension is disabled | 105 // return false if we are in an incognito window and the extension is disabled |
| 105 // for incognito. | 106 // for incognito. |
| 106 bool ShouldDisplayBrowserAction(const Extension* extension); | 107 bool ShouldDisplayBrowserAction(const Extension* extension); |
| 107 | 108 |
| 108 // ExtensionToolbarModel::Observer implementation. | 109 // ExtensionToolbarModel::Observer implementation. |
| 109 virtual void BrowserActionAdded(const Extension* extension, int index); | 110 virtual void BrowserActionAdded(const Extension* extension, |
| 110 virtual void BrowserActionRemoved(const Extension* extension); | 111 int index) OVERRIDE; |
| 111 virtual void BrowserActionMoved(const Extension* extension, int index); | 112 virtual void BrowserActionRemoved(const Extension* extension) OVERRIDE; |
| 112 virtual void ModelLoaded(); | 113 virtual void BrowserActionMoved(const Extension* extension, |
| 114 int index) OVERRIDE; |
| 115 virtual void ModelLoaded() OVERRIDE; |
| 113 | 116 |
| 114 // ui::AnimationDelegate implementation. | 117 // ui::AnimationDelegate implementation. |
| 115 virtual void AnimationProgressed(const ui::Animation* animation); | 118 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 116 virtual void AnimationEnded(const ui::Animation* animation); | 119 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 117 | 120 |
| 118 // SimpleMenuModel::Delegate implementation. | 121 // SimpleMenuModel::Delegate implementation. |
| 119 // In our case, |command_id| is be the index into the model's extension list. | 122 // In our case, |command_id| is be the index into the model's extension list. |
| 120 virtual bool IsCommandIdChecked(int command_id) const; | 123 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
| 121 virtual bool IsCommandIdEnabled(int command_id) const; | 124 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
| 122 virtual bool GetAcceleratorForCommandId( | 125 virtual bool GetAcceleratorForCommandId( |
| 123 int command_id, | 126 int command_id, |
| 124 ui::Accelerator* accelerator); | 127 ui::Accelerator* accelerator) OVERRIDE; |
| 125 virtual void ExecuteCommand(int command_id); | 128 virtual void ExecuteCommand(int command_id) OVERRIDE; |
| 126 | 129 |
| 127 // MenuGtk::Delegate implementation. | 130 // MenuGtk::Delegate implementation. |
| 128 virtual void StoppedShowing(); | 131 virtual void StoppedShowing() OVERRIDE; |
| 129 virtual bool AlwaysShowIconForCmd(int command_id) const; | 132 virtual bool AlwaysShowIconForCmd(int command_id) const OVERRIDE; |
| 130 | 133 |
| 131 // Called by the BrowserActionButton in response to drag-begin. | 134 // Called by the BrowserActionButton in response to drag-begin. |
| 132 void DragStarted(BrowserActionButton* button, GdkDragContext* drag_context); | 135 void DragStarted(BrowserActionButton* button, GdkDragContext* drag_context); |
| 133 | 136 |
| 134 // Sets the width of the button area of the toolbar to |new_width|, clamping | 137 // Sets the width of the button area of the toolbar to |new_width|, clamping |
| 135 // it to appropriate values. | 138 // it to appropriate values. |
| 136 void SetButtonHBoxWidth(int new_width); | 139 void SetButtonHBoxWidth(int new_width); |
| 137 | 140 |
| 138 // Shows or hides the chevron as appropriate. | 141 // Shows or hides the chevron as appropriate. |
| 139 void UpdateChevronVisibility(); | 142 void UpdateChevronVisibility(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 ui::GtkSignalRegistrar signals_; | 217 ui::GtkSignalRegistrar signals_; |
| 215 | 218 |
| 216 content::NotificationRegistrar registrar_; | 219 content::NotificationRegistrar registrar_; |
| 217 | 220 |
| 218 base::WeakPtrFactory<BrowserActionsToolbarGtk> weak_factory_; | 221 base::WeakPtrFactory<BrowserActionsToolbarGtk> weak_factory_; |
| 219 | 222 |
| 220 DISALLOW_COPY_AND_ASSIGN(BrowserActionsToolbarGtk); | 223 DISALLOW_COPY_AND_ASSIGN(BrowserActionsToolbarGtk); |
| 221 }; | 224 }; |
| 222 | 225 |
| 223 #endif // CHROME_BROWSER_UI_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_ | 226 #endif // CHROME_BROWSER_UI_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_ |
| OLD | NEW |