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_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_CO
COA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_CO
COA_H_ |
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_CO
COA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_CO
COA_H_ |
7 | 7 |
| 8 #include "base/mac/scoped_nsobject.h" |
8 #include "chrome/browser/ui/extensions/extension_action_platform_delegate.h" | 9 #include "chrome/browser/ui/extensions/extension_action_platform_delegate.h" |
| 10 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" |
9 | 12 |
| 13 @class ExtensionActionContextMenuController; |
10 @class ExtensionPopupController; | 14 @class ExtensionPopupController; |
11 class ToolbarActionViewDelegateCocoa; | 15 class ToolbarActionViewDelegateCocoa; |
12 | 16 |
13 // The cocoa-specific implementation for ExtensionActionPlatformDelegate. | 17 // The cocoa-specific implementation for ExtensionActionPlatformDelegate. |
14 class ExtensionActionPlatformDelegateCocoa | 18 class ExtensionActionPlatformDelegateCocoa |
15 : public ExtensionActionPlatformDelegate { | 19 : public ExtensionActionPlatformDelegate, |
| 20 public content::NotificationObserver { |
16 public: | 21 public: |
17 ExtensionActionPlatformDelegateCocoa( | 22 ExtensionActionPlatformDelegateCocoa( |
18 ExtensionActionViewController* controller); | 23 ExtensionActionViewController* controller); |
19 ~ExtensionActionPlatformDelegateCocoa() override; | 24 ~ExtensionActionPlatformDelegateCocoa() override; |
20 | 25 |
21 private: | 26 private: |
22 // ExtensionActionPlatformDelegate: | 27 // ExtensionActionPlatformDelegate: |
23 gfx::NativeView GetPopupNativeView() override; | 28 gfx::NativeView GetPopupNativeView() override; |
24 bool IsMenuRunning() const override; | 29 bool IsMenuRunning() const override; |
25 void RegisterCommand() override; | 30 void RegisterCommand() override; |
26 void OnDelegateSet() override; | 31 void OnDelegateSet() override; |
27 bool IsShowingPopup() const override; | 32 bool IsShowingPopup() const override; |
28 void CloseActivePopup() override; | 33 void CloseActivePopup() override; |
29 void CloseOwnPopup() override; | 34 void CloseOwnPopup() override; |
30 bool ShowPopupWithUrl( | 35 bool ShowPopupWithUrl( |
31 ExtensionActionViewController::PopupShowAction show_action, | 36 ExtensionActionViewController::PopupShowAction show_action, |
32 const GURL& popup_url, | 37 const GURL& popup_url, |
33 bool grant_tab_permissions) override; | 38 bool grant_tab_permissions) override; |
34 | 39 |
| 40 // content::NotificationObserver: |
| 41 void Observe(int type, |
| 42 const content::NotificationSource& source, |
| 43 const content::NotificationDetails& details) override; |
| 44 |
35 // Returns the popup shown by this extension action, if one exists. | 45 // Returns the popup shown by this extension action, if one exists. |
36 ExtensionPopupController* GetPopup() const; | 46 ExtensionPopupController* GetPopup() const; |
37 | 47 |
38 // Returns the delegate in its cocoa implementation. | 48 // Returns the delegate in its cocoa implementation. |
39 ToolbarActionViewDelegateCocoa* GetDelegateCocoa(); | 49 ToolbarActionViewDelegateCocoa* GetDelegateCocoa(); |
40 | 50 |
| 51 // The main controller for this extension action. |
41 ExtensionActionViewController* controller_; | 52 ExtensionActionViewController* controller_; |
42 | 53 |
| 54 // The context menu controller for the extension action, if any. |
| 55 base::scoped_nsobject<ExtensionActionContextMenuController> menuController_; |
| 56 |
| 57 content::NotificationRegistrar registrar_; |
| 58 |
43 DISALLOW_COPY_AND_ASSIGN(ExtensionActionPlatformDelegateCocoa); | 59 DISALLOW_COPY_AND_ASSIGN(ExtensionActionPlatformDelegateCocoa); |
44 }; | 60 }; |
45 | 61 |
46 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE
_COCOA_H_ | 62 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE
_COCOA_H_ |
OLD | NEW |