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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_COCOA_H_
8 #include "base/mac/scoped_nsobject.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"
13 @
class ExtensionPopupController
;
15 // The Cocoa-specific implementation for ExtensionActionPlatformDelegate.
16 class ExtensionActionPlatformDelegateCocoa
17 : public ExtensionActionPlatformDelegate
,
18 public content::NotificationObserver
{
20 ExtensionActionPlatformDelegateCocoa(
21 ExtensionActionViewController
* controller
);
22 ~ExtensionActionPlatformDelegateCocoa() override
;
25 // ExtensionActionPlatformDelegate:
26 bool IsMenuRunning() const override
;
27 void RegisterCommand() override
;
28 void OnDelegateSet() override
;
29 void CloseActivePopup() override
;
30 extensions::ExtensionViewHost
* ShowPopupWithUrl(
31 ExtensionActionViewController::PopupShowAction show_action
,
32 const GURL
& popup_url
,
33 bool grant_tab_permissions
) override
;
35 // content::NotificationObserver:
36 void Observe(int type
,
37 const content::NotificationSource
& source
,
38 const content::NotificationDetails
& details
) override
;
40 // Returns the point at which the popup should be shown.
41 NSPoint
GetPopupPoint() const;
43 // The main controller for this extension action.
44 ExtensionActionViewController
* controller_
;
46 content::NotificationRegistrar registrar_
;
48 DISALLOW_COPY_AND_ASSIGN(ExtensionActionPlatformDelegateCocoa
);
51 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_COCOA_H_