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

Side by Side Diff: extensions/browser/event_router.cc

Issue 139943005: Convert extensions::ProcessMap to BrowserContextKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase process_map Created 6 years, 11 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 | « chrome/browser/ui/browser.cc ('k') | extensions/browser/process_map.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 (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 "extensions/browser/event_router.h" 5 #include "extensions/browser/event_router.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 const Extension* extension = 516 const Extension* extension =
517 ExtensionRegistry::Get(browser_context_)->enabled_extensions().GetByID( 517 ExtensionRegistry::Get(browser_context_)->enabled_extensions().GetByID(
518 extension_id); 518 extension_id);
519 519
520 // The extension could have been removed, but we do not unregister it until 520 // The extension could have been removed, but we do not unregister it until
521 // the extension process is unloaded. 521 // the extension process is unloaded.
522 if (!extension) 522 if (!extension)
523 return; 523 return;
524 524
525 BrowserContext* listener_context = process->GetBrowserContext(); 525 BrowserContext* listener_context = process->GetBrowserContext();
526 ProcessMap* process_map = 526 ProcessMap* process_map = ProcessMap::Get(listener_context);
527 ExtensionSystem::GetForBrowserContext(listener_context)
528 ->extension_service()
529 ->process_map();
530 // If the event is privileged, only send to extension processes. Otherwise, 527 // If the event is privileged, only send to extension processes. Otherwise,
531 // it's OK to send to normal renderers (e.g., for content scripts). 528 // it's OK to send to normal renderers (e.g., for content scripts).
532 if (ExtensionAPI::GetSharedInstance()->IsPrivileged(event->event_name) && 529 if (ExtensionAPI::GetSharedInstance()->IsPrivileged(event->event_name) &&
533 !process_map->Contains(extension->id(), process->GetID())) { 530 !process_map->Contains(extension->id(), process->GetID())) {
534 return; 531 return;
535 } 532 }
536 533
537 // If the event is restricted to a URL, only dispatch if the extension has 534 // If the event is restricted to a URL, only dispatch if the extension has
538 // permission for it (or if the event originated from itself). 535 // permission for it (or if the event originated from itself).
539 if (!event->event_url.is_empty() && 536 if (!event->event_url.is_empty() &&
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 EventDispatchInfo::EventDispatchInfo(const std::string& extension_id, 784 EventDispatchInfo::EventDispatchInfo(const std::string& extension_id,
788 const std::string& event_name, 785 const std::string& event_name,
789 scoped_ptr<ListValue> event_args) 786 scoped_ptr<ListValue> event_args)
790 : extension_id(extension_id), 787 : extension_id(extension_id),
791 event_name(event_name), 788 event_name(event_name),
792 event_args(event_args.Pass()) {} 789 event_args(event_args.Pass()) {}
793 790
794 EventDispatchInfo::~EventDispatchInfo() {} 791 EventDispatchInfo::~EventDispatchInfo() {}
795 792
796 } // namespace extensions 793 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | extensions/browser/process_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698