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

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

Issue 885493007: Refactoring: de-couple Extensions from "script injection System" [render side] : 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Devlin@'s comments. Created 5 years, 10 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/user_script_set.h" 5 #include "extensions/renderer/user_script_set.h"
6 6
7 #include "content/public/common/url_constants.h" 7 #include "content/public/common/url_constants.h"
8 #include "content/public/renderer/render_thread.h" 8 #include "content/public/renderer/render_thread.h"
9 #include "extensions/common/extension.h" 9 #include "extensions/common/extension.h"
10 #include "extensions/common/extension_set.h" 10 #include "extensions/common/extension_set.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 bool inject_css = !script->css_scripts().empty() && 206 bool inject_css = !script->css_scripts().empty() &&
207 run_location == UserScript::DOCUMENT_START; 207 run_location == UserScript::DOCUMENT_START;
208 bool inject_js = 208 bool inject_js =
209 !script->js_scripts().empty() && script->run_location() == run_location; 209 !script->js_scripts().empty() && script->run_location() == run_location;
210 if (inject_css || inject_js) { 210 if (inject_css || inject_js) {
211 injection.reset(new ScriptInjection( 211 injection.reset(new ScriptInjection(
212 injector.Pass(), 212 injector.Pass(),
213 web_frame->toWebLocalFrame(), 213 web_frame->toWebLocalFrame(),
214 extension->id(), 214 HostID(HostID::EXTENSIONS, extension->id()),
215 // TODO(hanxi): store and obtain the instance id from the UserScript.
216 Host::kDefaultInstanceId,
215 run_location, 217 run_location,
216 tab_id)); 218 tab_id));
217 } 219 }
218 return injection.Pass(); 220 return injection.Pass();
219 } 221 }
220 222
221 } // namespace extensions 223 } // namespace extensions
OLDNEW
« extensions/renderer/script_injection.cc ('K') | « extensions/renderer/script_injection_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698