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

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

Issue 2580303002: mediaview: Mount ARC documents provider file system volumes. (Closed)
Patch Set: Add a getter of ArcFileSystemService to ArcServiceManager so that VolumeManager can subscribe to AF… Created 3 years, 11 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
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 <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/files/file.h" 14 #include "base/files/file.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/linked_ptr.h" 17 #include "base/memory/linked_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/observer_list.h" 19 #include "base/observer_list.h"
20 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 20 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
21 #include "chrome/browser/chromeos/file_system_provider/observer.h" 21 #include "chrome/browser/chromeos/file_system_provider/observer.h"
22 #include "chrome/browser/chromeos/file_system_provider/service.h" 22 #include "chrome/browser/chromeos/file_system_provider/service.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/arc/arc_service_manager.h"
26 #include "components/arc/file_system/arc_file_system_observer.h"
25 #include "components/keyed_service/core/keyed_service.h" 27 #include "components/keyed_service/core/keyed_service.h"
26 #include "components/prefs/pref_change_registrar.h" 28 #include "components/prefs/pref_change_registrar.h"
27 #include "components/storage_monitor/removable_storage_observer.h" 29 #include "components/storage_monitor/removable_storage_observer.h"
28 #include "device/media_transfer_protocol/mtp_storage_info.pb.h" 30 #include "device/media_transfer_protocol/mtp_storage_info.pb.h"
29 31
30 class Profile; 32 class Profile;
31 33
32 namespace chromeos { 34 namespace chromeos {
33 class PowerManagerClient; 35 class PowerManagerClient;
34 } // namespace chromeos 36 } // namespace chromeos
35 37
36 namespace content { 38 namespace content {
37 class BrowserContext; 39 class BrowserContext;
38 } // namespace content 40 } // namespace content
39 41
40 namespace file_manager { 42 namespace file_manager {
41 43
42 class SnapshotManager; 44 class SnapshotManager;
43 class VolumeManagerObserver; 45 class VolumeManagerObserver;
44 46
45 // Identifiers for volume types managed by Chrome OS file manager. 47 // Identifiers for volume types managed by Chrome OS file manager.
46 enum VolumeType { 48 enum VolumeType {
47 VOLUME_TYPE_TESTING = -1, // Used only in tests. 49 VOLUME_TYPE_TESTING = -1, // Used only in tests.
48 VOLUME_TYPE_GOOGLE_DRIVE = 0, 50 VOLUME_TYPE_GOOGLE_DRIVE = 0,
49 VOLUME_TYPE_DOWNLOADS_DIRECTORY, 51 VOLUME_TYPE_DOWNLOADS_DIRECTORY,
50 VOLUME_TYPE_REMOVABLE_DISK_PARTITION, 52 VOLUME_TYPE_REMOVABLE_DISK_PARTITION,
51 VOLUME_TYPE_MOUNTED_ARCHIVE_FILE, 53 VOLUME_TYPE_MOUNTED_ARCHIVE_FILE,
52 VOLUME_TYPE_PROVIDED, // File system provided by the FileSystemProvider API. 54 VOLUME_TYPE_PROVIDED, // File system provided by the FileSystemProvider API.
53 VOLUME_TYPE_MTP, 55 VOLUME_TYPE_MTP,
56 VOLUME_TYPE_MEDIA_VIEW,
54 // The enum values must be kept in sync with FileManagerVolumeType in 57 // The enum values must be kept in sync with FileManagerVolumeType in
55 // tools/metrics/histograms/histograms.xml. Since enums for histograms are 58 // tools/metrics/histograms/histograms.xml. Since enums for histograms are
56 // append-only (for keeping the number consistent across versions), new values 59 // append-only (for keeping the number consistent across versions), new values
57 // for this enum also has to be always appended at the end (i.e., here). 60 // for this enum also has to be always appended at the end (i.e., here).
58 NUM_VOLUME_TYPE, 61 NUM_VOLUME_TYPE,
59 }; 62 };
60 63
61 // Says how was the mount performed, whether due to user interaction, or 64 // Says how was the mount performed, whether due to user interaction, or
62 // automatic. User interaction includes both hardware (pluggins a USB stick) 65 // automatic. User interaction includes both hardware (pluggins a USB stick)
63 // or software (mounting a ZIP archive) interaction. 66 // or software (mounting a ZIP archive) interaction.
(...skipping 19 matching lines...) Expand all
83 static Volume* CreateForRemovable( 86 static Volume* CreateForRemovable(
84 const chromeos::disks::DiskMountManager::MountPointInfo& mount_point, 87 const chromeos::disks::DiskMountManager::MountPointInfo& mount_point,
85 const chromeos::disks::DiskMountManager::Disk* disk); 88 const chromeos::disks::DiskMountManager::Disk* disk);
86 static Volume* CreateForProvidedFileSystem( 89 static Volume* CreateForProvidedFileSystem(
87 const chromeos::file_system_provider::ProvidedFileSystemInfo& 90 const chromeos::file_system_provider::ProvidedFileSystemInfo&
88 file_system_info, 91 file_system_info,
89 MountContext mount_context); 92 MountContext mount_context);
90 static Volume* CreateForMTP(const base::FilePath& mount_path, 93 static Volume* CreateForMTP(const base::FilePath& mount_path,
91 const std::string& label, 94 const std::string& label,
92 bool read_only); 95 bool read_only);
96 static Volume* CreateForMediaView(const std::string& root_document_id);
93 static Volume* CreateForTesting(const base::FilePath& path, 97 static Volume* CreateForTesting(const base::FilePath& path,
94 VolumeType volume_type, 98 VolumeType volume_type,
95 chromeos::DeviceType device_type, 99 chromeos::DeviceType device_type,
96 bool read_only); 100 bool read_only);
97 static Volume* CreateForTesting(const base::FilePath& device_path, 101 static Volume* CreateForTesting(const base::FilePath& device_path,
98 const base::FilePath& mount_path); 102 const base::FilePath& mount_path);
99 103
100 // Getters for all members. See below for details. 104 // Getters for all members. See below for details.
101 const std::string& volume_id() const { return volume_id_; } 105 const std::string& volume_id() const { return volume_id_; }
102 const std::string& file_system_id() const { return file_system_id_; } 106 const std::string& file_system_id() const { return file_system_id_; }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 DISALLOW_COPY_AND_ASSIGN(Volume); 208 DISALLOW_COPY_AND_ASSIGN(Volume);
205 }; 209 };
206 210
207 // Manages "Volume"s for file manager. Here are "Volume"s. 211 // Manages "Volume"s for file manager. Here are "Volume"s.
208 // - Drive File System (not yet supported). 212 // - Drive File System (not yet supported).
209 // - Downloads directory. 213 // - Downloads directory.
210 // - Removable disks (volume will be created for each partition, not only one 214 // - Removable disks (volume will be created for each partition, not only one
211 // for a device). 215 // for a device).
212 // - Mounted zip archives. 216 // - Mounted zip archives.
213 class VolumeManager : public KeyedService, 217 class VolumeManager : public KeyedService,
218 public arc::ArcFileSystemObserver,
219 public arc::ArcServiceManager::Observer,
214 public drive::DriveIntegrationServiceObserver, 220 public drive::DriveIntegrationServiceObserver,
215 public chromeos::disks::DiskMountManager::Observer, 221 public chromeos::disks::DiskMountManager::Observer,
216 public chromeos::file_system_provider::Observer, 222 public chromeos::file_system_provider::Observer,
217 public storage_monitor::RemovableStorageObserver { 223 public storage_monitor::RemovableStorageObserver {
218 public: 224 public:
219 // Returns MediaTransferProtocolManager. Used for injecting 225 // Returns MediaTransferProtocolManager. Used for injecting
220 // FakeMediaTransferProtocolManager for testing. 226 // FakeMediaTransferProtocolManager for testing.
221 typedef base::Callback<const MtpStorageInfo*(const std::string&)> 227 typedef base::Callback<const MtpStorageInfo*(const std::string&)>
222 GetMtpStorageInfoCallback; 228 GetMtpStorageInfoCallback;
223 229
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 void OnProvidedFileSystemMount( 296 void OnProvidedFileSystemMount(
291 const chromeos::file_system_provider::ProvidedFileSystemInfo& 297 const chromeos::file_system_provider::ProvidedFileSystemInfo&
292 file_system_info, 298 file_system_info,
293 chromeos::file_system_provider::MountContext context, 299 chromeos::file_system_provider::MountContext context,
294 base::File::Error error) override; 300 base::File::Error error) override;
295 void OnProvidedFileSystemUnmount( 301 void OnProvidedFileSystemUnmount(
296 const chromeos::file_system_provider::ProvidedFileSystemInfo& 302 const chromeos::file_system_provider::ProvidedFileSystemInfo&
297 file_system_info, 303 file_system_info,
298 base::File::Error error) override; 304 base::File::Error error) override;
299 305
306 // arc::ArcFileSystemObserver overrides.
307 void OnFileSystemsReady() override;
308
309 // arc::ArcServiceManager::Observer overrides.
310 void OnArcShutdown() override;
311
300 // Called on change to kExternalStorageDisabled pref. 312 // Called on change to kExternalStorageDisabled pref.
301 void OnExternalStorageDisabledChanged(); 313 void OnExternalStorageDisabledChanged();
302 314
303 // Called on change to kExternalStorageReadOnly pref. 315 // Called on change to kExternalStorageReadOnly pref.
304 void OnExternalStorageReadOnlyChanged(); 316 void OnExternalStorageReadOnlyChanged();
305 317
306 // RemovableStorageObserver overrides. 318 // RemovableStorageObserver overrides.
307 void OnRemovableStorageAttached( 319 void OnRemovableStorageAttached(
308 const storage_monitor::StorageInfo& info) override; 320 const storage_monitor::StorageInfo& info) override;
309 void OnRemovableStorageDetached( 321 void OnRemovableStorageDetached(
(...skipping 24 matching lines...) Expand all
334 346
335 // Note: This should remain the last member so it'll be destroyed and 347 // Note: This should remain the last member so it'll be destroyed and
336 // invalidate its weak pointers before any other members are destroyed. 348 // invalidate its weak pointers before any other members are destroyed.
337 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; 349 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_;
338 DISALLOW_COPY_AND_ASSIGN(VolumeManager); 350 DISALLOW_COPY_AND_ASSIGN(VolumeManager);
339 }; 351 };
340 352
341 } // namespace file_manager 353 } // namespace file_manager
342 354
343 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ 355 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698