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

Side by Side Diff: chrome/browser/guest_view/extension_options/extension_options_guest.cc

Issue 471053003: Allow links inside <extensionoptions> to be opened in new tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/guest_view/extension_options/extension_options_guest.h" 5 #include "chrome/browser/guest_view/extension_options/extension_options_guest.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
9 #include "chrome/browser/extensions/extension_tab_util.h"
9 #include "chrome/browser/guest_view/extension_options/extension_options_constant s.h" 10 #include "chrome/browser/guest_view/extension_options/extension_options_constant s.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_finder.h"
14 #include "chrome/browser/ui/browser_window.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
11 #include "chrome/common/extensions/api/extension_options_internal.h" 16 #include "chrome/common/extensions/api/extension_options_internal.h"
12 #include "chrome/common/extensions/manifest_url_handler.h" 17 #include "chrome/common/extensions/manifest_url_handler.h"
13 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
14 #include "content/public/browser/site_instance.h" 19 #include "content/public/browser/site_instance.h"
15 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
16 #include "extensions/browser/extension_function_dispatcher.h" 21 #include "extensions/browser/extension_function_dispatcher.h"
17 #include "extensions/browser/extension_registry.h" 22 #include "extensions/browser/extension_registry.h"
23 #include "extensions/browser/guest_view/guest_view_manager.h"
18 #include "extensions/common/extension.h" 24 #include "extensions/common/extension.h"
19 #include "extensions/common/extension_messages.h" 25 #include "extensions/common/extension_messages.h"
20 #include "extensions/common/feature_switch.h" 26 #include "extensions/common/feature_switch.h"
21 #include "extensions/common/permissions/permissions_data.h" 27 #include "extensions/common/permissions/permissions_data.h"
22 #include "ipc/ipc_message_macros.h" 28 #include "ipc/ipc_message_macros.h"
23 29
24 using content::WebContents; 30 using content::WebContents;
25 using namespace extensions::api; 31 using namespace extensions::api;
26 32
27 // static 33 // static
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 int min_width = 0; 176 int min_width = 0;
171 extra_params()->GetInteger(extensionoptions::kAttributeMinHeight, 177 extra_params()->GetInteger(extensionoptions::kAttributeMinHeight,
172 &min_height); 178 &min_height);
173 extra_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); 179 extra_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width);
174 180
175 // Call SetAutoSize to apply all the appropriate validation and clipping of 181 // Call SetAutoSize to apply all the appropriate validation and clipping of
176 // values. 182 // values.
177 SetAutoSize( 183 SetAutoSize(
178 true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height)); 184 true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height));
179 } 185 }
186
187 content::WebContents* ExtensionOptionsGuest::CreateNewGuestWindow(
188 const content::WebContents::CreateParams& create_params) {
189 extensions::GuestViewManager* guest_manager =
190 extensions::GuestViewManager::FromBrowserContext(browser_context());
191 return guest_manager->CreateGuestWithWebContentsParams(
192 ExtensionOptionsGuest::Type,
193 embedder_extension_id(),
194 embedder_web_contents()->GetRenderProcessHost()->GetID(),
195 create_params);
196 }
197
198 void ExtensionOptionsGuest::WebContentsCreated(
199 content::WebContents* source_contents,
200 int opener_render_frame_id,
201 const base::string16& frame_name,
202 const GURL& target_url,
203 WebContents* new_contents) {
204 Browser* browser =
205 chrome::FindBrowserWithWebContents(embedder_web_contents());
206 content::OpenURLParams params(target_url,
207 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
208 NEW_FOREGROUND_TAB,
209 content::PAGE_TRANSITION_LINK,
210 false);
211 browser->OpenURL(params);
212 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
213 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698