OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/chromeos/settings/cros_settings.h" | 5 #include "chrome/browser/chromeos/settings/cros_settings.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 g_cros_settings = NULL; | 40 g_cros_settings = NULL; |
41 } | 41 } |
42 | 42 |
43 // static | 43 // static |
44 CrosSettings* CrosSettings::Get() { | 44 CrosSettings* CrosSettings::Get() { |
45 CHECK(g_cros_settings); | 45 CHECK(g_cros_settings); |
46 return g_cros_settings; | 46 return g_cros_settings; |
47 } | 47 } |
48 | 48 |
49 // static | 49 // static |
50 bool CrosSettings::IsWhitelisted(const std::string& username, | 50 bool CrosSettings::IsWhitelisted(const user_manager::UserID& user_id, |
51 bool* wildcard_match) { | 51 bool* wildcard_match) { |
52 // Skip whitelist check for tests. | 52 // Skip whitelist check for tests. |
53 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 53 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
54 chromeos::switches::kOobeSkipPostLogin)) { | 54 chromeos::switches::kOobeSkipPostLogin)) { |
55 return true; | 55 return true; |
56 } | 56 } |
57 | 57 |
58 CrosSettings* cros_settings = CrosSettings::Get(); | 58 CrosSettings* cros_settings = CrosSettings::Get(); |
59 bool allow_new_user = false; | 59 bool allow_new_user = false; |
60 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 60 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
61 if (allow_new_user) | 61 if (allow_new_user) |
62 return true; | 62 return true; |
63 return cros_settings->FindEmailInList(kAccountsPrefUsers, username, | 63 return cros_settings->FindEmailInList(kAccountsPrefUsers, user_id.GetUserEmail
(), |
64 wildcard_match); | 64 wildcard_match); |
65 } | 65 } |
66 | 66 |
67 CrosSettings::CrosSettings(DeviceSettingsService* device_settings_service) { | 67 CrosSettings::CrosSettings(DeviceSettingsService* device_settings_service) { |
68 CrosSettingsProvider::NotifyObserversCallback notify_cb( | 68 CrosSettingsProvider::NotifyObserversCallback notify_cb( |
69 base::Bind(&CrosSettings::FireObservers, | 69 base::Bind(&CrosSettings::FireObservers, |
70 // This is safe since |this| is never deleted. | 70 // This is safe since |this| is never deleted. |
71 base::Unretained(this))); | 71 base::Unretained(this))); |
72 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 72 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
73 switches::kStubCrosSettings)) { | 73 switches::kStubCrosSettings)) { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 ScopedTestCrosSettings::ScopedTestCrosSettings() { | 341 ScopedTestCrosSettings::ScopedTestCrosSettings() { |
342 CrosSettings::Initialize(); | 342 CrosSettings::Initialize(); |
343 } | 343 } |
344 | 344 |
345 ScopedTestCrosSettings::~ScopedTestCrosSettings() { | 345 ScopedTestCrosSettings::~ScopedTestCrosSettings() { |
346 CrosSettings::Shutdown(); | 346 CrosSettings::Shutdown(); |
347 } | 347 } |
348 | 348 |
349 } // namespace chromeos | 349 } // namespace chromeos |
OLD | NEW |