| 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/user_script_injector.h" | 5 #include "extensions/renderer/user_script_injector.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // Declarative user scripts use "page access" (from "permissions" section in | 137 // Declarative user scripts use "page access" (from "permissions" section in |
| 138 // manifest) whereas non-declarative user scripts use custom | 138 // manifest) whereas non-declarative user scripts use custom |
| 139 // "content script access" logic. | 139 // "content script access" logic. |
| 140 if (is_declarative_) { | 140 if (is_declarative_) { |
| 141 return extension->permissions_data()->GetPageAccess( | 141 return extension->permissions_data()->GetPageAccess( |
| 142 extension, | 142 extension, |
| 143 effective_document_url, | 143 effective_document_url, |
| 144 top_url, | 144 top_url, |
| 145 tab_id, | 145 tab_id, |
| 146 -1, // no process id | 146 -1, // no process id |
| 147 NULL /* ignore error */); | 147 nullptr /* ignore error */); |
| 148 } else { | 148 } else { |
| 149 return extension->permissions_data()->GetContentScriptAccess( | 149 return extension->permissions_data()->GetContentScriptAccess( |
| 150 extension, | 150 extension, |
| 151 effective_document_url, | 151 effective_document_url, |
| 152 top_url, | 152 top_url, |
| 153 tab_id, | 153 tab_id, |
| 154 -1, // no process id | 154 -1, // no process id |
| 155 NULL /* ignore error */); | 155 nullptr /* ignore error */); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 std::vector<blink::WebScriptSource> UserScriptInjector::GetJsSources( | 159 std::vector<blink::WebScriptSource> UserScriptInjector::GetJsSources( |
| 160 UserScript::RunLocation run_location) const { | 160 UserScript::RunLocation run_location) const { |
| 161 DCHECK_EQ(script_->run_location(), run_location); | 161 DCHECK_EQ(script_->run_location(), run_location); |
| 162 | 162 |
| 163 std::vector<blink::WebScriptSource> sources; | 163 std::vector<blink::WebScriptSource> sources; |
| 164 const UserScript::FileList& js_scripts = script_->js_scripts(); | 164 const UserScript::FileList& js_scripts = script_->js_scripts(); |
| 165 bool is_standalone_or_emulate_greasemonkey = | 165 bool is_standalone_or_emulate_greasemonkey = |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 220 } |
| 221 | 221 |
| 222 if (ShouldInjectCss(run_location)) | 222 if (ShouldInjectCss(run_location)) |
| 223 scripts_run_info->num_css += script_->css_scripts().size(); | 223 scripts_run_info->num_css += script_->css_scripts().size(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void UserScriptInjector::OnWillNotInject(InjectFailureReason reason) { | 226 void UserScriptInjector::OnWillNotInject(InjectFailureReason reason) { |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace extensions | 229 } // namespace extensions |
| OLD | NEW |