| 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)) | 43 #if !(defined(OS_WIN) || defined(OS_LINUX) || defined(OS_IOS)) |
| 44 // static | 44 // static |
| 45 bool DriveMetricsProvider::HasSeekPenalty(const base::FilePath& path, | 45 bool DriveMetricsProvider::HasSeekPenalty(const base::FilePath& path, |
| 46 bool* has_seek_penalty) { | 46 bool* has_seek_penalty) { |
| 47 // TODO(dbeam): implement on more platforms. | 47 // TODO(dbeam): implement on Mac. |
| 48 return false; | 48 return false; |
| 49 } | 49 } |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 // static | 52 // static |
| 53 DriveMetricsProvider::DriveMetrics | 53 DriveMetricsProvider::DriveMetrics |
| 54 DriveMetricsProvider::GetDriveMetricsOnFileThread() { | 54 DriveMetricsProvider::GetDriveMetricsOnFileThread() { |
| 55 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); | 55 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); |
| 56 | 56 |
| 57 DriveMetricsProvider::DriveMetrics metrics; | 57 DriveMetricsProvider::DriveMetrics metrics; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 metrics_ = metrics; | 90 metrics_ = metrics; |
| 91 got_metrics_callback_.Run(); | 91 got_metrics_callback_.Run(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void DriveMetricsProvider::FillDriveMetrics( | 94 void DriveMetricsProvider::FillDriveMetrics( |
| 95 const DriveMetricsProvider::SeekPenaltyResponse& response, | 95 const DriveMetricsProvider::SeekPenaltyResponse& response, |
| 96 metrics::SystemProfileProto::Hardware::Drive* drive) { | 96 metrics::SystemProfileProto::Hardware::Drive* drive) { |
| 97 if (response.success) | 97 if (response.success) |
| 98 drive->set_has_seek_penalty(response.has_seek_penalty); | 98 drive->set_has_seek_penalty(response.has_seek_penalty); |
| 99 } | 99 } |
| OLD | NEW |