| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/metrics/drive_metrics_provider.h" | 5 #include "chrome/browser/metrics/drive_metrics_provider.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 content::BrowserThread::PostTaskAndReplyWithResult( | 33 content::BrowserThread::PostTaskAndReplyWithResult( |
| 34 content::BrowserThread::FILE, FROM_HERE, | 34 content::BrowserThread::FILE, FROM_HERE, |
| 35 base::Bind(&DriveMetricsProvider::GetDriveMetricsOnFileThread), | 35 base::Bind(&DriveMetricsProvider::GetDriveMetricsOnFileThread), |
| 36 base::Bind(&DriveMetricsProvider::GotDriveMetrics, | 36 base::Bind(&DriveMetricsProvider::GotDriveMetrics, |
| 37 weak_ptr_factory_.GetWeakPtr())); | 37 weak_ptr_factory_.GetWeakPtr())); |
| 38 } | 38 } |
| 39 | 39 |
| 40 DriveMetricsProvider::SeekPenaltyResponse::SeekPenaltyResponse() | 40 DriveMetricsProvider::SeekPenaltyResponse::SeekPenaltyResponse() |
| 41 : success(false) {} | 41 : success(false) {} |
| 42 | 42 |
| 43 #if !(defined(OS_WIN) || defined(OS_ANDROID) || defined(OS_IOS)) | |
| 44 // static | |
| 45 bool DriveMetricsProvider::HasSeekPenalty(const base::FilePath& path, | |
| 46 bool* has_seek_penalty) { | |
| 47 // TODO(dbeam): implement on more platforms. | |
| 48 return false; | |
| 49 } | |
| 50 #endif | |
| 51 | |
| 52 // static | 43 // static |
| 53 DriveMetricsProvider::DriveMetrics | 44 DriveMetricsProvider::DriveMetrics |
| 54 DriveMetricsProvider::GetDriveMetricsOnFileThread() { | 45 DriveMetricsProvider::GetDriveMetricsOnFileThread() { |
| 55 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); | 46 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); |
| 56 | 47 |
| 57 DriveMetricsProvider::DriveMetrics metrics; | 48 DriveMetricsProvider::DriveMetrics metrics; |
| 58 QuerySeekPenalty(base::FILE_EXE, &metrics.app_drive); | 49 QuerySeekPenalty(base::FILE_EXE, &metrics.app_drive); |
| 59 QuerySeekPenalty(chrome::FILE_LOCAL_STATE, &metrics.user_data_drive); | 50 QuerySeekPenalty(chrome::FILE_LOCAL_STATE, &metrics.user_data_drive); |
| 60 return metrics; | 51 return metrics; |
| 61 } | 52 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 90 metrics_ = metrics; | 81 metrics_ = metrics; |
| 91 got_metrics_callback_.Run(); | 82 got_metrics_callback_.Run(); |
| 92 } | 83 } |
| 93 | 84 |
| 94 void DriveMetricsProvider::FillDriveMetrics( | 85 void DriveMetricsProvider::FillDriveMetrics( |
| 95 const DriveMetricsProvider::SeekPenaltyResponse& response, | 86 const DriveMetricsProvider::SeekPenaltyResponse& response, |
| 96 metrics::SystemProfileProto::Hardware::Drive* drive) { | 87 metrics::SystemProfileProto::Hardware::Drive* drive) { |
| 97 if (response.success) | 88 if (response.success) |
| 98 drive->set_has_seek_penalty(response.has_seek_penalty); | 89 drive->set_has_seek_penalty(response.has_seek_penalty); |
| 99 } | 90 } |
| OLD | NEW |