Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 void StorageInfoProvider::InitializeProvider( | 61 void StorageInfoProvider::InitializeProvider( |
| 62 const base::Closure& do_query_info_callback) { | 62 const base::Closure& do_query_info_callback) { |
| 63 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 63 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 64 // Register the |do_query_info_callback| callback to StorageMonitor. | 64 // Register the |do_query_info_callback| callback to StorageMonitor. |
| 65 // See the comments of StorageMonitor::EnsureInitialized about when the | 65 // See the comments of StorageMonitor::EnsureInitialized about when the |
| 66 // callback gets run. | 66 // callback gets run. |
| 67 StorageMonitor::GetInstance()->EnsureInitialized(do_query_info_callback); | 67 StorageMonitor::GetInstance()->EnsureInitialized(do_query_info_callback); |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool StorageInfoProvider::QueryInfo() { | 70 bool StorageInfoProvider::QueryInfo() { |
| 71 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 71 base::ThreadRestrictions::AssertIOAllowed(); |
|
Devlin
2017/05/17 15:06:23
Might be worth mentioning this change in either th
Yeol Park
2017/05/19 07:31:36
Done.
| |
| 72 // No info to query since we get all available storage devices' info in | 72 // No info to query since we get all available storage devices' info in |
| 73 // |PrepareQueryOnUIThread()|. | 73 // |PrepareQueryOnUIThread()|. |
| 74 return true; | 74 return true; |
| 75 } | 75 } |
| 76 | 76 |
| 77 void StorageInfoProvider::GetAllStoragesIntoInfoList() { | 77 void StorageInfoProvider::GetAllStoragesIntoInfoList() { |
| 78 info_.clear(); | 78 info_.clear(); |
| 79 std::vector<StorageInfo> storage_list = | 79 std::vector<StorageInfo> storage_list = |
| 80 StorageMonitor::GetInstance()->GetAllAvailableStorages(); | 80 StorageMonitor::GetInstance()->GetAllAvailableStorages(); |
| 81 | 81 |
| (...skipping 28 matching lines...) Expand all 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 |