Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Side by Side Diff: chrome/browser/storage_monitor/storage_info.cc

Issue 15294020: StorageMonitor: Make StorageInfo a real class. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: address nits Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/storage_info.h" 5 #include "chrome/browser/storage_monitor/storage_info.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace chrome { 9 namespace chrome {
10 10
11 namespace { 11 namespace {
12 12
13 // Prefix constants for different device id spaces. 13 // Prefix constants for different device id spaces.
14 const char kRemovableMassStorageWithDCIMPrefix[] = "dcim:"; 14 const char kRemovableMassStorageWithDCIMPrefix[] = "dcim:";
15 const char kRemovableMassStorageNoDCIMPrefix[] = "nodcim:"; 15 const char kRemovableMassStorageNoDCIMPrefix[] = "nodcim:";
16 const char kFixedMassStoragePrefix[] = "path:"; 16 const char kFixedMassStoragePrefix[] = "path:";
17 const char kMtpPtpPrefix[] = "mtp:"; 17 const char kMtpPtpPrefix[] = "mtp:";
18 const char kMacImageCapturePrefix[] = "ic:"; 18 const char kMacImageCapturePrefix[] = "ic:";
19 const char kITunesPrefix[] = "itunes:"; 19 const char kITunesPrefix[] = "itunes:";
20 20
21 } // namespace 21 } // namespace
22 22
23 StorageInfo::StorageInfo() : total_size_in_bytes(0) { 23 StorageInfo::StorageInfo() : total_size_in_bytes_(0) {
24 } 24 }
25 25
26 StorageInfo::StorageInfo(const std::string& device_id_in, 26 StorageInfo::StorageInfo(const std::string& device_id_in,
27 const string16& device_name, 27 const string16& device_name,
28 const base::FilePath::StringType& device_location, 28 const base::FilePath::StringType& device_location,
29 const string16& label, 29 const string16& label,
30 const string16& vendor, 30 const string16& vendor,
31 const string16& model, 31 const string16& model,
32 uint64 size_in_bytes) 32 uint64 size_in_bytes)
33 : device_id(device_id_in), 33 : device_id_(device_id_in),
34 name(device_name), 34 name_(device_name),
35 location(device_location), 35 location_(device_location),
36 storage_label(label), 36 storage_label_(label),
37 vendor_name(vendor), 37 vendor_name_(vendor),
38 model_name(model), 38 model_name_(model),
39 total_size_in_bytes(size_in_bytes) { 39 total_size_in_bytes_(size_in_bytes) {
40 } 40 }
41 41
42 StorageInfo::~StorageInfo() { 42 StorageInfo::~StorageInfo() {
43 } 43 }
44 44
45 // static 45 // static
46 std::string StorageInfo::MakeDeviceId(Type type, const std::string& unique_id) { 46 std::string StorageInfo::MakeDeviceId(Type type, const std::string& unique_id) {
47 DCHECK(!unique_id.empty()); 47 DCHECK(!unique_id.empty());
48 switch (type) { 48 switch (type) {
49 case REMOVABLE_MASS_STORAGE_WITH_DCIM: 49 case REMOVABLE_MASS_STORAGE_WITH_DCIM:
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 bool StorageInfo::IsMassStorageDevice(const std::string& device_id) { 118 bool StorageInfo::IsMassStorageDevice(const std::string& device_id) {
119 Type type; 119 Type type;
120 return CrackDeviceId(device_id, &type, NULL) && 120 return CrackDeviceId(device_id, &type, NULL) &&
121 (type == REMOVABLE_MASS_STORAGE_WITH_DCIM || 121 (type == REMOVABLE_MASS_STORAGE_WITH_DCIM ||
122 type == REMOVABLE_MASS_STORAGE_NO_DCIM || 122 type == REMOVABLE_MASS_STORAGE_NO_DCIM ||
123 type == FIXED_MASS_STORAGE || 123 type == FIXED_MASS_STORAGE ||
124 type == ITUNES); 124 type == ITUNES);
125 } 125 }
126 126
127 } // namespace chrome 127 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/storage_monitor/storage_info.h ('k') | chrome/browser/storage_monitor/storage_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698