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

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

Issue 2451713002: Propagate the read_only_hardware flag of volumes to js. (Closed)
Patch Set: Fix comment. Created 4 years, 1 month 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 #include "chrome/browser/chromeos/file_manager/volume_manager.h" 5 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } // namespace 144 } // namespace
145 145
146 Volume::Volume() 146 Volume::Volume()
147 : source_(SOURCE_FILE), 147 : source_(SOURCE_FILE),
148 type_(VOLUME_TYPE_GOOGLE_DRIVE), 148 type_(VOLUME_TYPE_GOOGLE_DRIVE),
149 device_type_(chromeos::DEVICE_TYPE_UNKNOWN), 149 device_type_(chromeos::DEVICE_TYPE_UNKNOWN),
150 mount_condition_(chromeos::disks::MOUNT_CONDITION_NONE), 150 mount_condition_(chromeos::disks::MOUNT_CONDITION_NONE),
151 mount_context_(MOUNT_CONTEXT_UNKNOWN), 151 mount_context_(MOUNT_CONTEXT_UNKNOWN),
152 is_parent_(false), 152 is_parent_(false),
153 is_read_only_(false), 153 is_read_only_(false),
154 is_read_only_hardware_(false),
154 has_media_(false), 155 has_media_(false),
155 configurable_(false), 156 configurable_(false),
156 watchable_(false) { 157 watchable_(false) {
157 } 158 }
158 159
159 Volume::~Volume() { 160 Volume::~Volume() {
160 } 161 }
161 162
162 // static 163 // static
163 Volume* Volume::CreateForDrive(Profile* profile) { 164 Volume* Volume::CreateForDrive(Profile* profile) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 ? SOURCE_FILE 201 ? SOURCE_FILE
201 : SOURCE_DEVICE; 202 : SOURCE_DEVICE;
202 volume->mount_path_ = base::FilePath(mount_point.mount_path); 203 volume->mount_path_ = base::FilePath(mount_point.mount_path);
203 volume->mount_condition_ = mount_point.mount_condition; 204 volume->mount_condition_ = mount_point.mount_condition;
204 volume->volume_label_ = volume->mount_path().BaseName().AsUTF8Unsafe(); 205 volume->volume_label_ = volume->mount_path().BaseName().AsUTF8Unsafe();
205 if (disk) { 206 if (disk) {
206 volume->device_type_ = disk->device_type(); 207 volume->device_type_ = disk->device_type();
207 volume->system_path_prefix_ = base::FilePath(disk->system_path_prefix()); 208 volume->system_path_prefix_ = base::FilePath(disk->system_path_prefix());
208 volume->is_parent_ = disk->is_parent(); 209 volume->is_parent_ = disk->is_parent();
209 volume->is_read_only_ = disk->is_read_only(); 210 volume->is_read_only_ = disk->is_read_only();
211 volume->is_read_only_hardware_ = disk->is_read_only_hardware();
210 volume->has_media_ = disk->has_media(); 212 volume->has_media_ = disk->has_media();
211 } else { 213 } else {
212 volume->device_type_ = chromeos::DEVICE_TYPE_UNKNOWN; 214 volume->device_type_ = chromeos::DEVICE_TYPE_UNKNOWN;
213 volume->is_read_only_ = 215 volume->is_read_only_ = volume->is_read_only_hardware_ =
fukino 2016/10/27 05:27:34 Should is_read_only_hardware_ be true? The archive
yamaguchi 2016/10/27 07:32:54 Now that we state the is_read_only_device field is
214 (mount_point.mount_type == chromeos::MOUNT_TYPE_ARCHIVE); 216 (mount_point.mount_type == chromeos::MOUNT_TYPE_ARCHIVE);
215 } 217 }
216 volume->volume_id_ = GenerateVolumeId(*volume); 218 volume->volume_id_ = GenerateVolumeId(*volume);
217 volume->watchable_ = true; 219 volume->watchable_ = true;
218 return volume; 220 return volume;
219 } 221 }
220 222
221 // static 223 // static
222 Volume* Volume::CreateForProvidedFileSystem( 224 Volume* Volume::CreateForProvidedFileSystem(
223 const chromeos::file_system_provider::ProvidedFileSystemInfo& 225 const chromeos::file_system_provider::ProvidedFileSystemInfo&
(...skipping 13 matching lines...) Expand all
237 volume->source_ = SOURCE_NETWORK; 239 volume->source_ = SOURCE_NETWORK;
238 break; 240 break;
239 } 241 }
240 volume->volume_label_ = file_system_info.display_name(); 242 volume->volume_label_ = file_system_info.display_name();
241 volume->type_ = VOLUME_TYPE_PROVIDED; 243 volume->type_ = VOLUME_TYPE_PROVIDED;
242 volume->mount_path_ = file_system_info.mount_path(); 244 volume->mount_path_ = file_system_info.mount_path();
243 volume->mount_condition_ = chromeos::disks::MOUNT_CONDITION_NONE; 245 volume->mount_condition_ = chromeos::disks::MOUNT_CONDITION_NONE;
244 volume->mount_context_ = mount_context; 246 volume->mount_context_ = mount_context;
245 volume->is_parent_ = true; 247 volume->is_parent_ = true;
246 volume->is_read_only_ = !file_system_info.writable(); 248 volume->is_read_only_ = !file_system_info.writable();
249 volume->is_read_only_hardware_ = volume->is_read_only_;
fukino 2016/10/27 05:27:34 ditto. FPS volumes are not necessary haredware.
yamaguchi 2016/10/27 07:32:54 Done.
247 volume->configurable_ = file_system_info.configurable(); 250 volume->configurable_ = file_system_info.configurable();
248 volume->watchable_ = file_system_info.watchable(); 251 volume->watchable_ = file_system_info.watchable();
249 volume->volume_id_ = GenerateVolumeId(*volume); 252 volume->volume_id_ = GenerateVolumeId(*volume);
250 return volume; 253 return volume;
251 } 254 }
252 255
253 // static 256 // static
254 Volume* Volume::CreateForMTP(const base::FilePath& mount_path, 257 Volume* Volume::CreateForMTP(const base::FilePath& mount_path,
255 const std::string& label, 258 const std::string& label,
256 bool read_only) { 259 bool read_only) {
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 if (mounted_volumes_.find(volume->volume_id()) == mounted_volumes_.end()) 905 if (mounted_volumes_.find(volume->volume_id()) == mounted_volumes_.end())
903 return; 906 return;
904 if (error_code == chromeos::MOUNT_ERROR_NONE) 907 if (error_code == chromeos::MOUNT_ERROR_NONE)
905 mounted_volumes_.erase(volume->volume_id()); 908 mounted_volumes_.erase(volume->volume_id());
906 909
907 for (auto& observer : observers_) 910 for (auto& observer : observers_)
908 observer.OnVolumeUnmounted(error_code, *volume.get()); 911 observer.OnVolumeUnmounted(error_code, *volume.get());
909 } 912 }
910 913
911 } // namespace file_manager 914 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698