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

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

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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/extensions/extension_popup.cc
===================================================================
--- chrome/browser/views/extensions/extension_popup.cc (revision 34039)
+++ chrome/browser/views/extensions/extension_popup.cc (working copy)
@@ -5,6 +5,7 @@
#include "chrome/browser/views/extensions/extension_popup.h"
#include "chrome/browser/browser.h"
+#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/extensions/extension_process_manager.h"
@@ -27,7 +28,7 @@
const int ExtensionPopup::kMaxHeight = 600;
ExtensionPopup::ExtensionPopup(ExtensionHost* host,
- Widget* frame,
+ views::Widget* frame,
const gfx::Rect& relative_to,
BubbleBorder::ArrowLocation arrow_location,
bool activate_on_show)
@@ -79,7 +80,8 @@
return;
#if defined(OS_WIN)
- frame_->GetWindow()->DisableInactiveRendering();
+ if (frame_->GetWindow())
+ frame_->GetWindow()->DisableInactiveRendering();
#endif
ResizeToView();
@@ -142,20 +144,32 @@
// static
ExtensionPopup* ExtensionPopup::Show(
- const GURL& url, Browser* browser,
+ const GURL& url,
+ Browser* browser,
+ Profile* profile,
+ gfx::NativeWindow frame_window,
const gfx::Rect& relative_to,
BubbleBorder::ArrowLocation arrow_location,
bool activate_on_show) {
- ExtensionProcessManager* manager =
- browser->profile()->GetExtensionProcessManager();
+ DCHECK(profile);
+ DCHECK(frame_window);
+ ExtensionProcessManager* manager = profile->GetExtensionProcessManager();
DCHECK(manager);
if (!manager)
return NULL;
+ // If no Browser instance was given, attempt to look up one matching the given
+ // profile.
+ if (!browser)
+ browser = BrowserList::FindBrowserWithProfile(profile);
+
+ Widget* frame_widget = Widget::GetWidgetFromNativeWindow(frame_window);
+ DCHECK(frame_widget);
+ if (!frame_widget)
+ return NULL;
+
ExtensionHost* host = manager->CreatePopup(url, browser);
- views::Widget* frame = BrowserView::GetBrowserViewForNativeWindow(
- browser->window()->GetNativeHandle())->GetWidget();
- ExtensionPopup* popup = new ExtensionPopup(host, frame, relative_to,
+ ExtensionPopup* popup = new ExtensionPopup(host, frame_widget, relative_to,
arrow_location, activate_on_show);
// If the host had somehow finished loading, then we'd miss the notification

Powered by Google App Engine
This is Rietveld 408576698