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

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: Rename the field name to is_read_only_removable_device, as it's only valid for removable devices. 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_removable_device_(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_removable_device_ = 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_ =
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 }
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 if (mounted_volumes_.find(volume->volume_id()) == mounted_volumes_.end()) 904 if (mounted_volumes_.find(volume->volume_id()) == mounted_volumes_.end())
903 return; 905 return;
904 if (error_code == chromeos::MOUNT_ERROR_NONE) 906 if (error_code == chromeos::MOUNT_ERROR_NONE)
905 mounted_volumes_.erase(volume->volume_id()); 907 mounted_volumes_.erase(volume->volume_id());
906 908
907 for (auto& observer : observers_) 909 for (auto& observer : observers_)
908 observer.OnVolumeUnmounted(error_code, *volume.get()); 910 observer.OnVolumeUnmounted(error_code, *volume.get());
909 } 911 }
910 912
911 } // namespace file_manager 913 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_manager/volume_manager.h ('k') | chrome/common/extensions/api/file_manager_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698