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

Side by Side Diff: chrome/browser/extensions/extension_event_router.cc

Issue 9950046: Implement FeatureProvider for ExtensionAPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/browser/extensions/extension_event_router.h" 5 #include "chrome/browser/extensions/extension_event_router.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/api/web_request/web_request_api.h" 10 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 // the extension process is unloaded. 307 // the extension process is unloaded.
308 if (!extension) 308 if (!extension)
309 return; 309 return;
310 310
311 Profile* listener_profile = Profile::FromBrowserContext( 311 Profile* listener_profile = Profile::FromBrowserContext(
312 listener.process->GetBrowserContext()); 312 listener.process->GetBrowserContext());
313 extensions::ProcessMap* process_map = 313 extensions::ProcessMap* process_map =
314 listener_profile->GetExtensionService()->process_map(); 314 listener_profile->GetExtensionService()->process_map();
315 // If the event is privileged, only send to extension processes. Otherwise, 315 // If the event is privileged, only send to extension processes. Otherwise,
316 // it's OK to send to normal renderers (e.g., for content scripts). 316 // it's OK to send to normal renderers (e.g., for content scripts).
317 if (ExtensionAPI::GetInstance()->IsPrivileged(event->event_name) && 317 if (ExtensionAPI::GetSharedInstance()->IsPrivileged(event->event_name) &&
318 !process_map->Contains(extension->id(), listener.process->GetID())) { 318 !process_map->Contains(extension->id(), listener.process->GetID())) {
319 return; 319 return;
320 } 320 }
321 321
322 const std::string* event_args; 322 const std::string* event_args;
323 if (!CanDispatchEventToProfile(listener_profile, extension, 323 if (!CanDispatchEventToProfile(listener_profile, extension,
324 event, &event_args)) 324 event, &event_args))
325 return; 325 return;
326 326
327 DispatchEvent(listener.process, listener.extension_id, 327 DispatchEvent(listener.process, listener.extension_id,
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 ExtensionModuleEventRouter::DispatchOnInstalledEvent(profile_, extension); 498 ExtensionModuleEventRouter::DispatchOnInstalledEvent(profile_, extension);
499 break; 499 break;
500 } 500 }
501 501
502 // TODO(tessamac): if background page crashed/failed clear queue. 502 // TODO(tessamac): if background page crashed/failed clear queue.
503 default: 503 default:
504 NOTREACHED(); 504 NOTREACHED();
505 return; 505 return;
506 } 506 }
507 } 507 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698