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

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

Issue 822453002: Introduce HostID and de-couple Extensions from "script injection System" [browser side] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change ConsumerID to class; remove usages of linked_ptr, and nits. Created 5 years, 11 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 void UserScriptSet::RemoveObserver(Observer* observer) { 47 void UserScriptSet::RemoveObserver(Observer* observer) {
48 observers_.RemoveObserver(observer); 48 observers_.RemoveObserver(observer);
49 } 49 }
50 50
51 void UserScriptSet::GetActiveExtensionIds( 51 void UserScriptSet::GetActiveExtensionIds(
52 std::set<std::string>* ids) const { 52 std::set<std::string>* ids) const {
53 for (ScopedVector<UserScript>::const_iterator iter = scripts_.begin(); 53 for (ScopedVector<UserScript>::const_iterator iter = scripts_.begin();
54 iter != scripts_.end(); 54 iter != scripts_.end();
55 ++iter) { 55 ++iter) {
56 DCHECK(!(*iter)->extension_id().empty()); 56 DCHECK(!(*iter)->GetExtensionID().empty());
57 ids->insert((*iter)->extension_id()); 57 ids->insert((*iter)->GetExtensionID());
58 } 58 }
59 } 59 }
60 60
61 void UserScriptSet::GetInjections( 61 void UserScriptSet::GetInjections(
62 ScopedVector<ScriptInjection>* injections, 62 ScopedVector<ScriptInjection>* injections,
63 blink::WebFrame* web_frame, 63 blink::WebFrame* web_frame,
64 int tab_id, 64 int tab_id,
65 UserScript::RunLocation run_location) { 65 UserScript::RunLocation run_location) {
66 GURL document_url = GetDocumentUrlForFrame(web_frame); 66 GURL document_url = GetDocumentUrlForFrame(web_frame);
67 for (ScopedVector<UserScript>::const_iterator iter = scripts_.begin(); 67 for (ScopedVector<UserScript>::const_iterator iter = scripts_.begin();
68 iter != scripts_.end(); 68 iter != scripts_.end();
69 ++iter) { 69 ++iter) {
70 const Extension* extension = extensions_->GetByID((*iter)->extension_id()); 70 const Extension* extension =
71 extensions_->GetByID((*iter)->GetExtensionID());
71 if (!extension) 72 if (!extension)
72 continue; 73 continue;
73 scoped_ptr<ScriptInjection> injection = GetInjectionForScript( 74 scoped_ptr<ScriptInjection> injection = GetInjectionForScript(
74 *iter, 75 *iter,
75 web_frame, 76 web_frame,
76 tab_id, 77 tab_id,
77 run_location, 78 run_location,
78 document_url, 79 document_url,
79 extension, 80 extension,
80 false /* is_declarative */); 81 false /* is_declarative */);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 injector.Pass(), 213 injector.Pass(),
213 web_frame->toWebLocalFrame(), 214 web_frame->toWebLocalFrame(),
214 extension->id(), 215 extension->id(),
215 run_location, 216 run_location,
216 tab_id)); 217 tab_id));
217 } 218 }
218 return injection.Pass(); 219 return injection.Pass();
219 } 220 }
220 221
221 } // namespace extensions 222 } // namespace extensions
OLDNEW
« extensions/common/user_script.cc ('K') | « extensions/renderer/user_script_injector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698