OLD | NEW |
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/chromeos/extensions/file_manager/file_manager_private_a
pi_factory.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/event_router_factory.h
" |
6 | 6 |
7 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 7 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
8 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_private_a
pi.h" | 8 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" |
9 #include "chrome/browser/chromeos/file_manager/volume_manager_factory.h" | 9 #include "chrome/browser/chromeos/file_manager/volume_manager_factory.h" |
10 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 12 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
13 #include "extensions/browser/extension_system_provider.h" | 13 #include "extensions/browser/extension_system_provider.h" |
14 #include "extensions/browser/extensions_browser_client.h" | 14 #include "extensions/browser/extensions_browser_client.h" |
15 | 15 |
16 namespace file_manager { | 16 namespace file_manager { |
17 | 17 |
18 // static | 18 // static |
19 FileManagerPrivateAPI* | 19 EventRouter* EventRouterFactory::GetForProfile(Profile* profile) { |
20 FileManagerPrivateAPIFactory::GetForProfile(Profile* profile) { | 20 return static_cast<EventRouter*>( |
21 return static_cast<FileManagerPrivateAPI*>( | |
22 GetInstance()->GetServiceForBrowserContext(profile, true)); | 21 GetInstance()->GetServiceForBrowserContext(profile, true)); |
23 } | 22 } |
24 | 23 |
25 // static | 24 // static |
26 FileManagerPrivateAPIFactory* | 25 EventRouterFactory* EventRouterFactory::GetInstance() { |
27 FileManagerPrivateAPIFactory::GetInstance() { | 26 return Singleton<EventRouterFactory>::get(); |
28 return Singleton<FileManagerPrivateAPIFactory>::get(); | |
29 } | 27 } |
30 | 28 |
31 FileManagerPrivateAPIFactory::FileManagerPrivateAPIFactory() | 29 EventRouterFactory::EventRouterFactory() |
32 : BrowserContextKeyedServiceFactory( | 30 : BrowserContextKeyedServiceFactory( |
33 "FileManagerPrivateAPI", | 31 "EventRouter", |
34 BrowserContextDependencyManager::GetInstance()) { | 32 BrowserContextDependencyManager::GetInstance()) { |
35 DependsOn(drive::DriveIntegrationServiceFactory::GetInstance()); | 33 DependsOn(drive::DriveIntegrationServiceFactory::GetInstance()); |
36 DependsOn( | 34 DependsOn( |
37 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 35 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
38 DependsOn(VolumeManagerFactory::GetInstance()); | 36 DependsOn(VolumeManagerFactory::GetInstance()); |
39 } | 37 } |
40 | 38 |
41 FileManagerPrivateAPIFactory::~FileManagerPrivateAPIFactory() { | 39 EventRouterFactory::~EventRouterFactory() { |
42 } | 40 } |
43 | 41 |
44 KeyedService* FileManagerPrivateAPIFactory::BuildServiceInstanceFor( | 42 KeyedService* EventRouterFactory::BuildServiceInstanceFor( |
45 content::BrowserContext* context) const { | 43 content::BrowserContext* context) const { |
46 return new FileManagerPrivateAPI(Profile::FromBrowserContext(context)); | 44 return new EventRouter(Profile::FromBrowserContext(context)); |
47 } | 45 } |
48 | 46 |
49 content::BrowserContext* FileManagerPrivateAPIFactory::GetBrowserContextToUse( | 47 content::BrowserContext* EventRouterFactory::GetBrowserContextToUse( |
50 content::BrowserContext* context) const { | 48 content::BrowserContext* context) const { |
51 // Explicitly and always allow this router in guest login mode. | 49 // Explicitly and always allow this router in guest login mode. |
52 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 50 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
53 } | 51 } |
54 | 52 |
55 bool FileManagerPrivateAPIFactory::ServiceIsCreatedWithBrowserContext() const { | 53 bool EventRouterFactory::ServiceIsCreatedWithBrowserContext() const { |
56 return true; | 54 return true; |
57 } | 55 } |
58 | 56 |
59 bool FileManagerPrivateAPIFactory::ServiceIsNULLWhileTesting() const { | 57 bool EventRouterFactory::ServiceIsNULLWhileTesting() const { |
60 return true; | 58 return true; |
61 } | 59 } |
62 | 60 |
63 } // namespace file_manager | 61 } // namespace file_manager |
OLD | NEW |