| 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/script_injection.h" | 5 #include "extensions/renderer/script_injection.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 // static | 103 // static |
| 104 void ScriptInjection::RemoveIsolatedWorld(const std::string& host_id) { | 104 void ScriptInjection::RemoveIsolatedWorld(const std::string& host_id) { |
| 105 g_isolated_worlds.Get().erase(host_id); | 105 g_isolated_worlds.Get().erase(host_id); |
| 106 } | 106 } |
| 107 | 107 |
| 108 ScriptInjection::ScriptInjection( | 108 ScriptInjection::ScriptInjection( |
| 109 scoped_ptr<ScriptInjector> injector, | 109 scoped_ptr<ScriptInjector> injector, |
| 110 blink::WebLocalFrame* web_frame, | 110 blink::WebLocalFrame* web_frame, |
| 111 const HostID& host_id, | 111 const HostID& host_id, |
| 112 UserScript::ConsumerInstanceType consumer_instance_type, |
| 112 UserScript::RunLocation run_location, | 113 UserScript::RunLocation run_location, |
| 113 int tab_id) | 114 int tab_id) |
| 114 : injector_(injector.Pass()), | 115 : injector_(injector.Pass()), |
| 115 web_frame_(web_frame), | 116 web_frame_(web_frame), |
| 116 host_id_(host_id), | 117 host_id_(host_id), |
| 118 consumer_instance_type_(consumer_instance_type), |
| 117 run_location_(run_location), | 119 run_location_(run_location), |
| 118 tab_id_(tab_id), | 120 tab_id_(tab_id), |
| 119 request_id_(kInvalidRequestId), | 121 request_id_(kInvalidRequestId), |
| 120 complete_(false) { | 122 complete_(false) { |
| 121 } | 123 } |
| 122 | 124 |
| 123 ScriptInjection::~ScriptInjection() { | 125 ScriptInjection::~ScriptInjection() { |
| 124 if (!complete_) | 126 if (!complete_) |
| 125 injector_->OnWillNotInject(ScriptInjector::WONT_INJECT); | 127 injector_->OnWillNotInject(ScriptInjector::WONT_INJECT); |
| 126 } | 128 } |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 std::vector<std::string> css_sources = | 310 std::vector<std::string> css_sources = |
| 309 injector_->GetCssSources(run_location_); | 311 injector_->GetCssSources(run_location_); |
| 310 for (std::vector<std::string>::const_iterator iter = css_sources.begin(); | 312 for (std::vector<std::string>::const_iterator iter = css_sources.begin(); |
| 311 iter != css_sources.end(); | 313 iter != css_sources.end(); |
| 312 ++iter) { | 314 ++iter) { |
| 313 frame->document().insertStyleSheet(blink::WebString::fromUTF8(*iter)); | 315 frame->document().insertStyleSheet(blink::WebString::fromUTF8(*iter)); |
| 314 } | 316 } |
| 315 } | 317 } |
| 316 | 318 |
| 317 } // namespace extensions | 319 } // namespace extensions |
| OLD | NEW |