• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "unicode/timezone.h"
12 
13 namespace chromeos {
14 
15 // This interface provides access to Chrome OS system APIs such as the
16 // timezone setting.
17 class SystemAccess {
18  public:
19   class Observer {
20    public:
21     // Called when the timezone has changed. |timezone| is non-null.
22     virtual void TimezoneChanged(const icu::TimeZone& timezone) = 0;
23   };
24 
25   static SystemAccess* GetInstance();
26 
27   // Returns the current timezone as an icu::Timezone object.
28   virtual const icu::TimeZone& GetTimezone() = 0;
29 
30   // Sets the current timezone. |timezone| must be non-null.
31   virtual void SetTimezone(const icu::TimeZone& timezone) = 0;
32 
33   // Retrieve the named machine statistic (e.g. "hardware_class").
34   // This does not update the statistcs. If the |name| is not set, |result|
35   // preserves old value.
36   virtual bool GetMachineStatistic(const std::string& name,
37                                    std::string* result) = 0;
38 
39   virtual void AddObserver(Observer* observer) = 0;
40   virtual void RemoveObserver(Observer* observer) = 0;
41 
42  protected:
~SystemAccess()43   virtual ~SystemAccess() {}
44 };
45 
46 }  // namespace chromeos
47 
48 #endif  // CHROME_BROWSER_CHROMEOS_SYSTEM_ACCESS_H_
49