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

Side by Side Diff: chrome/browser/chromeos/system_access.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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_ACCESS_H_
6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_ACCESS_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/callback_old.h"
12 #include "content/browser/cancelable_request.h"
13 #include "unicode/timezone.h"
14
15 class CancelableRequestConsumerBase;
16
17 namespace chromeos {
18
19 typedef std::map<std::string, std::string> LogDictionaryType;
20
21 // This interface provides access to Chrome OS system APIs such as the
22 // timezone setting.
23 class SystemAccess : public CancelableRequestProvider {
24 public:
25 class Observer {
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
45 // The callback type used with RequestSyslogs().
46 typedef Callback2<LogDictionaryType*,
47 std::string*>::Type ReadCompleteCallback;
48
49 // Used to specify the syslogs context with RequestSyslogs().
50 enum SyslogsContext {
51 SYSLOGS_FEEDBACK,
52 SYSLOGS_SYSINFO,
53 SYSLOGS_NETWORK,
54 SYSLOGS_DEFAULT
55 };
56
57 // Request system logs. Read happens on the FILE thread and callback is
58 // called on the thread this is called from (via ForwardResult).
59 // Logs are owned by callback function (use delete when done with them).
60 // Returns the request handle. Call CancelRequest(Handle) to cancel
61 // the request before the callback gets called.
62 virtual Handle RequestSyslogs(
63 bool compress_logs,
64 SyslogsContext context,
65 CancelableRequestConsumerBase* consumer,
66 ReadCompleteCallback* callback) = 0;
67
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:
73 virtual ~SystemAccess() {}
74 };
75
76 } // namespace chromeos
77
78 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_ACCESS_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system/timezone_settings.cc ('k') | chrome/browser/chromeos/system_access.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698