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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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 |
OLD | NEW |