Home | History | Annotate | Download | only in policy
      1 // Copyright 2013 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_POLICY_LOGIN_SCREEN_POWER_MANAGEMENT_POLICY_H_
      6 #define CHROME_BROWSER_CHROMEOS_POLICY_LOGIN_SCREEN_POWER_MANAGEMENT_POLICY_H_
      7 
      8 #include <string>
      9 
     10 #include "base/basictypes.h"
     11 #include "base/memory/scoped_ptr.h"
     12 
     13 namespace base {
     14 class Value;
     15 }
     16 
     17 namespace policy {
     18 
     19 class PolicyErrorMap;
     20 
     21 // Parses power management policy encoded as a JSON string and extracts the
     22 // individual settings.
     23 // TODO(bartfab): Remove this code once the policy system has full support for
     24 // the 'dict' policy type, parsing JSON strings and verifying them against a
     25 // JSON schema internally. http://crbug.com/258339
     26 class LoginScreenPowerManagementPolicy {
     27  public:
     28   LoginScreenPowerManagementPolicy();
     29   ~LoginScreenPowerManagementPolicy();
     30 
     31   bool Init(const std::string& json, PolicyErrorMap* errors);
     32 
     33   const base::Value* GetScreenDimDelayAC() const;
     34   const base::Value* GetScreenOffDelayAC() const;
     35   const base::Value* GetIdleDelayAC() const;
     36   const base::Value* GetScreenDimDelayBattery() const;
     37   const base::Value* GetScreenOffDelayBattery() const;
     38   const base::Value* GetIdleDelayBattery() const;
     39   const base::Value* GetIdleActionAC() const;
     40   const base::Value* GetIdleActionBattery() const;
     41   const base::Value* GetLidCloseAction() const;
     42   const base::Value* GetUserActivityScreenDimDelayScale() const;
     43 
     44  private:
     45   scoped_ptr<base::Value> screen_dim_delay_ac_;
     46   scoped_ptr<base::Value> screen_off_delay_ac_;
     47   scoped_ptr<base::Value> idle_delay_ac_;
     48   scoped_ptr<base::Value> screen_dim_delay_battery_;
     49   scoped_ptr<base::Value> screen_off_delay_battery_;
     50   scoped_ptr<base::Value> idle_delay_battery_;
     51   scoped_ptr<base::Value> idle_action_ac_;
     52   scoped_ptr<base::Value> idle_action_battery_;
     53   scoped_ptr<base::Value> lid_close_action_;
     54   scoped_ptr<base::Value> user_activity_screen_dim_delay_scale_;
     55 
     56   DISALLOW_COPY_AND_ASSIGN(LoginScreenPowerManagementPolicy);
     57 };
     58 
     59 }  // namespace policy
     60 
     61 #endif  // CHROME_BROWSER_CHROMEOS_POLICY_LOGIN_SCREEN_POWER_MANAGEMENT_POLICY_H_
     62