Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / browser / chromeos / file_manager / volume_manager_factory.cc
blob6428f0fe4f298622dc08a1323b417f5f10d38059
1 // Copyright 2013 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/file_manager/volume_manager_factory.h"
7 #include "base/basictypes.h"
8 #include "base/memory/singleton.h"
9 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
10 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
11 #include "chrome/browser/chromeos/file_system_provider/service_factory.h"
12 #include "chrome/browser/profiles/incognito_helpers.h"
13 #include "chrome/browser/profiles/profile.h"
14 #include "chromeos/dbus/dbus_thread_manager.h"
15 #include "chromeos/disks/disk_mount_manager.h"
16 #include "components/keyed_service/content/browser_context_dependency_manager.h"
18 namespace file_manager {
20 VolumeManager* VolumeManagerFactory::Get(content::BrowserContext* context) {
21 return static_cast<VolumeManager*>(
22 GetInstance()->GetServiceForBrowserContext(context, true));
25 VolumeManagerFactory* VolumeManagerFactory::GetInstance() {
26 return Singleton<VolumeManagerFactory>::get();
29 content::BrowserContext* VolumeManagerFactory::GetBrowserContextToUse(
30 content::BrowserContext* context) const {
31 // Explicitly allow this manager in guest login mode.
32 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
35 bool VolumeManagerFactory::ServiceIsCreatedWithBrowserContext() const {
36 return true;
39 bool VolumeManagerFactory::ServiceIsNULLWhileTesting() const {
40 return true;
43 KeyedService* VolumeManagerFactory::BuildServiceInstanceFor(
44 content::BrowserContext* profile) const {
45 VolumeManager* instance = new VolumeManager(
46 Profile::FromBrowserContext(profile),
47 drive::DriveIntegrationServiceFactory::GetForProfileRegardlessOfStates(
48 Profile::FromBrowserContext(profile)),
49 chromeos::DBusThreadManager::Get()->GetPowerManagerClient(),
50 chromeos::disks::DiskMountManager::GetInstance(),
51 chromeos::file_system_provider::ServiceFactory::Get(
52 Profile::FromBrowserContext(profile)));
53 instance->Initialize();
54 return instance;
57 VolumeManagerFactory::VolumeManagerFactory()
58 : BrowserContextKeyedServiceFactory(
59 "VolumeManagerFactory",
60 BrowserContextDependencyManager::GetInstance()) {
61 DependsOn(drive::DriveIntegrationServiceFactory::GetInstance());
62 DependsOn(chromeos::file_system_provider::ServiceFactory::GetInstance());
65 VolumeManagerFactory::~VolumeManagerFactory() {
68 } // namespace file_manager