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

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

Issue 404613006: Declarative content scripts: Renderer-side: per-extension shared memory regions (lazily loaded) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes for last round of comments Created 6 years, 4 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
« no previous file with comments | « extensions/renderer/dispatcher.h ('k') | extensions/renderer/script_injection_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/dispatcher.h" 5 #include "extensions/renderer/dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 }; 175 };
176 176
177 } // namespace 177 } // namespace
178 178
179 Dispatcher::Dispatcher(DispatcherDelegate* delegate) 179 Dispatcher::Dispatcher(DispatcherDelegate* delegate)
180 : delegate_(delegate), 180 : delegate_(delegate),
181 content_watcher_(new ContentWatcher()), 181 content_watcher_(new ContentWatcher()),
182 source_map_(&ResourceBundle::GetSharedInstance()), 182 source_map_(&ResourceBundle::GetSharedInstance()),
183 v8_schema_registry_(new V8SchemaRegistry), 183 v8_schema_registry_(new V8SchemaRegistry),
184 is_webkit_initialized_(false), 184 is_webkit_initialized_(false),
185 user_script_set_observer_(this) { 185 user_script_set_manager_observer_(this) {
186 const CommandLine& command_line = *(CommandLine::ForCurrentProcess()); 186 const CommandLine& command_line = *(CommandLine::ForCurrentProcess());
187 is_extension_process_ = 187 is_extension_process_ =
188 command_line.HasSwitch(extensions::switches::kExtensionProcess) || 188 command_line.HasSwitch(extensions::switches::kExtensionProcess) ||
189 command_line.HasSwitch(::switches::kSingleProcess); 189 command_line.HasSwitch(::switches::kSingleProcess);
190 190
191 if (is_extension_process_) { 191 if (is_extension_process_) {
192 RenderThread::Get()->SetIdleNotificationDelayInMs( 192 RenderThread::Get()->SetIdleNotificationDelayInMs(
193 kInitialExtensionIdleHandlerDelayMs); 193 kInitialExtensionIdleHandlerDelayMs);
194 } 194 }
195 195
196 RenderThread::Get()->RegisterExtension(SafeBuiltins::CreateV8Extension()); 196 RenderThread::Get()->RegisterExtension(SafeBuiltins::CreateV8Extension());
197 197
198 user_script_set_.reset(new UserScriptSet(&extensions_)); 198 user_script_set_manager_.reset(new UserScriptSetManager(&extensions_));
199 script_injection_manager_.reset( 199 script_injection_manager_.reset(
200 new ScriptInjectionManager(&extensions_, user_script_set_.get())); 200 new ScriptInjectionManager(&extensions_, user_script_set_manager_.get()));
201 user_script_set_observer_.Add(user_script_set_.get()); 201 user_script_set_manager_observer_.Add(user_script_set_manager_.get());
202 request_sender_.reset(new RequestSender(this)); 202 request_sender_.reset(new RequestSender(this));
203 PopulateSourceMap(); 203 PopulateSourceMap();
204 } 204 }
205 205
206 Dispatcher::~Dispatcher() { 206 Dispatcher::~Dispatcher() {
207 } 207 }
208 208
209 void Dispatcher::OnRenderViewCreated(content::RenderView* render_view) { 209 void Dispatcher::OnRenderViewCreated(content::RenderView* render_view) {
210 script_injection_manager_->OnRenderViewCreated(render_view); 210 script_injection_manager_->OnRenderViewCreated(render_view);
211 } 211 }
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 } 916 }
917 917
918 void Dispatcher::OnUserScriptsUpdated( 918 void Dispatcher::OnUserScriptsUpdated(
919 const std::set<std::string>& changed_extensions, 919 const std::set<std::string>& changed_extensions,
920 const std::vector<UserScript*>& scripts) { 920 const std::vector<UserScript*>& scripts) {
921 UpdateActiveExtensions(); 921 UpdateActiveExtensions();
922 } 922 }
923 923
924 void Dispatcher::UpdateActiveExtensions() { 924 void Dispatcher::UpdateActiveExtensions() {
925 std::set<std::string> active_extensions = active_extension_ids_; 925 std::set<std::string> active_extensions = active_extension_ids_;
926 user_script_set_->GetActiveExtensionIds(&active_extensions); 926 user_script_set_manager_->GetAllActiveExtensionIds(&active_extensions);
927 delegate_->OnActiveExtensionsUpdated(active_extensions); 927 delegate_->OnActiveExtensionsUpdated(active_extensions);
928 } 928 }
929 929
930 void Dispatcher::InitOriginPermissions(const Extension* extension) { 930 void Dispatcher::InitOriginPermissions(const Extension* extension) {
931 delegate_->InitOriginPermissions(extension, 931 delegate_->InitOriginPermissions(extension,
932 IsExtensionActive(extension->id())); 932 IsExtensionActive(extension->id()));
933 UpdateOriginPermissions( 933 UpdateOriginPermissions(
934 extension, 934 extension,
935 URLPatternSet(), // No old permissions. 935 URLPatternSet(), // No old permissions.
936 extension->permissions_data()->GetEffectiveHostPermissions()); 936 extension->permissions_data()->GetEffectiveHostPermissions());
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 return v8::Handle<v8::Object>(); 1284 return v8::Handle<v8::Object>();
1285 1285
1286 if (bind_name) 1286 if (bind_name)
1287 *bind_name = split.back(); 1287 *bind_name = split.back();
1288 1288
1289 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) 1289 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context))
1290 : bind_object; 1290 : bind_object;
1291 } 1291 }
1292 1292
1293 } // namespace extensions 1293 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/dispatcher.h ('k') | extensions/renderer/script_injection_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698