| 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 "base/mac/scoped_nsobject.h" |
| 9 #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" | 10 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
| 12 | 12 |
| 13 @class ExtensionPopupController; | 13 @class ExtensionPopupController; |
| 14 class ToolbarActionViewDelegateCocoa; | |
| 15 | 14 |
| 16 // The Cocoa-specific implementation for ExtensionActionPlatformDelegate. | 15 // The Cocoa-specific implementation for ExtensionActionPlatformDelegate. |
| 17 class ExtensionActionPlatformDelegateCocoa | 16 class ExtensionActionPlatformDelegateCocoa |
| 18 : public ExtensionActionPlatformDelegate, | 17 : public ExtensionActionPlatformDelegate, |
| 19 public content::NotificationObserver { | 18 public content::NotificationObserver { |
| 20 public: | 19 public: |
| 21 ExtensionActionPlatformDelegateCocoa( | 20 ExtensionActionPlatformDelegateCocoa( |
| 22 ExtensionActionViewController* controller); | 21 ExtensionActionViewController* controller); |
| 23 ~ExtensionActionPlatformDelegateCocoa() override; | 22 ~ExtensionActionPlatformDelegateCocoa() override; |
| 24 | 23 |
| 25 private: | 24 private: |
| 26 // ExtensionActionPlatformDelegate: | 25 // ExtensionActionPlatformDelegate: |
| 27 bool IsMenuRunning() const override; | 26 bool IsMenuRunning() const override; |
| 28 void RegisterCommand() override; | 27 void RegisterCommand() override; |
| 29 void OnDelegateSet() override; | 28 void OnDelegateSet() override; |
| 30 void CloseActivePopup() override; | 29 void CloseActivePopup() override; |
| 31 extensions::ExtensionViewHost* ShowPopupWithUrl( | 30 extensions::ExtensionViewHost* ShowPopupWithUrl( |
| 32 ExtensionActionViewController::PopupShowAction show_action, | 31 ExtensionActionViewController::PopupShowAction show_action, |
| 33 const GURL& popup_url, | 32 const GURL& popup_url, |
| 34 bool grant_tab_permissions) override; | 33 bool grant_tab_permissions) override; |
| 35 | 34 |
| 36 // content::NotificationObserver: | 35 // content::NotificationObserver: |
| 37 void Observe(int type, | 36 void Observe(int type, |
| 38 const content::NotificationSource& source, | 37 const content::NotificationSource& source, |
| 39 const content::NotificationDetails& details) override; | 38 const content::NotificationDetails& details) override; |
| 40 | 39 |
| 41 // Returns the delegate in its Cocoa implementation. | 40 // Returns the point at which the popup should be shown. |
| 42 ToolbarActionViewDelegateCocoa* GetDelegateCocoa(); | 41 NSPoint GetPopupPoint() const; |
| 43 | 42 |
| 44 // The main controller for this extension action. | 43 // The main controller for this extension action. |
| 45 ExtensionActionViewController* controller_; | 44 ExtensionActionViewController* controller_; |
| 46 | 45 |
| 47 content::NotificationRegistrar registrar_; | 46 content::NotificationRegistrar registrar_; |
| 48 | 47 |
| 49 DISALLOW_COPY_AND_ASSIGN(ExtensionActionPlatformDelegateCocoa); | 48 DISALLOW_COPY_AND_ASSIGN(ExtensionActionPlatformDelegateCocoa); |
| 50 }; | 49 }; |
| 51 | 50 |
| 52 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE
_COCOA_H_ | 51 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE
_COCOA_H_ |
| OLD | NEW |