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: chrome/renderer/extensions/extension_dispatcher.cc

Issue 10514013: Filtered events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, reland Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/renderer/extensions/extension_dispatcher.h" 5 #include "chrome/renderer/extensions/extension_dispatcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 230 }
231 231
232 } 232 }
233 233
234 ExtensionDispatcher::ExtensionDispatcher() 234 ExtensionDispatcher::ExtensionDispatcher()
235 : is_webkit_initialized_(false), 235 : is_webkit_initialized_(false),
236 webrequest_adblock_(false), 236 webrequest_adblock_(false),
237 webrequest_adblock_plus_(false), 237 webrequest_adblock_plus_(false),
238 webrequest_other_(false), 238 webrequest_other_(false),
239 source_map_(&ResourceBundle::GetSharedInstance()), 239 source_map_(&ResourceBundle::GetSharedInstance()),
240 chrome_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) { 240 chrome_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN),
241 event_filter_(new extensions::EventFilter) {
241 const CommandLine& command_line = *(CommandLine::ForCurrentProcess()); 242 const CommandLine& command_line = *(CommandLine::ForCurrentProcess());
242 is_extension_process_ = 243 is_extension_process_ =
243 command_line.HasSwitch(switches::kExtensionProcess) || 244 command_line.HasSwitch(switches::kExtensionProcess) ||
244 command_line.HasSwitch(switches::kSingleProcess); 245 command_line.HasSwitch(switches::kSingleProcess);
245 246
246 if (is_extension_process_) { 247 if (is_extension_process_) {
247 RenderThread::Get()->SetIdleNotificationDelayInMs( 248 RenderThread::Get()->SetIdleNotificationDelayInMs(
248 kInitialExtensionIdleHandlerDelayMs); 249 kInitialExtensionIdleHandlerDelayMs);
249 } 250 }
250 251
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 const std::string& v8_extension_name, 488 const std::string& v8_extension_name,
488 int extension_group, 489 int extension_group,
489 int world_id) { 490 int world_id) {
490 g_hack_extension_group = extension_group; 491 g_hack_extension_group = extension_group;
491 return true; 492 return true;
492 } 493 }
493 494
494 void ExtensionDispatcher::RegisterNativeHandlers(ModuleSystem* module_system, 495 void ExtensionDispatcher::RegisterNativeHandlers(ModuleSystem* module_system,
495 ChromeV8Context* context) { 496 ChromeV8Context* context) {
496 module_system->RegisterNativeHandler("event_bindings", 497 module_system->RegisterNativeHandler("event_bindings",
497 scoped_ptr<NativeHandler>(EventBindings::Get(this))); 498 scoped_ptr<NativeHandler>(EventBindings::Get(this, event_filter_.get())));
498 module_system->RegisterNativeHandler("miscellaneous_bindings", 499 module_system->RegisterNativeHandler("miscellaneous_bindings",
499 scoped_ptr<NativeHandler>(MiscellaneousBindings::Get(this))); 500 scoped_ptr<NativeHandler>(MiscellaneousBindings::Get(this)));
500 module_system->RegisterNativeHandler("apiDefinitions", 501 module_system->RegisterNativeHandler("apiDefinitions",
501 scoped_ptr<NativeHandler>(new ApiDefinitionsNatives(this))); 502 scoped_ptr<NativeHandler>(new ApiDefinitionsNatives(this)));
502 module_system->RegisterNativeHandler("sendRequest", 503 module_system->RegisterNativeHandler("sendRequest",
503 scoped_ptr<NativeHandler>( 504 scoped_ptr<NativeHandler>(
504 new SendRequestNatives(this, request_sender_.get()))); 505 new SendRequestNatives(this, request_sender_.get())));
505 module_system->RegisterNativeHandler("setIcon", 506 module_system->RegisterNativeHandler("setIcon",
506 scoped_ptr<NativeHandler>( 507 scoped_ptr<NativeHandler>(
507 new SetIconNatives(this, request_sender_.get()))); 508 new SetIconNatives(this, request_sender_.get())));
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 // APIs, they don't get extension bindings injected. If we end up here it 1032 // APIs, they don't get extension bindings injected. If we end up here it
1032 // means that a sandboxed page somehow managed to invoke an API anyway, so 1033 // means that a sandboxed page somehow managed to invoke an API anyway, so
1033 // we should abort. 1034 // we should abort.
1034 WebKit::WebFrame* frame = context->web_frame(); 1035 WebKit::WebFrame* frame = context->web_frame();
1035 ExtensionURLInfo url_info(frame->document().securityOrigin(), 1036 ExtensionURLInfo url_info(frame->document().securityOrigin(),
1036 UserScriptSlave::GetDataSourceURLForFrame(frame)); 1037 UserScriptSlave::GetDataSourceURLForFrame(frame));
1037 CHECK(!extensions_.IsSandboxedPage(url_info)); 1038 CHECK(!extensions_.IsSandboxedPage(url_info));
1038 1039
1039 return true; 1040 return true;
1040 } 1041 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_dispatcher.h ('k') | chrome/renderer/resources/extensions/event.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698