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

Side by Side Diff: chrome/browser/chromeos/cros/mount_library.h

Issue 7628011: Revert Revert 94812 - Formatting feature initial commit for ChromeOS Tree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_CROS_MOUNT_LIBRARY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_MOUNT_LIBRARY_H_
6 #define CHROME_BROWSER_CHROMEOS_CROS_MOUNT_LIBRARY_H_ 6 #define CHROME_BROWSER_CHROMEOS_CROS_MOUNT_LIBRARY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "third_party/cros/chromeos_mount.h" 15 #include "third_party/cros/chromeos_mount.h"
16 16
17 namespace chromeos { 17 namespace chromeos {
18 18
19 typedef enum MountLibraryEventType { 19 typedef enum MountLibraryEventType {
20 MOUNT_DISK_ADDED, 20 MOUNT_DISK_ADDED,
21 MOUNT_DISK_REMOVED, 21 MOUNT_DISK_REMOVED,
22 MOUNT_DISK_CHANGED, 22 MOUNT_DISK_CHANGED,
23 MOUNT_DISK_MOUNTED, 23 MOUNT_DISK_MOUNTED,
24 MOUNT_DISK_UNMOUNTED, 24 MOUNT_DISK_UNMOUNTED,
25 MOUNT_DEVICE_ADDED, 25 MOUNT_DEVICE_ADDED,
26 MOUNT_DEVICE_REMOVED, 26 MOUNT_DEVICE_REMOVED,
27 MOUNT_DEVICE_SCANNED 27 MOUNT_DEVICE_SCANNED,
28 MOUNT_FORMATTING_STARTED,
29 MOUNT_FORMATTING_FINISHED
28 } MountLibraryEventType; 30 } MountLibraryEventType;
29 31
30 // This class handles the interaction with the ChromeOS mount library APIs. 32 // This class handles the interaction with the ChromeOS mount library APIs.
31 // Classes can add themselves as observers. Users can get an instance of this 33 // Classes can add themselves as observers. Users can get an instance of this
32 // library class like this: chromeos::CrosLibrary::Get()->GetMountLibrary() 34 // library class like this: chromeos::CrosLibrary::Get()->GetMountLibrary()
33 class MountLibrary { 35 class MountLibrary {
34 public: 36 public:
35 enum MountEvent { 37 enum MountEvent {
36 MOUNTING, 38 MOUNTING,
37 UNMOUNTING 39 UNMOUNTING
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 std::string drive_label_; 95 std::string drive_label_;
94 std::string parent_path_; 96 std::string parent_path_;
95 DeviceType device_type_; 97 DeviceType device_type_;
96 uint64 total_size_; 98 uint64 total_size_;
97 bool is_parent_; 99 bool is_parent_;
98 bool is_read_only_; 100 bool is_read_only_;
99 bool has_media_; 101 bool has_media_;
100 bool on_boot_device_; 102 bool on_boot_device_;
101 }; 103 };
102 typedef std::map<std::string, Disk*> DiskMap; 104 typedef std::map<std::string, Disk*> DiskMap;
105 typedef std::map<std::string, std::string> PathMap;
103 106
104 struct MountPointInfo { 107 struct MountPointInfo {
105 std::string source_path; 108 std::string source_path;
106 std::string mount_path; 109 std::string mount_path;
107 MountType mount_type; 110 MountType mount_type;
108 111
109 MountPointInfo(const char* source, const char* mount, const MountType type) 112 MountPointInfo(const char* source, const char* mount, const MountType type)
110 : source_path(source ? source : ""), 113 : source_path(source ? source : ""),
111 mount_path(mount ? mount : ""), 114 mount_path(mount ? mount : ""),
112 mount_type(type) { 115 mount_type(type) {
(...skipping 24 matching lines...) Expand all
137 virtual const DiskMap& disks() const = 0; 140 virtual const DiskMap& disks() const = 0;
138 virtual const MountPointMap& mount_points() const = 0; 141 virtual const MountPointMap& mount_points() const = 0;
139 142
140 virtual void RequestMountInfoRefresh() = 0; 143 virtual void RequestMountInfoRefresh() = 0;
141 virtual void MountPath(const char* source_path, 144 virtual void MountPath(const char* source_path,
142 MountType type, 145 MountType type,
143 const MountPathOptions& options) = 0; 146 const MountPathOptions& options) = 0;
144 // |path| is device's mount path. 147 // |path| is device's mount path.
145 virtual void UnmountPath(const char* path) = 0; 148 virtual void UnmountPath(const char* path) = 0;
146 149
150 // Formats device given its file path.
151 // Example: file_path: /dev/sdb1
152 virtual void FormatUnmountedDevice(const char* file_path) = 0;
153
154 // Formats Device given its mount path. Unmount's the device
155 // Example: mount_path: /media/VOLUME_LABEL
156 virtual void FormatMountedDevice(const char* mount_path) = 0;
157
147 // Unmounts device_poath and all of its known children. 158 // Unmounts device_poath and all of its known children.
148 virtual void UnmountDeviceRecursive(const char* device_path, 159 virtual void UnmountDeviceRecursive(const char* device_path,
149 UnmountDeviceRecursiveCallbackType callback, void* user_data) = 0; 160 UnmountDeviceRecursiveCallbackType callback, void* user_data) = 0;
150 161
151 // Helper functions for parameter conversions. 162 // Helper functions for parameter conversions.
152 static std::string MountTypeToString(MountType type); 163 static std::string MountTypeToString(MountType type);
153 static MountType MountTypeFromString(const std::string& type_str); 164 static MountType MountTypeFromString(const std::string& type_str);
154 165
155 // Factory function, creates a new instance and returns ownership. 166 // Factory function, creates a new instance and returns ownership.
156 // For normal usage, access the singleton via CrosLibrary::Get(). 167 // For normal usage, access the singleton via CrosLibrary::Get().
157 static MountLibrary* GetImpl(bool stub); 168 static MountLibrary* GetImpl(bool stub);
158 }; 169 };
159 170
160 } // namespace chromeos 171 } // namespace chromeos
161 172
162 #endif // CHROME_BROWSER_CHROMEOS_CROS_MOUNT_LIBRARY_H_ 173 #endif // CHROME_BROWSER_CHROMEOS_CROS_MOUNT_LIBRARY_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/mock_mount_library.cc ('k') | chrome/browser/chromeos/cros/mount_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698