| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 bool UserScriptInjector::ShouldInjectCss( | 146 bool UserScriptInjector::ShouldInjectCss( |
| 147 UserScript::RunLocation run_location) const { | 147 UserScript::RunLocation run_location) const { |
| 148 return run_location == UserScript::DOCUMENT_START && | 148 return run_location == UserScript::DOCUMENT_START && |
| 149 !script_->css_scripts().empty(); | 149 !script_->css_scripts().empty(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 PermissionsData::AccessType UserScriptInjector::CanExecuteOnFrame( | 152 PermissionsData::AccessType UserScriptInjector::CanExecuteOnFrame( |
| 153 const InjectionHost* injection_host, | 153 const InjectionHost* injection_host, |
| 154 blink::WebFrame* web_frame, | 154 blink::WebFrame* web_frame, |
| 155 int tab_id, | 155 int tab_id) const { |
| 156 const GURL& top_url) const { | |
| 157 GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL( | 156 GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL( |
| 158 web_frame, web_frame->document().url(), script_->match_about_blank()); | 157 web_frame, web_frame->document().url(), script_->match_about_blank()); |
| 159 PermissionsData::AccessType can_execute = injection_host->CanExecuteOnFrame( | 158 PermissionsData::AccessType can_execute = injection_host->CanExecuteOnFrame( |
| 160 effective_document_url, top_url, tab_id, is_declarative_); | 159 effective_document_url, web_frame, tab_id, is_declarative_); |
| 161 if (script_->consumer_instance_type() != | 160 if (script_->consumer_instance_type() != |
| 162 UserScript::ConsumerInstanceType::WEBVIEW || | 161 UserScript::ConsumerInstanceType::WEBVIEW || |
| 163 can_execute == PermissionsData::ACCESS_DENIED) | 162 can_execute == PermissionsData::ACCESS_DENIED) |
| 164 return can_execute; | 163 return can_execute; |
| 165 | 164 |
| 166 int routing_id = content::RenderView::FromWebView(web_frame->top()->view()) | 165 int routing_id = content::RenderView::FromWebView(web_frame->top()->view()) |
| 167 ->GetRoutingID(); | 166 ->GetRoutingID(); |
| 168 | 167 |
| 169 RoutingInfoKey key(routing_id, script_->id()); | 168 RoutingInfoKey key(routing_id, script_->id()); |
| 170 | 169 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 256 |
| 258 void UserScriptInjector::OnInjectionComplete( | 257 void UserScriptInjector::OnInjectionComplete( |
| 259 scoped_ptr<base::Value> execution_result, | 258 scoped_ptr<base::Value> execution_result, |
| 260 UserScript::RunLocation run_location) { | 259 UserScript::RunLocation run_location) { |
| 261 } | 260 } |
| 262 | 261 |
| 263 void UserScriptInjector::OnWillNotInject(InjectFailureReason reason) { | 262 void UserScriptInjector::OnWillNotInject(InjectFailureReason reason) { |
| 264 } | 263 } |
| 265 | 264 |
| 266 } // namespace extensions | 265 } // namespace extensions |
| OLD | NEW |