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

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

Issue 7324017: Split SystemAccess into TimezoneSettings, StatisticsProvider, and SyslogsProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_ACCESS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_
6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_ACCESS_H_ 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback_old.h" 11 #include "base/callback_old.h"
12 #include "content/browser/cancelable_request.h" 12 #include "content/browser/cancelable_request.h"
13 #include "unicode/timezone.h"
14 13
15 class CancelableRequestConsumerBase; 14 class CancelableRequestConsumerBase;
16 15
17 namespace chromeos { 16 namespace chromeos {
17 namespace system {
18 18
19 typedef std::map<std::string, std::string> LogDictionaryType; 19 typedef std::map<std::string, std::string> LogDictionaryType;
20 20
21 // This interface provides access to Chrome OS system APIs such as the 21 // This interface provides access to Chrome OS syslogs.
22 // timezone setting. 22 class SyslogsProvider : public CancelableRequestProvider {
23 class SystemAccess : public CancelableRequestProvider {
24 public: 23 public:
25 class Observer { 24 static SyslogsProvider* GetInstance();
26 public:
27 // Called when the timezone has changed. |timezone| is non-null.
28 virtual void TimezoneChanged(const icu::TimeZone& timezone) = 0;
29 };
30
31 static SystemAccess* GetInstance();
32
33 // Returns the current timezone as an icu::Timezone object.
34 virtual const icu::TimeZone& GetTimezone() = 0;
35
36 // Sets the current timezone. |timezone| must be non-null.
37 virtual void SetTimezone(const icu::TimeZone& timezone) = 0;
38
39 // Retrieve the named machine statistic (e.g. "hardware_class").
40 // This does not update the statistcs. If the |name| is not set, |result|
41 // preserves old value.
42 virtual bool GetMachineStatistic(const std::string& name,
43 std::string* result) = 0;
44 25
45 // The callback type used with RequestSyslogs(). 26 // The callback type used with RequestSyslogs().
46 typedef Callback2<LogDictionaryType*, 27 typedef Callback2<LogDictionaryType*,
47 std::string*>::Type ReadCompleteCallback; 28 std::string*>::Type ReadCompleteCallback;
48 29
49 // Used to specify the syslogs context with RequestSyslogs(). 30 // Used to specify the syslogs context with RequestSyslogs().
50 enum SyslogsContext { 31 enum SyslogsContext {
51 SYSLOGS_FEEDBACK, 32 SYSLOGS_FEEDBACK,
52 SYSLOGS_SYSINFO, 33 SYSLOGS_SYSINFO,
53 SYSLOGS_NETWORK, 34 SYSLOGS_NETWORK,
54 SYSLOGS_DEFAULT 35 SYSLOGS_DEFAULT
55 }; 36 };
56 37
57 // Request system logs. Read happens on the FILE thread and callback is 38 // Request system logs. Read happens on the FILE thread and callback is
58 // called on the thread this is called from (via ForwardResult). 39 // called on the thread this is called from (via ForwardResult).
59 // Logs are owned by callback function (use delete when done with them). 40 // Logs are owned by callback function (use delete when done with them).
60 // Returns the request handle. Call CancelRequest(Handle) to cancel 41 // Returns the request handle. Call CancelRequest(Handle) to cancel
61 // the request before the callback gets called. 42 // the request before the callback gets called.
62 virtual Handle RequestSyslogs( 43 virtual Handle RequestSyslogs(
63 bool compress_logs, 44 bool compress_logs,
64 SyslogsContext context, 45 SyslogsContext context,
65 CancelableRequestConsumerBase* consumer, 46 CancelableRequestConsumerBase* consumer,
66 ReadCompleteCallback* callback) = 0; 47 ReadCompleteCallback* callback) = 0;
67 48
68 // The observer is used to monitor timezone changes.
69 virtual void AddObserver(Observer* observer) = 0;
70 virtual void RemoveObserver(Observer* observer) = 0;
71
72 protected: 49 protected:
73 virtual ~SystemAccess() {} 50 virtual ~SyslogsProvider() {}
74 }; 51 };
75 52
53 } // namespace system
76 } // namespace chromeos 54 } // namespace chromeos
77 55
78 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_ACCESS_H_ 56 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system/statistics_provider.cc ('k') | chrome/browser/chromeos/system/syslogs_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698