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/extensions/api/system_info_storage/storage_info_provide
r.h" | 5 #include "chrome/browser/extensions/api/system_info_storage/storage_info_provide
r.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 DWORD string_length = GetLogicalDriveStrings( | 40 DWORD string_length = GetLogicalDriveStrings( |
41 kMaxLogicalDriveString - 1, logical_drive_strings); | 41 kMaxLogicalDriveString - 1, logical_drive_strings); |
42 DCHECK(string_length % 4 == 0); | 42 DCHECK(string_length % 4 == 0); |
43 // No drive found, return false. | 43 // No drive found, return false. |
44 if (string_length == 0) | 44 if (string_length == 0) |
45 return false; | 45 return false; |
46 | 46 |
47 // Iterate the drive string by 4 wchars each step | 47 // Iterate the drive string by 4 wchars each step |
48 for (unsigned int i = 0; i < string_length; i += 4) { | 48 for (unsigned int i = 0; i < string_length; i += 4) { |
49 linked_ptr<StorageUnitInfo> unit(new StorageUnitInfo()); | 49 linked_ptr<StorageUnitInfo> unit(new StorageUnitInfo()); |
50 if (QueryUnitInfo(WideToUTF8(&logical_drive_strings[i]), unit.get())) { | 50 if (QueryUnitInfo(base::WideToUTF8(&logical_drive_strings[i]), |
| 51 unit.get())) { |
51 info->push_back(unit); | 52 info->push_back(unit); |
52 } | 53 } |
53 } | 54 } |
54 return true; | 55 return true; |
55 } | 56 } |
56 | 57 |
57 bool StorageInfoProviderWin::QueryUnitInfo(const std::string& id, | 58 bool StorageInfoProviderWin::QueryUnitInfo(const std::string& id, |
58 StorageUnitInfo* info) { | 59 StorageUnitInfo* info) { |
59 DCHECK(info); | 60 DCHECK(info); |
60 string16 drive = UTF8ToUTF16(id); | 61 string16 drive = UTF8ToUTF16(id); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 95 } |
95 | 96 |
96 } // namespace | 97 } // namespace |
97 | 98 |
98 // static | 99 // static |
99 StorageInfoProvider* StorageInfoProvider::Get() { | 100 StorageInfoProvider* StorageInfoProvider::Get() { |
100 return StorageInfoProvider::GetInstance<StorageInfoProviderWin>(); | 101 return StorageInfoProvider::GetInstance<StorageInfoProviderWin>(); |
101 } | 102 } |
102 | 103 |
103 } // namespace extensions | 104 } // namespace extensions |
OLD | NEW |