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

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: Latest master 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..6df648a2eb57e76a3928f3772214dfbb05f7c843 100644
--- a/chrome/browser/ui/views/extensions/extension_popup.cc
+++ b/chrome/browser/ui/views/extensions/extension_popup.cc
@@ -8,7 +8,6 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/extensions/extension_view_host.h"
-#include "chrome/browser/extensions/extension_view_host_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "content/public/browser/devtools_agent_host.h"
@@ -67,9 +66,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 +75,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 +178,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() {
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_popup.h ('k') | chrome/browser/ui/views/toolbar/browser_actions_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698