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/device_event_router.cc

Issue 2451603002: Add a method to remount all removable devices in DiskMountManager. (Closed)
Patch Set: Add is_mounted() method. 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/threading/thread_task_runner_handle.h" 6 #include "base/threading/thread_task_runner_handle.h"
7 #include "chrome/browser/chromeos/extensions/file_manager/device_event_router.h" 7 #include "chrome/browser/chromeos/extensions/file_manager/device_event_router.h"
8 #include "chrome/browser/chromeos/file_manager/volume_manager.h" 8 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 void DeviceEventRouter::OnDiskRemoved( 73 void DeviceEventRouter::OnDiskRemoved(
74 const chromeos::disks::DiskMountManager::Disk& disk) { 74 const chromeos::disks::DiskMountManager::Disk& disk) {
75 DCHECK(thread_checker_.CalledOnValidThread()); 75 DCHECK(thread_checker_.CalledOnValidThread());
76 76
77 if (is_resuming_ || is_starting_up_) 77 if (is_resuming_ || is_starting_up_)
78 return; 78 return;
79 79
80 const std::string& device_path = disk.system_path_prefix(); 80 const std::string& device_path = disk.system_path_prefix();
81 if (!disk.is_read_only() && !disk.mount_path().empty() && 81 if (!disk.is_read_only() && disk.is_mounted() &&
82 GetDeviceState(device_path) != DEVICE_HARD_UNPLUGGED_AND_REPORTED) { 82 GetDeviceState(device_path) != DEVICE_HARD_UNPLUGGED_AND_REPORTED) {
83 OnDeviceEvent(file_manager_private::DEVICE_EVENT_TYPE_HARD_UNPLUGGED, 83 OnDeviceEvent(file_manager_private::DEVICE_EVENT_TYPE_HARD_UNPLUGGED,
84 device_path); 84 device_path);
85 SetDeviceState(device_path, DEVICE_HARD_UNPLUGGED_AND_REPORTED); 85 SetDeviceState(device_path, DEVICE_HARD_UNPLUGGED_AND_REPORTED);
86 } 86 }
87 } 87 }
88 88
89 void DeviceEventRouter::OnVolumeMounted(chromeos::MountError error_code, 89 void DeviceEventRouter::OnVolumeMounted(chromeos::MountError error_code,
90 const Volume& volume) { 90 const Volume& volume) {
91 DCHECK(thread_checker_.CalledOnValidThread()); 91 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 device_states_[device_path] = state; 153 device_states_[device_path] = state;
154 } else { 154 } else {
155 const std::map<std::string, DeviceState>::iterator it = 155 const std::map<std::string, DeviceState>::iterator it =
156 device_states_.find(device_path); 156 device_states_.find(device_path);
157 if (it != device_states_.end()) 157 if (it != device_states_.end())
158 device_states_.erase(it); 158 device_states_.erase(it);
159 } 159 }
160 } 160 }
161 161
162 } // namespace file_manager 162 } // namespace file_manager
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698