Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: chrome/browser/extensions/extension_popup_host.h

Issue 434046: Support for chrome.experimental.popup API in ExternalTabContainer views (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_EXTENSIONS_EXTENSION_POPUP_HOST_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_POPUP_HOST_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_POPUP_HOST_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_POPUP_HOST_H_
7 7
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #if defined(TOOLKIT_VIEWS) 10 #if defined(TOOLKIT_VIEWS)
(...skipping 18 matching lines...) Expand all
29 public BrowserBubble::Delegate, 29 public BrowserBubble::Delegate,
30 #endif 30 #endif
31 public NotificationObserver { 31 public NotificationObserver {
32 public: 32 public:
33 // Classes wishing to host pop-ups should inherit from this class, and 33 // Classes wishing to host pop-ups should inherit from this class, and
34 // implement the virtual methods below. This class manages the lifetime 34 // implement the virtual methods below. This class manages the lifetime
35 // of an ExtensionPopupHost instance. 35 // of an ExtensionPopupHost instance.
36 class PopupDelegate { 36 class PopupDelegate {
37 public: 37 public:
38 PopupDelegate() {} 38 PopupDelegate() {}
39 virtual ~PopupDelegate() {} 39 virtual ~PopupDelegate();
40 virtual Browser* GetBrowser() = 0; 40 virtual Browser* GetBrowser() const = 0;
41 virtual RenderViewHost* GetRenderViewHost() = 0; 41 virtual RenderViewHost* GetRenderViewHost() = 0;
42 virtual Profile* GetProfile();
42 43
43 // Constructs, or returns the existing ExtensionPopupHost instance. 44 // Constructs, or returns the existing ExtensionPopupHost instance.
44 ExtensionPopupHost* popup_host(); 45 ExtensionPopupHost* popup_host();
46
45 private: 47 private:
46 scoped_ptr<ExtensionPopupHost> popup_host_; 48 scoped_ptr<ExtensionPopupHost> popup_host_;
47 49
48 DISALLOW_COPY_AND_ASSIGN(PopupDelegate); 50 DISALLOW_COPY_AND_ASSIGN(PopupDelegate);
49 }; 51 };
50 52
51 explicit ExtensionPopupHost(PopupDelegate* delegate); 53 explicit ExtensionPopupHost(PopupDelegate* delegate);
52 virtual ~ExtensionPopupHost(); 54 virtual ~ExtensionPopupHost();
53 55
56 void RevokeDelegate() { delegate_ = NULL; }
57
54 // Dismiss the hosted pop-up, if one is present. 58 // Dismiss the hosted pop-up, if one is present.
55 void DismissPopup(); 59 void DismissPopup();
56 60
57 #if defined(TOOLKIT_VIEWS) 61 #if defined(TOOLKIT_VIEWS)
58 ExtensionPopup* child_popup() const { return child_popup_; } 62 ExtensionPopup* child_popup() const { return child_popup_; }
59 void set_child_popup(ExtensionPopup* popup) { 63 void set_child_popup(ExtensionPopup* popup) {
60 // An extension may only have one popup active at a given time. 64 // An extension may only have one popup active at a given time.
61 DismissPopup(); 65 DismissPopup();
62 child_popup_ = popup; 66 child_popup_ = popup;
63 } 67 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 PopupDelegate* delegate_; 100 PopupDelegate* delegate_;
97 101
98 // Boolean value used to ensure that the host only registers for event 102 // Boolean value used to ensure that the host only registers for event
99 // notifications once. 103 // notifications once.
100 bool listeners_registered_; 104 bool listeners_registered_;
101 105
102 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupHost); 106 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupHost);
103 }; 107 };
104 108
105 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_POPUP_HOST_H_ 109 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_POPUP_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698