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

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

Issue 23892008: Move VolumeManager to c/b/chromeos/file_manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_VOLUME_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_VOLUME_MANAGER_H_
7
8 #include "base/basictypes.h"
9 #include "base/files/file_path.h"
10 #include "base/observer_list.h"
11 #include "chromeos/disks/disk_mount_manager.h"
12 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
13
14 class Profile;
15
16 namespace content {
17 class BrowserContext;
18 } // namespace content
19
20 namespace file_manager {
21
22 class VolumeManagerObserver;
23
24 // This manager manages "Drive" and "Downloads" in addition to disks managed
25 // by DiskMountManager.
26 enum VolumeType {
27 VOLUME_TYPE_GOOGLE_DRIVE,
28 VOLUME_TYPE_DOWNLOADS_DIRECTORY,
29 VOLUME_TYPE_REMOVABLE_DISK_PARTITION,
30 VOLUME_TYPE_MOUNTED_ARCHIVE_FILE,
31 };
32
33 struct VolumeInfo {
34 // The type of mounted volume.
35 VolumeType type;
36
37 // The source path of the volume.
38 // E.g.:
39 // - /home/chronos/user/Downloads/zipfile_path.zip
40 base::FilePath source_path;
41
42 // The mount path of the volume.
43 // E.g.:
44 // - /home/chronos/user/Downloads
45 // - /media/removable/usb1
46 // - /media/archive/zip1
47 base::FilePath mount_path;
48
49 // The mounting condition. See the enum for the details.
50 chromeos::disks::MountCondition mount_condition;
51 };
52
53 // Manages "Volume"s for file manager. Here are "Volume"s.
54 // - Drive File System (not yet supported).
55 // - Downloads directory.
56 // - Removable disks (volume will be created for each partition, not only one
57 // for a device).
58 // - Mounted zip archives.
59 class VolumeManager : public BrowserContextKeyedService,
60 public chromeos::disks::DiskMountManager::Observer {
61 public:
62 VolumeManager(Profile* profile,
63 chromeos::disks::DiskMountManager* disk_mount_manager);
64 virtual ~VolumeManager();
65
66 // Returns the instance corresponding to the |context|.
67 static VolumeManager* Get(content::BrowserContext* context);
68
69 // Intializes this instance.
70 void Initialize();
71
72 // Disposes this instance.
73 virtual void Shutdown() OVERRIDE;
74
75 // Adds an observer.
76 void AddObserver(VolumeManagerObserver* observer);
77
78 // Removes the observer.
79 void RemoveObserver(VolumeManagerObserver* observer);
80
81 // Returns the information about all volumes currently mounted.
82 // TODO(hidehiko): make this just an accessor.
83 std::vector<VolumeInfo> GetVolumeInfoList() const;
84
85 // chromeos::disks::DiskMountManager::Observer overrides.
86 virtual void OnDiskEvent(
87 chromeos::disks::DiskMountManager::DiskEvent event,
88 const chromeos::disks::DiskMountManager::Disk* disk) OVERRIDE;
89 virtual void OnDeviceEvent(
90 chromeos::disks::DiskMountManager::DeviceEvent event,
91 const std::string& device_path) OVERRIDE;
92 virtual void OnMountEvent(
93 chromeos::disks::DiskMountManager::MountEvent event,
94 chromeos::MountError error_code,
95 const chromeos::disks::DiskMountManager::MountPointInfo& mount_info)
96 OVERRIDE;
97 virtual void OnFormatEvent(
98 chromeos::disks::DiskMountManager::FormatEvent event,
99 chromeos::FormatError error_code,
100 const std::string& device_path) OVERRIDE;
101
102 private:
103 Profile* profile_;
104 chromeos::disks::DiskMountManager* disk_mount_manager_;
105 ObserverList<VolumeManagerObserver> observers_;
106 DISALLOW_COPY_AND_ASSIGN(VolumeManager);
107 };
108
109 } // namespace file_manager
110
111 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_VOLUME_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698