Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/file_manager/device_event_router.cc |
| diff --git a/chrome/browser/chromeos/extensions/file_manager/device_event_router.cc b/chrome/browser/chromeos/extensions/file_manager/device_event_router.cc |
| index b6252e351c5844819ec597192efac2cd92e4bea7..f0f207a2c893e89176be9154458221bc68fadf40 100644 |
| --- a/chrome/browser/chromeos/extensions/file_manager/device_event_router.cc |
| +++ b/chrome/browser/chromeos/extensions/file_manager/device_event_router.cc |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| #include "base/bind.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "base/thread_task_runner_handle.h" |
| #include "chrome/browser/chromeos/extensions/file_manager/device_event_router.h" |
| #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
| @@ -80,6 +81,12 @@ void DeviceEventRouter::OnDiskRemoved( |
| const std::string& device_path = disk.system_path_prefix(); |
| if (!disk.mount_path().empty() && |
| GetDeviceState(device_path) != DEVICE_HARD_UNPLUGGED_AND_REPORTED) { |
| + // TODO(hirono): Remove the temporary UMA. crbug.com/433734 |
| + UMA_HISTOGRAM_CUSTOM_TIMES("FileBrowser.HardUnpluggedAfterResume", |
| + base::Time::Now() - last_suspend_done_, |
| + base::TimeDelta::FromMilliseconds(1), |
| + base::TimeDelta::FromSeconds(30), 50); |
| + last_hard_unpluged_ = base::Time::Now(); |
| OnDeviceEvent(file_manager_private::DEVICE_EVENT_TYPE_HARD_UNPLUGGED, |
| device_path); |
| SetDeviceState(device_path, DEVICE_HARD_UNPLUGGED_AND_REPORTED); |
| @@ -124,11 +131,17 @@ void DeviceEventRouter::OnFormatCompleted(const std::string& device_path, |
| void DeviceEventRouter::SuspendImminent() { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| + // TODO(hirono): Remove the temporary UMA. crbug.com/433734 |
| + UMA_HISTOGRAM_CUSTOM_TIMES("FileBrowser.HardUnpluggedBeforeSuspend", |
|
mtomasz
2014/11/17 08:48:03
I think that if there was no unplugging, then we w
hirono
2014/11/25 02:32:13
Done.
|
| + base::Time::Now() - last_hard_unpluged_, |
| + base::TimeDelta::FromMilliseconds(1), |
| + base::TimeDelta::FromSeconds(30), 50); |
| is_resuming_ = true; |
| } |
| void DeviceEventRouter::SuspendDone(const base::TimeDelta& sleep_duration) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| + last_suspend_done_ = base::Time::Now(); |
| base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| FROM_HERE, |
| base::Bind(&DeviceEventRouter::SuspendDoneDelayed, |