| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/browser/api/system_storage/storage_info_provider.h" | 5 #include "extensions/browser/api/system_storage/storage_info_provider.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| 11 #include "components/storage_monitor/storage_info.h" | 11 #include "components/storage_monitor/storage_info.h" |
| 12 #include "components/storage_monitor/storage_monitor.h" | 12 #include "components/storage_monitor/storage_monitor.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 | 14 |
| 15 using storage_monitor::StorageInfo; | 15 using storage_monitor::StorageInfo; |
| 16 using storage_monitor::StorageMonitor; | 16 using storage_monitor::StorageMonitor; |
| 17 | 17 |
| 18 namespace extensions { | 18 namespace extensions { |
| 19 | 19 |
| 20 using content::BrowserThread; | 20 using content::BrowserThread; |
| 21 using core_api::system_storage::StorageUnitInfo; | 21 using api::system_storage::StorageUnitInfo; |
| 22 using core_api::system_storage::STORAGE_UNIT_TYPE_FIXED; | 22 using api::system_storage::STORAGE_UNIT_TYPE_FIXED; |
| 23 using core_api::system_storage::STORAGE_UNIT_TYPE_REMOVABLE; | 23 using api::system_storage::STORAGE_UNIT_TYPE_REMOVABLE; |
| 24 | 24 |
| 25 namespace systeminfo { | 25 namespace systeminfo { |
| 26 | 26 |
| 27 void BuildStorageUnitInfo(const StorageInfo& info, StorageUnitInfo* unit) { | 27 void BuildStorageUnitInfo(const StorageInfo& info, StorageUnitInfo* unit) { |
| 28 unit->id = StorageMonitor::GetInstance()->GetTransientIdForDeviceId( | 28 unit->id = StorageMonitor::GetInstance()->GetTransientIdForDeviceId( |
| 29 info.device_id()); | 29 info.device_id()); |
| 30 unit->name = base::UTF16ToUTF8(info.GetDisplayName(false)); | 30 unit->name = base::UTF16ToUTF8(info.GetDisplayName(false)); |
| 31 // TODO(hmin): Might need to take MTP device into consideration. | 31 // TODO(hmin): Might need to take MTP device into consideration. |
| 32 unit->type = StorageInfo::IsRemovableDevice(info.device_id()) | 32 unit->type = StorageInfo::IsRemovableDevice(info.device_id()) |
| 33 ? STORAGE_UNIT_TYPE_REMOVABLE | 33 ? STORAGE_UNIT_TYPE_REMOVABLE |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 // static | 116 // static |
| 117 StorageInfoProvider* StorageInfoProvider::Get() { | 117 StorageInfoProvider* StorageInfoProvider::Get() { |
| 118 if (provider_.Get().get() == NULL) | 118 if (provider_.Get().get() == NULL) |
| 119 provider_.Get() = new StorageInfoProvider(); | 119 provider_.Get() = new StorageInfoProvider(); |
| 120 return provider_.Get().get(); | 120 return provider_.Get().get(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace extensions | 123 } // namespace extensions |
| OLD | NEW |