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

Unified Diff: chrome/browser/ui/ime/ime_window.cc

Issue 1756853002: Correctly sets the security origin for the IME window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed tests. Created 4 years, 10 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
« no previous file with comments | « chrome/browser/ui/ime/ime_window.h ('k') | chrome/browser/ui/input_method/input_method_engine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ime/ime_window.cc
diff --git a/chrome/browser/ui/ime/ime_window.cc b/chrome/browser/ui/ime/ime_window.cc
index a8d1a75107c2c3e412fe51ccc6006f5cf9979d57..8ffead74605fa842b7c07c28bab65394cd39443d 100644
--- a/chrome/browser/ui/ime/ime_window.cc
+++ b/chrome/browser/ui/ime/ime_window.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/ui/ime/ime_window_observer.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
@@ -28,6 +29,7 @@ namespace ui {
ImeWindow::ImeWindow(Profile* profile,
const extensions::Extension* extension,
+ content::RenderFrameHost* opener_render_frame_host,
const std::string& url,
Mode mode,
const gfx::Rect& bounds)
@@ -46,9 +48,19 @@ ImeWindow::ImeWindow(Profile* profile,
if (!gurl.is_valid())
gurl = extension->GetResourceURL(url);
- content::SiteInstance* instance =
- content::SiteInstance::CreateForURL(profile, gurl);
- content::WebContents::CreateParams create_params(profile, instance);
+ content::SiteInstance* site_instance = opener_render_frame_host
+ ? opener_render_frame_host->GetSiteInstance() : nullptr;
+ if (!site_instance ||
+ site_instance->GetSiteURL().GetOrigin() != gurl.GetOrigin()) {
+ site_instance = content::SiteInstance::CreateForURL(profile, gurl);
+ }
+ content::WebContents::CreateParams create_params(profile, site_instance);
+ if (opener_render_frame_host) {
+ create_params.opener_render_process_id =
+ opener_render_frame_host->GetProcess()->GetID();
+ create_params.opener_render_frame_id =
+ opener_render_frame_host->GetRoutingID();
+ }
web_contents_.reset(content::WebContents::Create(create_params));
web_contents_->SetDelegate(this);
content::OpenURLParams params(gurl, content::Referrer(), SINGLETON_TAB,
« no previous file with comments | « chrome/browser/ui/ime/ime_window.h ('k') | chrome/browser/ui/input_method/input_method_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698