Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: chrome/browser/chromeos/system/syslogs_fetcher.h

Issue 10827130: Refactoring the SysInfoProvider. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_FETCHER_H_
6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_FETCHER_H_
7
8 #include <vector>
9
10 #include "base/bind.h"
11 #include "base/bind_helpers.h"
12 #include "base/callback.h"
13 #include "base/memory/singleton.h"
14 #include "base/synchronization/lock.h"
15 #include "chrome/browser/chromeos/system/sysinfo_provider.h"
16
17 namespace chromeos {
18 namespace system {
19
20 typedef base::Callback<void(SysInfoResponse*)> SysLogsFetcherCallback;
21
22 class SysLogsInterface {
23 public:
24 virtual void Fetch(SysLogsFetcherCallback) = 0;
25 virtual ~SysLogsInterface() {}
26 };
27
28 typedef std::vector <SysLogsInterface*> BackendCollection;
rkc 2012/08/02 18:40:54 A more appropriate name would be something like Sy
29
30 class SysLogsFetcher {
rkc 2012/08/02 18:40:54 SystemLogsFetcher
31 public:
32 explicit SysLogsFetcher(BackendCollection);
33 ~SysLogsFetcher() {}
34 typedef
35 scoped_refptr<CancelableRequest<SysInfoProvider::FetchCompleteCallback> >
rkc 2012/08/02 18:40:54 I thought we were moving away from using Cancelabl
36 Request;
37 void Fetch(Request);
38 private:
39 Request request_;
40 BackendCollection backends_;
41 SysInfoResponse* response_;
42 base::Lock response_lock_;
43 base::WeakPtrFactory<SysLogsFetcher> weak_ptr_factory_;
44 size_t responses_;
45 void AddData(SysInfoResponse*);
46 };
47
48 class SysLogsFetcherFactory {
rkc 2012/08/02 18:40:54 SystemLogsFetcherFactory and place it in a separat
49 public:
50 static SysLogsFetcherFactory* GetInstance();
51 void RegisterHandler(SysLogsInterface*);
52 SysLogsFetcher * GetFetcher();
53
54 private:
55 SysLogsFetcherFactory() {}
56 ~SysLogsFetcherFactory() {}
57 friend struct DefaultSingletonTraits<SysLogsFetcherFactory>;
58
59 BackendCollection backends_;
60 base::Lock backends_lock_;
61 };
62
63
64 } // namespace system
65 } // namespace chromeos
66
67 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698