OLD | NEW |
---|---|
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 | 85 |
86 if (injection_host->id().type() != HostID::EXTENSIONS) | |
87 return PermissionsData::ACCESS_DENIED; | |
Fady Samuel
2015/02/19 19:52:54
I'm confused by this, doesn't this disable execute
Xi Han
2015/02/19 19:56:04
Yes, this disable executeScript for WebUI, but not
| |
88 | |
86 return injection_host->CanExecuteOnFrame( | 89 return injection_host->CanExecuteOnFrame( |
87 effective_document_url, top_url, tab_id, true /* is_declarative */); | 90 effective_document_url, top_url, tab_id, true /* is_declarative */); |
88 } | 91 } |
89 | 92 |
90 std::vector<blink::WebScriptSource> ProgrammaticScriptInjector::GetJsSources( | 93 std::vector<blink::WebScriptSource> ProgrammaticScriptInjector::GetJsSources( |
91 UserScript::RunLocation run_location) const { | 94 UserScript::RunLocation run_location) const { |
92 DCHECK_EQ(GetRunLocation(), run_location); | 95 DCHECK_EQ(GetRunLocation(), run_location); |
93 DCHECK(params_->is_javascript); | 96 DCHECK(params_->is_javascript); |
94 | 97 |
95 return std::vector<blink::WebScriptSource>( | 98 return std::vector<blink::WebScriptSource>( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 | 141 |
139 render_view_->Send(new ExtensionHostMsg_ExecuteCodeFinished( | 142 render_view_->Send(new ExtensionHostMsg_ExecuteCodeFinished( |
140 render_view_->GetRoutingID(), | 143 render_view_->GetRoutingID(), |
141 params_->request_id, | 144 params_->request_id, |
142 error, | 145 error, |
143 url_, | 146 url_, |
144 *results_)); | 147 *results_)); |
145 } | 148 } |
146 | 149 |
147 } // namespace extensions | 150 } // namespace extensions |
OLD | NEW |