OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/storage_monitor/media_storage_util.h" | 5 #include "chrome/browser/storage_monitor/media_storage_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return std::string(kMacImageCapture) + unique_id; | 180 return std::string(kMacImageCapture) + unique_id; |
181 } | 181 } |
182 NOTREACHED(); | 182 NOTREACHED(); |
183 return std::string(); | 183 return std::string(); |
184 } | 184 } |
185 | 185 |
186 // static | 186 // static |
187 bool MediaStorageUtil::CrackDeviceId(const std::string& device_id, | 187 bool MediaStorageUtil::CrackDeviceId(const std::string& device_id, |
188 Type* type, std::string* unique_id) { | 188 Type* type, std::string* unique_id) { |
189 size_t prefix_length = device_id.find_first_of(':'); | 189 size_t prefix_length = device_id.find_first_of(':'); |
190 std::string prefix = prefix_length != std::string::npos ? | 190 std::string prefix = prefix_length != std::string::npos |
191 device_id.substr(0, prefix_length + 1) : ""; | 191 ? device_id.substr(0, prefix_length + 1) |
| 192 : std::string(); |
192 | 193 |
193 Type found_type; | 194 Type found_type; |
194 if (prefix == kRemovableMassStorageWithDCIMPrefix) { | 195 if (prefix == kRemovableMassStorageWithDCIMPrefix) { |
195 found_type = REMOVABLE_MASS_STORAGE_WITH_DCIM; | 196 found_type = REMOVABLE_MASS_STORAGE_WITH_DCIM; |
196 } else if (prefix == kRemovableMassStorageNoDCIMPrefix) { | 197 } else if (prefix == kRemovableMassStorageNoDCIMPrefix) { |
197 found_type = REMOVABLE_MASS_STORAGE_NO_DCIM; | 198 found_type = REMOVABLE_MASS_STORAGE_NO_DCIM; |
198 } else if (prefix == kFixedMassStoragePrefix) { | 199 } else if (prefix == kFixedMassStoragePrefix) { |
199 found_type = FIXED_MASS_STORAGE; | 200 found_type = FIXED_MASS_STORAGE; |
200 } else if (prefix == kMtpPtpPrefix) { | 201 } else if (prefix == kMtpPtpPrefix) { |
201 found_type = MTP_OR_PTP; | 202 found_type = MTP_OR_PTP; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 static_cast<enum DeviceInfoHistogramBuckets>(event_number); | 388 static_cast<enum DeviceInfoHistogramBuckets>(event_number); |
388 if (event >= DEVICE_INFO_BUCKET_BOUNDARY) { | 389 if (event >= DEVICE_INFO_BUCKET_BOUNDARY) { |
389 NOTREACHED(); | 390 NOTREACHED(); |
390 return; | 391 return; |
391 } | 392 } |
392 UMA_HISTOGRAM_ENUMERATION("MediaDeviceNotifications.DeviceInfo", event, | 393 UMA_HISTOGRAM_ENUMERATION("MediaDeviceNotifications.DeviceInfo", event, |
393 DEVICE_INFO_BUCKET_BOUNDARY); | 394 DEVICE_INFO_BUCKET_BOUNDARY); |
394 } | 395 } |
395 | 396 |
396 } // namespace chrome | 397 } // namespace chrome |
OLD | NEW |