| OLD | NEW |
| 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/thread_task_runner_handle.h" | 6 #include "base/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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 DCHECK(thread_checker_.CalledOnValidThread()); | 53 DCHECK(thread_checker_.CalledOnValidThread()); |
| 54 | 54 |
| 55 if (is_starting_up_ || is_resuming_) { | 55 if (is_starting_up_ || is_resuming_) { |
| 56 SetDeviceState(device_path, DEVICE_STATE_USUAL); | 56 SetDeviceState(device_path, DEVICE_STATE_USUAL); |
| 57 return; | 57 return; |
| 58 } | 58 } |
| 59 | 59 |
| 60 if (IsExternalStorageDisabled()) { | 60 if (IsExternalStorageDisabled()) { |
| 61 OnDeviceEvent(file_manager_private::DEVICE_EVENT_TYPE_DISABLED, | 61 OnDeviceEvent(file_manager_private::DEVICE_EVENT_TYPE_DISABLED, |
| 62 device_path); | 62 device_path); |
| 63 SetDeviceState(device_path, DEVICE_STATE_USUAL); | |
| 64 return; | 63 return; |
| 65 } | 64 } |
| 66 | 65 |
| 67 SetDeviceState(device_path, DEVICE_SCANNED); | 66 SetDeviceState(device_path, DEVICE_SCANNED); |
| 68 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 67 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 69 FROM_HERE, | 68 FROM_HERE, |
| 70 base::Bind(&DeviceEventRouter::OnDeviceAddedDelayed, | 69 base::Bind(&DeviceEventRouter::OnDeviceAddedDelayed, |
| 71 weak_factory_.GetWeakPtr(), | 70 weak_factory_.GetWeakPtr(), |
| 72 device_path), | 71 device_path), |
| 73 scan_time_delta_); | 72 scan_time_delta_); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 device_states_[device_path] = state; | 188 device_states_[device_path] = state; |
| 190 } else { | 189 } else { |
| 191 const std::map<std::string, DeviceState>::iterator it = | 190 const std::map<std::string, DeviceState>::iterator it = |
| 192 device_states_.find(device_path); | 191 device_states_.find(device_path); |
| 193 if (it != device_states_.end()) | 192 if (it != device_states_.end()) |
| 194 device_states_.erase(it); | 193 device_states_.erase(it); |
| 195 } | 194 } |
| 196 } | 195 } |
| 197 | 196 |
| 198 } // namespace file_manager | 197 } // namespace file_manager |
| OLD | NEW |