| Index: chrome/browser/ui/views/extensions/extension_popup.h
|
| ===================================================================
|
| --- chrome/browser/ui/views/extensions/extension_popup.h (revision 73621)
|
| +++ chrome/browser/ui/views/extensions/extension_popup.h (working copy)
|
| @@ -6,6 +6,7 @@
|
| #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_
|
| #pragma once
|
|
|
| +#include "base/ref_counted.h"
|
| #include "chrome/browser/extensions/extension_host.h"
|
| #include "chrome/browser/ui/views/browser_bubble.h"
|
| #include "chrome/browser/ui/views/bubble_border.h"
|
| @@ -26,8 +27,9 @@
|
|
|
| class ExtensionPopup : public BrowserBubble,
|
| public BrowserBubble::Delegate,
|
| + public ExtensionView::Container,
|
| public NotificationObserver,
|
| - public ExtensionView::Container {
|
| + public base::RefCounted<ExtensionPopup> {
|
| public:
|
| // Observer to ExtensionPopup events.
|
| class Observer {
|
| @@ -37,33 +39,12 @@
|
| // making this delegate call.
|
| virtual void ExtensionPopupIsClosing(ExtensionPopup* popup) {}
|
|
|
| - // Called after the ExtensionPopup has been closed and deleted.
|
| - // |popup_token| is the address of the deleted ExtensionPopup.
|
| - virtual void ExtensionPopupClosed(void* popup_token) {}
|
| -
|
| - // Called when the ExtensionHost is first created for the pop-up view.
|
| - // Note that this is invoked BEFORE the ExtensionPopup is created, and can
|
| - // be used to provide extra configuration of the host before it is pushed
|
| - // into the popup. An example use is for automation resource routing in
|
| - // Chrome-Frame. See extension_popup_api.cc.
|
| - virtual void ExtensionHostCreated(ExtensionHost* host) {}
|
| -
|
| - // Called immediately after a popup is created, but before the hosted
|
| - // extension has loaded and before the popup has been displayed. Use to
|
| - // finalize configuration of |popup|.
|
| - virtual void ExtensionPopupCreated(ExtensionPopup* popup) {}
|
| -
|
| // Called when the ExtensionPopup is resized. Note that the popup may have
|
| // an empty bounds, if a popup is repositioned before the hosted content
|
| // has loaded.
|
| virtual void ExtensionPopupResized(ExtensionPopup* popup) {}
|
| };
|
|
|
| - enum PopupChrome {
|
| - BUBBLE_CHROME,
|
| - RECTANGLE_CHROME
|
| - };
|
| -
|
| virtual ~ExtensionPopup();
|
|
|
| // Create and show a popup with |url| positioned adjacent to |relative_to| in
|
| @@ -79,16 +60,8 @@
|
| // by value of |arrow_location| remains fixed during popup resizes.
|
| // If |arrow_location| is BOTTOM_*, then the popup 'pops up', otherwise
|
| // the popup 'drops down'.
|
| - // Pass |activate_on_show| as true to activate the popup window.
|
| // Pass |inspect_with_devtools| as true to pin the popup open and show the
|
| // devtools window for it.
|
| - // The |chrome| argument controls the chrome that surrounds the pop-up.
|
| - // Passing BUBBLE_CHROME will give the pop-up a bubble-like appearance,
|
| - // including the arrow mentioned above. Passing RECTANGLE_CHROME will give
|
| - // the popup a rectangular, black border with a drop-shadow with no arrow.
|
| - // The positioning of the popup is still governed by the arrow-location
|
| - // parameter.
|
| - //
|
| // The actual display of the popup is delayed until the page contents
|
| // finish loading in order to minimize UI flashing and resizing.
|
| static ExtensionPopup* Show(const GURL& url, Browser* browser,
|
| @@ -96,9 +69,7 @@
|
| gfx::NativeWindow frame_window,
|
| const gfx::Rect& relative_to,
|
| BubbleBorder::ArrowLocation arrow_location,
|
| - bool activate_on_show,
|
| bool inspect_with_devtools,
|
| - PopupChrome chrome,
|
| Observer* observer);
|
|
|
| // Assigns the maximal width and height, respectively, to which the popup
|
| @@ -108,8 +79,7 @@
|
| void set_max_width(int width) { max_size_.set_width(width); }
|
| void set_max_height(int height) { max_size_.set_height(height); }
|
|
|
| - // Closes the ExtensionPopup (this will cause the delegate
|
| - // ExtensionPopupIsClosing and ExtensionPopupClosed to fire.
|
| + // Closes the ExtensionPopup.
|
| void Close();
|
|
|
| // Some clients wish to do their own custom focus change management. If this
|
| @@ -155,18 +125,6 @@
|
| virtual void OnExtensionMouseLeave(ExtensionView* view) { }
|
| virtual void OnExtensionPreferredSizeChanged(ExtensionView* view);
|
|
|
| - // Export the refrence-counted interface required for use as template
|
| - // arguments for RefCounted. ExtensionPopup does not inherit from RefCounted
|
| - // because it must override the behaviour of Release.
|
| - void AddRef() { instance_lifetime_->AddRef(); }
|
| - static bool ImplementsThreadSafeReferenceCounting() {
|
| - return InternalRefCounter::ImplementsThreadSafeReferenceCounting();
|
| - }
|
| -
|
| - // Implements the standard RefCounted<T>::Release behaviour, except
|
| - // signals Observer::ExtensionPopupClosed after final release.
|
| - void Release();
|
| -
|
| // The min/max height of popups.
|
| static const int kMinWidth;
|
| static const int kMinHeight;
|
| @@ -178,9 +136,7 @@
|
| views::Widget* frame,
|
| const gfx::Rect& relative_to,
|
| BubbleBorder::ArrowLocation arrow_location,
|
| - bool activate_on_show,
|
| bool inspect_with_devtools,
|
| - PopupChrome chrome,
|
| Observer* observer);
|
|
|
| // The area on the screen that the popup should be positioned relative to.
|
| @@ -189,9 +145,6 @@
|
| // The contained host for the view.
|
| scoped_ptr<ExtensionHost> extension_host_;
|
|
|
| - // Flag used to indicate if the pop-up should be activated upon first display.
|
| - bool activate_on_show_;
|
| -
|
| // Flag used to indicate if the pop-up should open a devtools window once
|
| // it is shown inspecting it.
|
| bool inspect_with_devtools_;
|
| @@ -212,9 +165,6 @@
|
| BubbleBorder* border_;
|
| views::View* border_view_;
|
|
|
| - // The type of chrome associated with the popup window.
|
| - PopupChrome popup_chrome_;
|
| -
|
| // The maximal size to which the popup may expand.
|
| gfx::Size max_size_;
|
|
|
| @@ -226,13 +176,6 @@
|
| // the position of the pop-up in relation to |relative_to_|.
|
| BubbleBorder::ArrowLocation anchor_position_;
|
|
|
| - // ExtensionPopup's lifetime is managed via reference counting, but it does
|
| - // not expose the RefCounted interface. Instead, the lifetime is tied to
|
| - // this member variable.
|
| - class InternalRefCounter : public base::RefCounted<InternalRefCounter> {
|
| - };
|
| - InternalRefCounter* instance_lifetime_;
|
| -
|
| DISALLOW_COPY_AND_ASSIGN(ExtensionPopup);
|
| };
|
|
|
|
|