Chromium Code Reviews| Index: chrome/browser/chromeos/system/syslogs_fetcher.h |
| diff --git a/chrome/browser/chromeos/system/syslogs_fetcher.h b/chrome/browser/chromeos/system/syslogs_fetcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cb3c412fe8276dfe15701115db719cab0062d0bd |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/system/syslogs_fetcher.h |
| @@ -0,0 +1,67 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_FETCHER_H_ |
| +#define CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_FETCHER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/bind.h" |
| +#include "base/bind_helpers.h" |
| +#include "base/callback.h" |
| +#include "base/memory/singleton.h" |
| +#include "base/synchronization/lock.h" |
| +#include "chrome/browser/chromeos/system/sysinfo_provider.h" |
| + |
| +namespace chromeos { |
| +namespace system { |
| + |
| +typedef base::Callback<void(SysInfoResponse*)> SysLogsFetcherCallback; |
| + |
| +class SysLogsInterface { |
| + public: |
| + virtual void Fetch(SysLogsFetcherCallback) = 0; |
| + virtual ~SysLogsInterface() {} |
| +}; |
| + |
| +typedef std::vector <SysLogsInterface*> BackendCollection; |
|
rkc
2012/08/02 18:40:54
A more appropriate name would be something like Sy
|
| + |
| +class SysLogsFetcher { |
|
rkc
2012/08/02 18:40:54
SystemLogsFetcher
|
| + public: |
| + explicit SysLogsFetcher(BackendCollection); |
| + ~SysLogsFetcher() {} |
| + typedef |
| + scoped_refptr<CancelableRequest<SysInfoProvider::FetchCompleteCallback> > |
|
rkc
2012/08/02 18:40:54
I thought we were moving away from using Cancelabl
|
| + Request; |
| + void Fetch(Request); |
| + private: |
| + Request request_; |
| + BackendCollection backends_; |
| + SysInfoResponse* response_; |
| + base::Lock response_lock_; |
| + base::WeakPtrFactory<SysLogsFetcher> weak_ptr_factory_; |
| + size_t responses_; |
| + void AddData(SysInfoResponse*); |
| +}; |
| + |
| +class SysLogsFetcherFactory { |
|
rkc
2012/08/02 18:40:54
SystemLogsFetcherFactory
and place it in a separat
|
| + public: |
| + static SysLogsFetcherFactory* GetInstance(); |
| + void RegisterHandler(SysLogsInterface*); |
| + SysLogsFetcher * GetFetcher(); |
| + |
| + private: |
| + SysLogsFetcherFactory() {} |
| + ~SysLogsFetcherFactory() {} |
| + friend struct DefaultSingletonTraits<SysLogsFetcherFactory>; |
| + |
| + BackendCollection backends_; |
| + base::Lock backends_lock_; |
| +}; |
| + |
| + |
| +} // namespace system |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_FETCHER_H_ |