Index: extensions/browser/api/web_view/web_view_internal_api.cc |
diff --git a/extensions/browser/api/web_view/web_view_internal_api.cc b/extensions/browser/api/web_view/web_view_internal_api.cc |
index 4b041e911764efabd574034f0e175b015ffebd65..40478fc75f900bb614c57eb436141fbd70b1efe0 100644 |
--- a/extensions/browser/api/web_view/web_view_internal_api.cc |
+++ b/extensions/browser/api/web_view/web_view_internal_api.cc |
@@ -102,7 +102,23 @@ bool WebViewInternalExecuteCodeFunction::Init() { |
return false; |
details_ = details.Pass(); |
- return true; |
+ |
+ if (extension()) { |
+ set_host_id(make_scoped_ptr(new HostID(HostID::EXTENSIONS, |
+ extension()->id()))); |
+ return true; |
+ } |
+ |
+ auto rvh = render_view_host(); |
Devlin
2015/02/25 17:22:36
Why use auto here? It subtracts, rather than adds
Xi Han
2015/02/26 15:13:45
Updated.
|
+ if (rvh) { |
+ WebContents* web_contents = WebContents::FromRenderViewHost(rvh); |
+ if (web_contents && web_contents->GetWebUI()) { |
+ const GURL& url = rvh->GetSiteInstance()->GetSiteURL(); |
+ set_host_id(make_scoped_ptr(new HostID(HostID::WEBUI, url.spec()))); |
+ return true; |
+ } |
+ } |
+ return false; |
} |
bool WebViewInternalExecuteCodeFunction::ShouldInsertCSS() const { |