| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXTENSIONS_EXTENSION_ACTION_VIEW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/extensions/extension_action_icon_factory.h" | 8 #include "chrome/browser/extensions/extension_action_icon_factory.h" |
| 9 #include "chrome/browser/extensions/extension_context_menu_model.h" | 9 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 10 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 10 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 public views::ContextMenuController, | 51 public views::ContextMenuController, |
| 52 public views::WidgetObserver { | 52 public views::WidgetObserver { |
| 53 public: | 53 public: |
| 54 ExtensionActionViewController(const extensions::Extension* extension, | 54 ExtensionActionViewController(const extensions::Extension* extension, |
| 55 Browser* browser, | 55 Browser* browser, |
| 56 ExtensionAction* extension_action, | 56 ExtensionAction* extension_action, |
| 57 ExtensionActionViewDelegate* delegate); | 57 ExtensionActionViewDelegate* delegate); |
| 58 virtual ~ExtensionActionViewController(); | 58 virtual ~ExtensionActionViewController(); |
| 59 | 59 |
| 60 // ExtensionContextMenuModel::PopupDelegate: | 60 // ExtensionContextMenuModel::PopupDelegate: |
| 61 virtual void InspectPopup() OVERRIDE; | 61 virtual void InspectPopup() override; |
| 62 | 62 |
| 63 // Executes the default extension action (typically showing the popup), and | 63 // Executes the default extension action (typically showing the popup), and |
| 64 // attributes the action to a user (thus, only use this for actions that | 64 // attributes the action to a user (thus, only use this for actions that |
| 65 // *were* done by the user). | 65 // *were* done by the user). |
| 66 void ExecuteActionByUser(); | 66 void ExecuteActionByUser(); |
| 67 | 67 |
| 68 // Executes the extension action with |show_action|. If | 68 // Executes the extension action with |show_action|. If |
| 69 // |grant_tab_permissions| is true, this will grant the extension active tab | 69 // |grant_tab_permissions| is true, this will grant the extension active tab |
| 70 // permissions. Only do this if this was done through a user action (and not | 70 // permissions. Only do this if this was done through a user action (and not |
| 71 // e.g. an API). Returns true if a popup is shown. | 71 // e.g. an API). Returns true if a popup is shown. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 92 | 92 |
| 93 const extensions::Extension* extension() const { return extension_; } | 93 const extensions::Extension* extension() const { return extension_; } |
| 94 Browser* browser() { return browser_; } | 94 Browser* browser() { return browser_; } |
| 95 ExtensionAction* extension_action() { return extension_action_; } | 95 ExtensionAction* extension_action() { return extension_action_; } |
| 96 const ExtensionAction* extension_action() const { return extension_action_; } | 96 const ExtensionAction* extension_action() const { return extension_action_; } |
| 97 ExtensionPopup* popup() { return popup_; } | 97 ExtensionPopup* popup() { return popup_; } |
| 98 bool is_menu_running() const { return menu_runner_.get() != NULL; } | 98 bool is_menu_running() const { return menu_runner_.get() != NULL; } |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 // ExtensionActionIconFactory::Observer: | 101 // ExtensionActionIconFactory::Observer: |
| 102 virtual void OnIconUpdated() OVERRIDE; | 102 virtual void OnIconUpdated() override; |
| 103 | 103 |
| 104 // ui::AcceleratorTarget: | 104 // ui::AcceleratorTarget: |
| 105 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 105 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
| 106 virtual bool CanHandleAccelerators() const OVERRIDE; | 106 virtual bool CanHandleAccelerators() const override; |
| 107 | 107 |
| 108 // views::WidgetObserver: | 108 // views::WidgetObserver: |
| 109 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; | 109 virtual void OnWidgetDestroying(views::Widget* widget) override; |
| 110 | 110 |
| 111 // views::ContextMenuController: | 111 // views::ContextMenuController: |
| 112 virtual void ShowContextMenuForView(views::View* source, | 112 virtual void ShowContextMenuForView(views::View* source, |
| 113 const gfx::Point& point, | 113 const gfx::Point& point, |
| 114 ui::MenuSourceType source_type) OVERRIDE; | 114 ui::MenuSourceType source_type) override; |
| 115 | 115 |
| 116 // Shows the context menu for extension action. | 116 // Shows the context menu for extension action. |
| 117 void DoShowContextMenu(ui::MenuSourceType source_type); | 117 void DoShowContextMenu(ui::MenuSourceType source_type); |
| 118 | 118 |
| 119 // Shows the popup for the extension action, given the associated |popup_url|. | 119 // Shows the popup for the extension action, given the associated |popup_url|. |
| 120 // |grant_tab_permissions| is true if active tab permissions should be given | 120 // |grant_tab_permissions| is true if active tab permissions should be given |
| 121 // to the extension; this is only true if the popup is opened through a user | 121 // to the extension; this is only true if the popup is opened through a user |
| 122 // action. | 122 // action. |
| 123 // Returns true if a popup is successfully shown. | 123 // Returns true if a popup is successfully shown. |
| 124 bool ShowPopupWithUrl(ExtensionPopup::ShowAction show_action, | 124 bool ShowPopupWithUrl(ExtensionPopup::ShowAction show_action, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // If non-NULL, this is the next ExtensionActionViewController context menu | 172 // If non-NULL, this is the next ExtensionActionViewController context menu |
| 173 // which wants to run once the current owner (this one) is done. | 173 // which wants to run once the current owner (this one) is done. |
| 174 base::Closure followup_context_menu_task_; | 174 base::Closure followup_context_menu_task_; |
| 175 | 175 |
| 176 base::WeakPtrFactory<ExtensionActionViewController> weak_factory_; | 176 base::WeakPtrFactory<ExtensionActionViewController> weak_factory_; |
| 177 | 177 |
| 178 DISALLOW_COPY_AND_ASSIGN(ExtensionActionViewController); | 178 DISALLOW_COPY_AND_ASSIGN(ExtensionActionViewController); |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_CONTROLLER_H
_ | 181 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_CONTROLLER_H
_ |
| OLD | NEW |