| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_SYSTEM_INFO_PROVIDER_H_ | 4 #ifndef CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_SYSTEM_INFO_PROVIDER_H_ |
| 5 #define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_SYSTEM_INFO_PROVIDER_H_ | 5 #define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_SYSTEM_INFO_PROVIDER_H_ |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 : is_waiting_for_completion_(false) { | 44 : is_waiting_for_completion_(false) { |
| 45 worker_pool_token_ = | 45 worker_pool_token_ = |
| 46 content::BrowserThread::GetBlockingPool()->GetSequenceToken(); | 46 content::BrowserThread::GetBlockingPool()->GetSequenceToken(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual ~SystemInfoProvider() {} | 49 virtual ~SystemInfoProvider() {} |
| 50 | 50 |
| 51 // For testing | 51 // For testing |
| 52 static void InitializeForTesting( | 52 static void InitializeForTesting( |
| 53 scoped_refptr<SystemInfoProvider<T> > provider) { | 53 scoped_refptr<SystemInfoProvider<T> > provider) { |
| 54 DCHECK(provider != NULL); | 54 DCHECK(provider.get() != NULL); |
| 55 single_shared_provider_.Get() = provider; | 55 single_shared_provider_.Get() = provider; |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Start to query the system information. Should be called on UI thread. | 58 // Start to query the system information. Should be called on UI thread. |
| 59 // The |callback| will get called once the query is completed. | 59 // The |callback| will get called once the query is completed. |
| 60 void StartQueryInfo(const QueryInfoCompletionCallback& callback) { | 60 void StartQueryInfo(const QueryInfoCompletionCallback& callback) { |
| 61 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 61 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 62 DCHECK(!callback.is_null()); | 62 DCHECK(!callback.is_null()); |
| 63 | 63 |
| 64 callbacks_.push(callback); | 64 callbacks_.push(callback); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 // Static member intialization. | 142 // Static member intialization. |
| 143 template<class T> | 143 template<class T> |
| 144 typename base::LazyInstance<scoped_refptr<SystemInfoProvider<T> > > | 144 typename base::LazyInstance<scoped_refptr<SystemInfoProvider<T> > > |
| 145 SystemInfoProvider<T>::single_shared_provider_ = LAZY_INSTANCE_INITIALIZER; | 145 SystemInfoProvider<T>::single_shared_provider_ = LAZY_INSTANCE_INITIALIZER; |
| 146 | 146 |
| 147 } // namespace extensions | 147 } // namespace extensions |
| 148 | 148 |
| 149 #endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_SYSTEM_INFO_PROVIDER_H_ | 149 #endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_SYSTEM_INFO_PROVIDER_H_ |
| OLD | NEW |