| 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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 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 |
| 34 : STORAGE_UNIT_TYPE_FIXED; | 34 : STORAGE_UNIT_TYPE_FIXED; |
| 35 unit->capacity = static_cast<double>(info.total_size_in_bytes()); | 35 unit->capacity = static_cast<double>(info.total_size_in_bytes()); |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace systeminfo | 38 } // namespace systeminfo |
| 39 | 39 |
| 40 // Static member intialization. | 40 // Static member intialization. |
| 41 base::LazyInstance<scoped_refptr<StorageInfoProvider> > | 41 base::LazyInstance<scoped_refptr<StorageInfoProvider>>::DestructorAtExit |
| 42 StorageInfoProvider::provider_ = LAZY_INSTANCE_INITIALIZER; | 42 StorageInfoProvider::provider_ = LAZY_INSTANCE_INITIALIZER; |
| 43 | 43 |
| 44 StorageInfoProvider::StorageInfoProvider() { | 44 StorageInfoProvider::StorageInfoProvider() { |
| 45 } | 45 } |
| 46 | 46 |
| 47 StorageInfoProvider::~StorageInfoProvider() { | 47 StorageInfoProvider::~StorageInfoProvider() { |
| 48 } | 48 } |
| 49 | 49 |
| 50 void StorageInfoProvider::InitializeForTesting( | 50 void StorageInfoProvider::InitializeForTesting( |
| 51 scoped_refptr<StorageInfoProvider> provider) { | 51 scoped_refptr<StorageInfoProvider> provider) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 | 111 |
| 112 // static | 112 // static |
| 113 StorageInfoProvider* StorageInfoProvider::Get() { | 113 StorageInfoProvider* StorageInfoProvider::Get() { |
| 114 if (provider_.Get().get() == NULL) | 114 if (provider_.Get().get() == NULL) |
| 115 provider_.Get() = new StorageInfoProvider(); | 115 provider_.Get() = new StorageInfoProvider(); |
| 116 return provider_.Get().get(); | 116 return provider_.Get().get(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace extensions | 119 } // namespace extensions |
| OLD | NEW |