Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: extensions/renderer/script_injection.cc

Issue 906493004: Refactoring: de-couple Extensions from "script injection System" [render side]:2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_brower_isolated_world_1
Patch Set: Devlin's comments and rebase. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698