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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest_manager.cc

Issue 23530029: Support webview tag when the container extension is embedded in a webUI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unnecessary lines from document_custom_bindings Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/browser_plugin/browser_plugin_guest_manager.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/browser_plugin/browser_plugin_guest.h" 8 #include "content/browser/browser_plugin/browser_plugin_guest.h"
9 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" 9 #include "content/browser/browser_plugin/browser_plugin_host_factory.h"
10 #include "content/browser/renderer_host/render_view_host_impl.h" 10 #include "content/browser/renderer_host/render_view_host_impl.h"
11 #include "content/browser/web_contents/web_contents_impl.h" 11 #include "content/browser/web_contents/web_contents_impl.h"
12 #include "content/common/browser_plugin/browser_plugin_constants.h" 12 #include "content/common/browser_plugin/browser_plugin_constants.h"
13 #include "content/common/browser_plugin/browser_plugin_messages.h" 13 #include "content/common/browser_plugin/browser_plugin_messages.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/public/browser/user_metrics.h" 15 #include "content/public/browser/user_metrics.h"
16 #include "content/public/common/content_switches.h" 16 #include "content/public/common/content_switches.h"
17 #include "content/public/common/result_codes.h" 17 #include "content/public/common/result_codes.h"
18 #include "content/public/common/url_constants.h" 18 #include "content/public/common/url_constants.h"
19 #include "content/public/common/url_utils.h"
19 #include "net/base/escape.h" 20 #include "net/base/escape.h"
20 #include "ui/base/keycodes/keyboard_codes.h" 21 #include "ui/base/keycodes/keyboard_codes.h"
21 22
22 namespace content { 23 namespace content {
23 24
24 // static 25 // static
25 BrowserPluginHostFactory* BrowserPluginGuestManager::factory_ = NULL; 26 BrowserPluginHostFactory* BrowserPluginGuestManager::factory_ = NULL;
26 27
27 BrowserPluginGuestManager::BrowserPluginGuestManager() 28 BrowserPluginGuestManager::BrowserPluginGuestManager()
28 : next_instance_id_(browser_plugin::kInstanceIDNone) { 29 : next_instance_id_(browser_plugin::kInstanceIDNone) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // iframes instead. We use the src URL sent by the renderer to find the 64 // iframes instead. We use the src URL sent by the renderer to find the
64 // right process in which to place this instance. 65 // right process in which to place this instance.
65 // Note: Since BrowserPlugin doesn't support cross-process navigation, 66 // Note: Since BrowserPlugin doesn't support cross-process navigation,
66 // the instance will stay in the initially assigned process, regardless 67 // the instance will stay in the initially assigned process, regardless
67 // of the site it is navigated to. 68 // of the site it is navigated to.
68 // TODO(nasko): Fix this, and such that cross-process navigations are 69 // TODO(nasko): Fix this, and such that cross-process navigations are
69 // supported. 70 // supported.
70 guest_site_instance = 71 guest_site_instance =
71 embedder_site_instance->GetRelatedSiteInstance(GURL(params.src)); 72 embedder_site_instance->GetRelatedSiteInstance(GURL(params.src));
72 } else { 73 } else {
73 const std::string& host = embedder_site_instance->GetSiteURL().host(); 74 // Only trust |embedder_frame_url| reported by a WebUI renderer.
75 const GURL& embedder_site_url = embedder_site_instance->GetSiteURL();
76 const std::string& host = content::HasWebUIScheme(embedder_site_url) ?
77 GURL(params.embedder_frame_url).host() : embedder_site_url.host();
74 78
75 std::string url_encoded_partition = net::EscapeQueryParamValue( 79 std::string url_encoded_partition = net::EscapeQueryParamValue(
76 params.storage_partition_id, false); 80 params.storage_partition_id, false);
77 // The SiteInstance of a given webview tag is based on the fact that it's 81 // The SiteInstance of a given webview tag is based on the fact that it's
78 // a guest process in addition to which platform application the tag 82 // a guest process in addition to which platform application the tag
79 // belongs to and what storage partition is in use, rather than the URL 83 // belongs to and what storage partition is in use, rather than the URL
80 // that the tag is being navigated to. 84 // that the tag is being navigated to.
81 GURL guest_site( 85 GURL guest_site(
82 base::StringPrintf("%s://%s/%s?%s", chrome::kGuestScheme, 86 base::StringPrintf("%s://%s/%s?%s", chrome::kGuestScheme,
83 host.c_str(), 87 host.c_str(),
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 BrowserPluginGuest* guest = it->second->GetBrowserPluginGuest(); 269 BrowserPluginGuest* guest = it->second->GetBrowserPluginGuest();
266 if (embedder_web_contents == guest->embedder_web_contents()) { 270 if (embedder_web_contents == guest->embedder_web_contents()) {
267 if (guest->UnlockMouseIfNecessary(event)) 271 if (guest->UnlockMouseIfNecessary(event))
268 return true; 272 return true;
269 } 273 }
270 } 274 }
271 return false; 275 return false;
272 } 276 }
273 277
274 } // namespace content 278 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698