Index: chrome/browser/guest_view/extension_options/extension_options_guest.cc |
diff --git a/chrome/browser/guest_view/extension_options/extension_options_guest.cc b/chrome/browser/guest_view/extension_options/extension_options_guest.cc |
index f7ca2908f72de01663b09ff9edfdecbc4ea2d6c1..34ea3e3ef1a37d1fc9133941bdbdf7db01d0fca2 100644 |
--- a/chrome/browser/guest_view/extension_options/extension_options_guest.cc |
+++ b/chrome/browser/guest_view/extension_options/extension_options_guest.cc |
@@ -6,8 +6,13 @@ |
#include "base/values.h" |
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
+#include "chrome/browser/extensions/extension_tab_util.h" |
#include "chrome/browser/guest_view/extension_options/extension_options_constants.h" |
#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/browser_finder.h" |
+#include "chrome/browser/ui/browser_window.h" |
+#include "chrome/browser/ui/tabs/tab_strip_model.h" |
#include "chrome/common/extensions/api/extension_options_internal.h" |
#include "chrome/common/extensions/manifest_url_handler.h" |
#include "content/public/browser/render_process_host.h" |
@@ -15,6 +20,7 @@ |
#include "content/public/browser/web_contents.h" |
#include "extensions/browser/extension_function_dispatcher.h" |
#include "extensions/browser/extension_registry.h" |
+#include "extensions/browser/guest_view/guest_view_manager.h" |
#include "extensions/common/extension.h" |
#include "extensions/common/extension_messages.h" |
#include "extensions/common/feature_switch.h" |
@@ -177,3 +183,31 @@ void ExtensionOptionsGuest::SetUpAutoSize() { |
SetAutoSize( |
true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height)); |
} |
+ |
+content::WebContents* ExtensionOptionsGuest::CreateNewGuestWindow( |
+ const content::WebContents::CreateParams& create_params) { |
+ extensions::GuestViewManager* guest_manager = |
+ extensions::GuestViewManager::FromBrowserContext(browser_context()); |
+ return guest_manager->CreateGuestWithWebContentsParams( |
+ ExtensionOptionsGuest::Type, |
+ embedder_extension_id(), |
+ embedder_web_contents()->GetRenderProcessHost()->GetID(), |
+ create_params); |
+} |
+ |
+void ExtensionOptionsGuest::WebContentsCreated( |
+ content::WebContents* source_contents, |
+ int opener_render_frame_id, |
+ const base::string16& frame_name, |
+ const GURL& target_url, |
+ WebContents* new_contents) { |
+ Browser* browser = |
+ chrome::FindBrowserWithWebContents(embedder_web_contents()); |
+ content::OpenURLParams params(target_url, |
+ content::Referrer(), |
not at google - send to devlin
2014/08/14 23:14:37
I'm not sure if there should be a Referrer here. T
ericzeng
2014/08/15 20:08:22
Are you saying that I should be finding what the r
not at google - send to devlin
2014/08/15 20:14:32
I would have thought that in a tab the referrer wo
|
+ NEW_FOREGROUND_TAB, |
+ content::PAGE_TRANSITION_LINK, |
+ false); |
+ browser->OpenURL(params); |
+ browser->window()->Show(); |
not at google - send to devlin
2014/08/14 23:14:37
Ideally we'd respect choices like "open in new tab
ericzeng
2014/08/15 20:08:22
The link context menu has all of the normal option
not at google - send to devlin
2014/08/15 20:14:32
SGTM.
Fady Samuel
2014/08/15 20:22:05
Take a look at the link below for more information
|
+} |