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
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_api_factory.h"
7 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
8 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.h"
9 #include "chrome/browser/chromeos/file_manager/volume_manager_factory.h"
10 #include "chrome/browser/extensions/extension_system_factory.h"
11 #include "chrome/browser/profiles/incognito_helpers.h"
12 #include "chrome/browser/profiles/profile.h"
13 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
15 namespace file_manager {
18 FileBrowserPrivateAPI*
19 FileBrowserPrivateAPIFactory::GetForProfile(Profile* profile) {
20 return static_cast<FileBrowserPrivateAPI*>(
21 GetInstance()->GetServiceForBrowserContext(profile, true));
25 FileBrowserPrivateAPIFactory*
26 FileBrowserPrivateAPIFactory::GetInstance() {
27 return Singleton<FileBrowserPrivateAPIFactory>::get();
30 FileBrowserPrivateAPIFactory::FileBrowserPrivateAPIFactory()
31 : BrowserContextKeyedServiceFactory(
32 "FileBrowserPrivateAPI",
33 BrowserContextDependencyManager::GetInstance()) {
34 DependsOn(drive::DriveIntegrationServiceFactory::GetInstance());
35 DependsOn(extensions::ExtensionSystemFactory::GetInstance());
36 DependsOn(VolumeManagerFactory::GetInstance());
39 FileBrowserPrivateAPIFactory::~FileBrowserPrivateAPIFactory() {
42 BrowserContextKeyedService*
43 FileBrowserPrivateAPIFactory::BuildServiceInstanceFor(
44 content::BrowserContext* profile) const {
45 return new FileBrowserPrivateAPI(static_cast<Profile*>(profile));
48 content::BrowserContext* FileBrowserPrivateAPIFactory::GetBrowserContextToUse(
49 content::BrowserContext* context) const {
50 // Explicitly and always allow this router in guest login mode.
51 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
54 bool FileBrowserPrivateAPIFactory::ServiceIsCreatedWithBrowserContext() const {
58 bool FileBrowserPrivateAPIFactory::ServiceIsNULLWhileTesting() const {
62 } // namespace file_manager