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

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

Issue 2424593002: Reduce FOR_EACH_OBSERVER usage in extensions (Closed)
Patch Set: script_observers_ Created 4 years, 2 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 RendererExtensionRegistry::Get()->GetByID(script->extension_id()); 149 RendererExtensionRegistry::Get()->GetByID(script->extension_id());
150 if (whitelisted_only && 150 if (whitelisted_only &&
151 (!extension || 151 (!extension ||
152 !PermissionsData::CanExecuteScriptEverywhere(extension))) { 152 !PermissionsData::CanExecuteScriptEverywhere(extension))) {
153 continue; 153 continue;
154 } 154 }
155 155
156 scripts_.push_back(std::move(script)); 156 scripts_.push_back(std::move(script));
157 } 157 }
158 158
159 FOR_EACH_OBSERVER(Observer, observers_, 159 for (auto& observer : observers_)
160 OnUserScriptsUpdated(changed_hosts, scripts_)); 160 observer.OnUserScriptsUpdated(changed_hosts, scripts_);
161 return true; 161 return true;
162 } 162 }
163 163
164 std::unique_ptr<ScriptInjection> UserScriptSet::GetDeclarativeScriptInjection( 164 std::unique_ptr<ScriptInjection> UserScriptSet::GetDeclarativeScriptInjection(
165 int script_id, 165 int script_id,
166 content::RenderFrame* render_frame, 166 content::RenderFrame* render_frame,
167 int tab_id, 167 int tab_id,
168 UserScript::RunLocation run_location, 168 UserScript::RunLocation run_location,
169 const GURL& document_url, 169 const GURL& document_url,
170 bool log_activity) { 170 bool log_activity) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 base::StringPiece script_content = file.GetContent(); 269 base::StringPiece script_content = file.GetContent();
270 return script_sources_ 270 return script_sources_
271 .insert(std::make_pair( 271 .insert(std::make_pair(
272 url, blink::WebString::fromUTF8(script_content.data(), 272 url, blink::WebString::fromUTF8(script_content.data(),
273 script_content.length()))) 273 script_content.length())))
274 .first->second; 274 .first->second;
275 } 275 }
276 276
277 } // namespace extensions 277 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/components/native_app_window/native_app_window_views.cc ('k') | extensions/renderer/user_script_set_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698