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

Side by Side Diff: chrome/browser/chromeos/file_manager/volume_manager.h

Issue 246293011: Mount MTP devices in Chrome OS Files.app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + fix test (handle null StorageMonitor in some tests) Created 6 years, 8 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 2013 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/files/file.h" 13 #include "base/files/file.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "base/prefs/pref_change_registrar.h" 18 #include "base/prefs/pref_change_registrar.h"
19 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 19 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
20 #include "chrome/browser/chromeos/file_system_provider/observer.h" 20 #include "chrome/browser/chromeos/file_system_provider/observer.h"
21 #include "chrome/browser/chromeos/file_system_provider/service.h" 21 #include "chrome/browser/chromeos/file_system_provider/service.h"
22 #include "chrome/browser/local_discovery/storage/privet_volume_lister.h" 22 #include "chrome/browser/local_discovery/storage/privet_volume_lister.h"
23 #include "chromeos/dbus/cros_disks_client.h" 23 #include "chromeos/dbus/cros_disks_client.h"
24 #include "chromeos/disks/disk_mount_manager.h" 24 #include "chromeos/disks/disk_mount_manager.h"
25 #include "components/keyed_service/core/keyed_service.h" 25 #include "components/keyed_service/core/keyed_service.h"
26 #include "components/storage_monitor/removable_storage_observer.h"
26 27
27 class Profile; 28 class Profile;
28 29
29 namespace chromeos { 30 namespace chromeos {
30 class PowerManagerClient; 31 class PowerManagerClient;
31 } // namespace chromeos 32 } // namespace chromeos
32 33
33 namespace content { 34 namespace content {
34 class BrowserContext; 35 class BrowserContext;
35 } // namespace content 36 } // namespace content
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 101
101 // Manages "Volume"s for file manager. Here are "Volume"s. 102 // Manages "Volume"s for file manager. Here are "Volume"s.
102 // - Drive File System (not yet supported). 103 // - Drive File System (not yet supported).
103 // - Downloads directory. 104 // - Downloads directory.
104 // - Removable disks (volume will be created for each partition, not only one 105 // - Removable disks (volume will be created for each partition, not only one
105 // for a device). 106 // for a device).
106 // - Mounted zip archives. 107 // - Mounted zip archives.
107 class VolumeManager : public KeyedService, 108 class VolumeManager : public KeyedService,
108 public drive::DriveIntegrationServiceObserver, 109 public drive::DriveIntegrationServiceObserver,
109 public chromeos::disks::DiskMountManager::Observer, 110 public chromeos::disks::DiskMountManager::Observer,
110 public chromeos::file_system_provider::Observer { 111 public chromeos::file_system_provider::Observer,
112 public storage_monitor::RemovableStorageObserver {
111 public: 113 public:
112 VolumeManager( 114 VolumeManager(
113 Profile* profile, 115 Profile* profile,
114 drive::DriveIntegrationService* drive_integration_service, 116 drive::DriveIntegrationService* drive_integration_service,
115 chromeos::PowerManagerClient* power_manager_client, 117 chromeos::PowerManagerClient* power_manager_client,
116 chromeos::disks::DiskMountManager* disk_mount_manager, 118 chromeos::disks::DiskMountManager* disk_mount_manager,
117 chromeos::file_system_provider::Service* file_system_provider_service); 119 chromeos::file_system_provider::Service* file_system_provider_service);
118 virtual ~VolumeManager(); 120 virtual ~VolumeManager();
119 121
120 // Returns the instance corresponding to the |context|. 122 // Returns the instance corresponding to the |context|.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 file_system_info, 179 file_system_info,
178 base::File::Error error) OVERRIDE; 180 base::File::Error error) OVERRIDE;
179 virtual void OnProvidedFileSystemUnmount( 181 virtual void OnProvidedFileSystemUnmount(
180 const chromeos::file_system_provider::ProvidedFileSystemInfo& 182 const chromeos::file_system_provider::ProvidedFileSystemInfo&
181 file_system_info, 183 file_system_info,
182 base::File::Error error) OVERRIDE; 184 base::File::Error error) OVERRIDE;
183 185
184 // Called on change to kExternalStorageDisabled pref. 186 // Called on change to kExternalStorageDisabled pref.
185 void OnExternalStorageDisabledChanged(); 187 void OnExternalStorageDisabledChanged();
186 188
189 // RemovableStorageObserver overrides.
190 virtual void OnRemovableStorageAttached(
191 const storage_monitor::StorageInfo& info) OVERRIDE;
192 virtual void OnRemovableStorageDetached(
193 const storage_monitor::StorageInfo& info) OVERRIDE;
194
187 private: 195 private:
196 void OnStorageMonitorInitialized();
188 void OnPrivetVolumesAvailable( 197 void OnPrivetVolumesAvailable(
189 const local_discovery::PrivetVolumeLister::VolumeList& volumes); 198 const local_discovery::PrivetVolumeLister::VolumeList& volumes);
190 void DoMountEvent(chromeos::MountError error_code, 199 void DoMountEvent(chromeos::MountError error_code,
191 const VolumeInfo& volume_info, 200 const VolumeInfo& volume_info,
192 bool is_remounting); 201 bool is_remounting);
193 void DoUnmountEvent(chromeos::MountError error_code, 202 void DoUnmountEvent(chromeos::MountError error_code,
194 const VolumeInfo& volume_info); 203 const VolumeInfo& volume_info);
195 204
196 Profile* profile_; 205 Profile* profile_;
197 drive::DriveIntegrationService* drive_integration_service_; // Not owned. 206 drive::DriveIntegrationService* drive_integration_service_; // Not owned.
198 chromeos::disks::DiskMountManager* disk_mount_manager_; // Not owned. 207 chromeos::disks::DiskMountManager* disk_mount_manager_; // Not owned.
199 scoped_ptr<MountedDiskMonitor> mounted_disk_monitor_; 208 scoped_ptr<MountedDiskMonitor> mounted_disk_monitor_;
200 PrefChangeRegistrar pref_change_registrar_; 209 PrefChangeRegistrar pref_change_registrar_;
201 ObserverList<VolumeManagerObserver> observers_; 210 ObserverList<VolumeManagerObserver> observers_;
202 scoped_ptr<local_discovery::PrivetVolumeLister> privet_volume_lister_; 211 scoped_ptr<local_discovery::PrivetVolumeLister> privet_volume_lister_;
203 chromeos::file_system_provider::Service* 212 chromeos::file_system_provider::Service*
204 file_system_provider_service_; // Not owned by this class. 213 file_system_provider_service_; // Not owned by this class.
205 std::map<std::string, VolumeInfo> mounted_volumes_; 214 std::map<std::string, VolumeInfo> mounted_volumes_;
206 215
207 // Note: This should remain the last member so it'll be destroyed and 216 // Note: This should remain the last member so it'll be destroyed and
208 // invalidate its weak pointers before any other members are destroyed. 217 // invalidate its weak pointers before any other members are destroyed.
209 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; 218 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_;
210 DISALLOW_COPY_AND_ASSIGN(VolumeManager); 219 DISALLOW_COPY_AND_ASSIGN(VolumeManager);
211 }; 220 };
212 221
213 } // namespace file_manager 222 } // namespace file_manager
214 223
215 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ 224 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/chromeos/file_manager/volume_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698