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

Side by Side Diff: components/storage_monitor/storage_info.h

Issue 1549993003: Switch to standard integer types in components/, part 4 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_STORAGE_MONITOR_STORAGE_INFO_H_ 5 #ifndef COMPONENTS_STORAGE_MONITOR_STORAGE_INFO_H_
6 #define COMPONENTS_STORAGE_MONITOR_STORAGE_INFO_H_ 6 #define COMPONENTS_STORAGE_MONITOR_STORAGE_INFO_H_
7 7
8 #include <stdint.h>
9
8 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
9 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
10 12
11 namespace storage_monitor { 13 namespace storage_monitor {
12 14
13 class StorageInfo { 15 class StorageInfo {
14 public: 16 public:
15 enum Type { 17 enum Type {
16 // A removable mass storage device with a DCIM directory. 18 // A removable mass storage device with a DCIM directory.
17 REMOVABLE_MASS_STORAGE_WITH_DCIM, 19 REMOVABLE_MASS_STORAGE_WITH_DCIM,
(...skipping 13 matching lines...) Expand all
31 IPHOTO, 33 IPHOTO,
32 }; 34 };
33 35
34 StorageInfo(); 36 StorageInfo();
35 // Note: |device_id_in| should be constructed with MakeDeviceId. 37 // Note: |device_id_in| should be constructed with MakeDeviceId.
36 StorageInfo(const std::string& device_id_in, 38 StorageInfo(const std::string& device_id_in,
37 const base::FilePath::StringType& device_location, 39 const base::FilePath::StringType& device_location,
38 const base::string16& label, 40 const base::string16& label,
39 const base::string16& vendor, 41 const base::string16& vendor,
40 const base::string16& model, 42 const base::string16& model,
41 uint64 size_in_bytes); 43 uint64_t size_in_bytes);
42 ~StorageInfo(); 44 ~StorageInfo();
43 45
44 // Returns a device id given properties of the device. A prefix dependent on 46 // Returns a device id given properties of the device. A prefix dependent on
45 // |type| is added so |unique_id| need only be unique within the given type. 47 // |type| is added so |unique_id| need only be unique within the given type.
46 // Returns an empty string if an invalid type is passed in. 48 // Returns an empty string if an invalid type is passed in.
47 static std::string MakeDeviceId(Type type, const std::string& unique_id); 49 static std::string MakeDeviceId(Type type, const std::string& unique_id);
48 50
49 // Extracts the device |type| and |unique_id| from |device_id|. Returns false 51 // Extracts the device |type| and |unique_id| from |device_id|. Returns false
50 // if the device_id isn't properly formatted. 52 // if the device_id isn't properly formatted.
51 static bool CrackDeviceId(const std::string& device_id, 53 static bool CrackDeviceId(const std::string& device_id,
(...skipping 25 matching lines...) Expand all
77 79
78 // Same as GetDisplayName(), but may be overridden by |override_display_name|. 80 // Same as GetDisplayName(), but may be overridden by |override_display_name|.
79 base::string16 GetDisplayNameWithOverride( 81 base::string16 GetDisplayNameWithOverride(
80 const base::string16& override_display_name, bool with_size) const; 82 const base::string16& override_display_name, bool with_size) const;
81 83
82 const std::string& device_id() const { return device_id_; } 84 const std::string& device_id() const { return device_id_; }
83 const base::FilePath::StringType& location() const { return location_; } 85 const base::FilePath::StringType& location() const { return location_; }
84 const base::string16& storage_label() const { return storage_label_; } 86 const base::string16& storage_label() const { return storage_label_; }
85 const base::string16& vendor_name() const { return vendor_name_; } 87 const base::string16& vendor_name() const { return vendor_name_; }
86 const base::string16& model_name() const { return model_name_; } 88 const base::string16& model_name() const { return model_name_; }
87 uint64 total_size_in_bytes() const { return total_size_in_bytes_; } 89 uint64_t total_size_in_bytes() const { return total_size_in_bytes_; }
88 90
89 void set_device_id(const std::string& device_id) { device_id_ = device_id; } 91 void set_device_id(const std::string& device_id) { device_id_ = device_id; }
90 void set_location(const base::FilePath::StringType& location) { 92 void set_location(const base::FilePath::StringType& location) {
91 location_ = location; 93 location_ = location;
92 } 94 }
93 95
94 private: 96 private:
95 // Unique device id - persists between device attachments. 97 // Unique device id - persists between device attachments.
96 // This is the string that should be used as the label for a particular 98 // This is the string that should be used as the label for a particular
97 // storage device when interacting with the API. Clients should treat 99 // storage device when interacting with the API. Clients should treat
(...skipping 10 matching lines...) Expand all
108 // Vendor name for the removable device. (Human readable) 110 // Vendor name for the removable device. (Human readable)
109 // May be empty if not collected. 111 // May be empty if not collected.
110 base::string16 vendor_name_; 112 base::string16 vendor_name_;
111 113
112 // Model name for the removable device. (Human readable) 114 // Model name for the removable device. (Human readable)
113 // May be empty if not collected. 115 // May be empty if not collected.
114 base::string16 model_name_; 116 base::string16 model_name_;
115 117
116 // Size of the removable device in bytes. 118 // Size of the removable device in bytes.
117 // Zero if not collected or unknown. 119 // Zero if not collected or unknown.
118 uint64 total_size_in_bytes_; 120 uint64_t total_size_in_bytes_;
119 }; 121 };
120 122
121 } // namespace storage_monitor 123 } // namespace storage_monitor
122 124
123 #endif // COMPONENTS_STORAGE_MONITOR_STORAGE_INFO_H_ 125 #endif // COMPONENTS_STORAGE_MONITOR_STORAGE_INFO_H_
OLDNEW
« no previous file with comments | « components/storage_monitor/removable_device_constants.cc ('k') | components/storage_monitor/storage_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698