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

Side by Side Diff: extensions/renderer/programmatic_script_injector.cc

Issue 942533003: Enable <webview>.executeScript outside of Apps and Extensions [1] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_brower_isolated_world_routingid_user_script_UserScriptSet_non_hostset_2
Patch Set: Add a test. Created 5 years, 9 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 "extensions/renderer/programmatic_script_injector.h" 5 #include "extensions/renderer/programmatic_script_injector.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "content/public/renderer/render_view.h" 10 #include "content/public/renderer/render_view.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 if (params_->is_web_view) { 75 if (params_->is_web_view) {
76 if (frame->parent()) { 76 if (frame->parent()) {
77 // This is a subframe inside <webview>, so allow it. 77 // This is a subframe inside <webview>, so allow it.
78 return PermissionsData::ACCESS_ALLOWED; 78 return PermissionsData::ACCESS_ALLOWED;
79 } 79 }
80 80
81 return effective_document_url == params_->webview_src 81 return effective_document_url == params_->webview_src
82 ? PermissionsData::ACCESS_ALLOWED 82 ? PermissionsData::ACCESS_ALLOWED
83 : PermissionsData::ACCESS_DENIED; 83 : PermissionsData::ACCESS_DENIED;
84 } 84 }
85 DCHECK(injection_host->id().type() == HostID::EXTENSIONS);
Devlin 2015/03/09 16:04:42 use DCHECK_EQ
Xi Han 2015/03/09 17:59:56 Done.
85 86
86 return injection_host->CanExecuteOnFrame( 87 return injection_host->CanExecuteOnFrame(
87 effective_document_url, top_url, tab_id, true /* is_declarative */); 88 effective_document_url, top_url, tab_id, true /* is_declarative */);
88 } 89 }
89 90
90 std::vector<blink::WebScriptSource> ProgrammaticScriptInjector::GetJsSources( 91 std::vector<blink::WebScriptSource> ProgrammaticScriptInjector::GetJsSources(
91 UserScript::RunLocation run_location) const { 92 UserScript::RunLocation run_location) const {
92 DCHECK_EQ(GetRunLocation(), run_location); 93 DCHECK_EQ(GetRunLocation(), run_location);
93 DCHECK(params_->is_javascript); 94 DCHECK(params_->is_javascript);
94 95
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 143
143 render_view_->Send(new ExtensionHostMsg_ExecuteCodeFinished( 144 render_view_->Send(new ExtensionHostMsg_ExecuteCodeFinished(
144 render_view_->GetRoutingID(), 145 render_view_->GetRoutingID(),
145 params_->request_id, 146 params_->request_id,
146 error, 147 error,
147 url_, 148 url_,
148 *results_)); 149 *results_));
149 } 150 }
150 151
151 } // namespace extensions 152 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698