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

Unified Diff: chrome/browser/ui/views/extensions/extension_popup.cc

Issue 1105713002: [Extension Toolbar] Slide out overflowed actions for popups (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/extensions/extension_popup.cc
diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc
index 1467f24de70ee9fd4999d46cd5dfa44f68e4eb1d..ded044a2cf99f7523759d72ec81b7ee14db5e20e 100644
--- a/chrome/browser/ui/views/extensions/extension_popup.cc
+++ b/chrome/browser/ui/views/extensions/extension_popup.cc
@@ -67,9 +67,6 @@ ExtensionPopup::ExtensionPopup(extensions::ExtensionViewHost* host,
// ExtensionPopup closes itself on very specific de-activation conditions.
set_close_on_deactivate(false);
- // Wait to show the popup until the contained host finishes loading.
- registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
- content::Source<content::WebContents>(host->host_contents()));
// Listen for the containing view calling window.close();
registrar_.Add(
@@ -79,6 +76,18 @@ ExtensionPopup::ExtensionPopup(extensions::ExtensionViewHost* host,
content::DevToolsAgentHost::AddAgentStateCallback(devtools_callback_);
GetExtensionView(host)->GetBrowser()->tab_strip_model()->AddObserver(this);
+
+ // If the host had somehow finished loading, then we'd miss the notification
+ // and not show. This seems to happen in single-process mode.
+ if (host_->has_loaded_once()) {
+ ShowBubble();
+ } else {
+ // Wait to show the popup until the contained host finishes loading.
+ registrar_.Add(this,
+ content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
+ content::Source<content::WebContents>(
+ host_->host_contents()));
+ }
}
ExtensionPopup::~ExtensionPopup() {
@@ -170,21 +179,13 @@ void ExtensionPopup::OnAnchorWindowActivation() {
}
// static
-ExtensionPopup* ExtensionPopup::ShowPopup(const GURL& url,
- Browser* browser,
- views::View* anchor_view,
- views::BubbleBorder::Arrow arrow,
- ShowAction show_action) {
- extensions::ExtensionViewHost* host =
- extensions::ExtensionViewHostFactory::CreatePopupHost(url, browser);
- auto popup = ExtensionPopup::Create(host, anchor_view, arrow, show_action);
-
- // If the host had somehow finished loading, then we'd miss the notification
- // and not show. This seems to happen in single-process mode.
- if (host->has_loaded_once())
- popup->ShowBubble();
-
- return popup;
+ExtensionPopup* ExtensionPopup::ShowPopup(
+ scoped_ptr<extensions::ExtensionViewHost> host,
+ views::View* anchor_view,
+ views::BubbleBorder::Arrow arrow,
+ ShowAction show_action) {
+ return ExtensionPopup::Create(
+ host.release(), anchor_view, arrow, show_action);
}
void ExtensionPopup::ShowBubble() {

Powered by Google App Engine
This is Rietveld 408576698