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

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

Issue 9369013: Take extensions out of Profile into a profile-keyed service, ExtensionSystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no crashy Created 8 years, 10 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/extension_devtools_manager.h" 10 #include "chrome/browser/extensions/extension_devtools_manager.h"
11 #include "chrome/browser/extensions/extension_host.h" 11 #include "chrome/browser/extensions/extension_host.h"
12 #include "chrome/browser/extensions/extension_process_manager.h" 12 #include "chrome/browser/extensions/extension_process_manager.h"
13 #include "chrome/browser/extensions/extension_processes_api.h" 13 #include "chrome/browser/extensions/extension_processes_api.h"
14 #include "chrome/browser/extensions/extension_processes_api_constants.h" 14 #include "chrome/browser/extensions/extension_processes_api_constants.h"
15 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/extensions/extension_system.h"
17 #include "chrome/browser/extensions/extension_system_factory.h"
16 #include "chrome/browser/extensions/extension_tabs_module.h" 18 #include "chrome/browser/extensions/extension_tabs_module.h"
17 #include "chrome/browser/extensions/api/webrequest/webrequest_api.h" 19 #include "chrome/browser/extensions/api/webrequest/webrequest_api.h"
18 #include "chrome/browser/extensions/process_map.h" 20 #include "chrome/browser/extensions/process_map.h"
19 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/common/chrome_notification_types.h" 22 #include "chrome/common/chrome_notification_types.h"
21 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/chrome_view_type.h" 24 #include "chrome/common/chrome_view_type.h"
23 #include "chrome/common/extensions/extension.h" 25 #include "chrome/common/extensions/extension.h"
24 #include "chrome/common/extensions/extension_messages.h" 26 #include "chrome/common/extensions/extension_messages.h"
25 #include "chrome/common/extensions/api/extension_api.h" 27 #include "chrome/common/extensions/api/extension_api.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 const GURL& event_url) { 90 const GURL& event_url) {
89 ListValue args; 91 ListValue args;
90 args.Set(0, Value::CreateStringValue(event_name)); 92 args.Set(0, Value::CreateStringValue(event_name));
91 args.Set(1, Value::CreateStringValue(event_args)); 93 args.Set(1, Value::CreateStringValue(event_args));
92 ipc_sender->Send(new ExtensionMsg_MessageInvoke(MSG_ROUTING_CONTROL, 94 ipc_sender->Send(new ExtensionMsg_MessageInvoke(MSG_ROUTING_CONTROL,
93 extension_id, kDispatchEvent, args, event_url)); 95 extension_id, kDispatchEvent, args, event_url));
94 } 96 }
95 97
96 ExtensionEventRouter::ExtensionEventRouter(Profile* profile) 98 ExtensionEventRouter::ExtensionEventRouter(Profile* profile)
97 : profile_(profile), 99 : profile_(profile),
98 extension_devtools_manager_(profile->GetExtensionDevToolsManager()) { 100 extension_devtools_manager_(
101 ExtensionSystemFactory::GetForProfile(profile)->devtools_manager()) {
99 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, 102 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
100 content::NotificationService::AllSources()); 103 content::NotificationService::AllSources());
101 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 104 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
102 content::NotificationService::AllSources()); 105 content::NotificationService::AllSources());
103 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, 106 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
104 content::Source<Profile>(profile_)); 107 content::Source<Profile>(profile_));
105 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 108 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
106 content::Source<Profile>(profile_)); 109 content::Source<Profile>(profile_));
107 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 110 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
108 content::Source<Profile>(profile_)); 111 content::Source<Profile>(profile_));
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 extension->id(), kOnInstalledEvent, "[]", NULL, GURL()); 493 extension->id(), kOnInstalledEvent, "[]", NULL, GURL());
491 break; 494 break;
492 } 495 }
493 496
494 // TODO(tessamac): if background page crashed/failed clear queue. 497 // TODO(tessamac): if background page crashed/failed clear queue.
495 default: 498 default:
496 NOTREACHED(); 499 NOTREACHED();
497 return; 500 return;
498 } 501 }
499 } 502 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698