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

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: hate hate hate 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_function_dispatcher.cc » ('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 (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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 // the extension process is unloaded. 310 // the extension process is unloaded.
311 if (!extension) 311 if (!extension)
312 return; 312 return;
313 313
314 Profile* listener_profile = Profile::FromBrowserContext( 314 Profile* listener_profile = Profile::FromBrowserContext(
315 listener.process->GetBrowserContext()); 315 listener.process->GetBrowserContext());
316 extensions::ProcessMap* process_map = 316 extensions::ProcessMap* process_map =
317 listener_profile->GetExtensionService()->process_map(); 317 listener_profile->GetExtensionService()->process_map();
318 // If the event is privileged, only send to extension processes. Otherwise, 318 // If the event is privileged, only send to extension processes. Otherwise,
319 // it's OK to send to normal renderers (e.g., for content scripts). 319 // it's OK to send to normal renderers (e.g., for content scripts).
320 if (ExtensionAPI::GetInstance()->IsPrivileged(event->event_name) && 320 if (ExtensionAPI::GetSharedInstance()->IsPrivileged(event->event_name) &&
321 !process_map->Contains(extension->id(), listener.process->GetID())) { 321 !process_map->Contains(extension->id(), listener.process->GetID())) {
322 return; 322 return;
323 } 323 }
324 324
325 const std::string* event_args; 325 const std::string* event_args;
326 if (!CanDispatchEventToProfile(listener_profile, extension, 326 if (!CanDispatchEventToProfile(listener_profile, extension,
327 event, &event_args)) 327 event, &event_args))
328 return; 328 return;
329 329
330 DispatchEvent(listener.process, listener.extension_id, 330 DispatchEvent(listener.process, listener.extension_id,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 ExtensionModuleEventRouter::DispatchOnInstalledEvent(profile_, extension); 495 ExtensionModuleEventRouter::DispatchOnInstalledEvent(profile_, extension);
496 break; 496 break;
497 } 497 }
498 498
499 // TODO(tessamac): if background page crashed/failed clear queue. 499 // TODO(tessamac): if background page crashed/failed clear queue.
500 default: 500 default:
501 NOTREACHED(); 501 NOTREACHED();
502 return; 502 return;
503 } 503 }
504 } 504 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_function_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698