summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/cros_settings_provider_user.cc
blob: 67dae8ec9dd1aead8d28b2e44ea32d3916ea66a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/cros_settings_provider_user.h"

#include "base/string_util.h"
#include "base/values.h"
#include "chrome/browser/chromeos/cros_settings_names.h"

namespace chromeos {

UserCrosSettingsProvider::UserCrosSettingsProvider()
    : dict_(new DictionaryValue) {
  Set(kAccountsPrefAllowBWSI, Value::CreateBooleanValue(true));
  Set(kAccountsPrefAllowGuest, Value::CreateBooleanValue(true));
  Set(kAccountsPrefShowUserNamesOnSignIn, Value::CreateBooleanValue(true));

  ListValue* user_list = new ListValue;

  DictionaryValue* mock_user = new DictionaryValue;
  mock_user->SetString("email", "mock_user_1@gmail.com");
  mock_user->SetString("name", "Mock User One");
  mock_user->SetBoolean("owner", true);
  user_list->Append(mock_user);

  mock_user = new DictionaryValue;
  mock_user->SetString("email", "mock_user_2@gmail.com");
  mock_user->SetString("name", "Mock User Two");
  mock_user->SetBoolean("owner", false);
  user_list->Append(mock_user);

  Set(kAccountsPrefUsers, user_list);
}

void UserCrosSettingsProvider::Set(const std::string& path, Value* in_value) {
  dict_->Set(path, in_value);
}

bool UserCrosSettingsProvider::Get(const std::string& path,
                                   Value** out_value) const {
  return dict_->Get(path, out_value);
}

bool UserCrosSettingsProvider::HandlesSetting(const std::string& path) {
  return ::StartsWithASCII(path, "cros.accounts.", true);
}

}  // namespace chromeos