OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/ui/webui/chromeos/login/signin_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/browser_shutdown.h" | 12 #include "chrome/browser/browser_shutdown.h" |
13 #include "chrome/browser/io_thread.h" | 13 #include "chrome/browser/io_thread.h" |
14 #include "chrome/browser/chromeos/cros_settings.h" | |
14 #include "chrome/browser/chromeos/cros/cros_library.h" | 15 #include "chrome/browser/chromeos/cros/cros_library.h" |
15 #include "chrome/browser/chromeos/cros/power_library.h" | 16 #include "chrome/browser/chromeos/cros/power_library.h" |
16 #include "chrome/browser/chromeos/login/user_manager.h" | 17 #include "chrome/browser/chromeos/login/user_manager.h" |
17 #include "chrome/browser/chromeos/login/webui_login_display.h" | 18 #include "chrome/browser/chromeos/login/webui_login_display.h" |
18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | |
20 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/net/gaia/gaia_urls.h" | 22 #include "chrome/common/net/gaia/gaia_urls.h" |
23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
24 #include "content/browser/tab_contents/tab_contents.h" | 24 #include "content/browser/tab_contents/tab_contents.h" |
25 #include "content/common/notification_service.h" | 25 #include "content/common/notification_service.h" |
26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
27 #include "net/base/dnsrr_resolver.h" | 27 #include "net/base/dnsrr_resolver.h" |
28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
29 | 29 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 return; | 256 return; |
257 | 257 |
258 DictionaryValue params; | 258 DictionaryValue params; |
259 params.SetString("startUrl", kGaiaExtStartPage); | 259 params.SetString("startUrl", kGaiaExtStartPage); |
260 params.SetString("email", email_); | 260 params.SetString("email", email_); |
261 email_.clear(); | 261 email_.clear(); |
262 | 262 |
263 const std::string app_locale = g_browser_process->GetApplicationLocale(); | 263 const std::string app_locale = g_browser_process->GetApplicationLocale(); |
264 if (!app_locale.empty()) | 264 if (!app_locale.empty()) |
265 params.SetString("hl", app_locale); | 265 params.SetString("hl", app_locale); |
266 | 266 |
Mattias Nissler (ping if slow)
2011/09/26 17:26:37
put a TODO here as well saying that we need to obs
pastarmovj
2011/09/29 15:15:03
Done.
| |
267 params.SetBoolean("createAccount", | 267 bool allow_new_user; |
268 UserCrosSettingsProvider::cached_allow_new_user()); | 268 CrosSettings::Get()->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
269 params.SetBoolean("guestSignin", | 269 params.SetBoolean("createAccount", allow_new_user); |
270 UserCrosSettingsProvider::cached_allow_guest()); | 270 bool allow_guest; |
271 CrosSettings::Get()->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); | |
272 params.SetBoolean("guestSignin", allow_guest); | |
271 params.SetString("gaiaOrigin", GaiaUrls::GetInstance()->gaia_origin_url()); | 273 params.SetString("gaiaOrigin", GaiaUrls::GetInstance()->gaia_origin_url()); |
272 | 274 |
273 // Test automation data: | 275 // Test automation data: |
274 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 276 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
275 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { | 277 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { |
276 if (!test_user_.empty()) { | 278 if (!test_user_.empty()) { |
277 params.SetString("test_email", test_user_); | 279 params.SetString("test_email", test_user_); |
278 test_user_.clear(); | 280 test_user_.clear(); |
279 } | 281 } |
280 if (!test_pass_.empty()) { | 282 if (!test_pass_.empty()) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 size_t max_non_owner_users = show_guest ? kMaxUsers - 2 : kMaxUsers - 1; | 380 size_t max_non_owner_users = show_guest ? kMaxUsers - 2 : kMaxUsers - 1; |
379 size_t non_owner_count = 0; | 381 size_t non_owner_count = 0; |
380 | 382 |
381 ListValue users_list; | 383 ListValue users_list; |
382 UserVector users = WebUILoginDisplay::GetInstance()->users(); | 384 UserVector users = WebUILoginDisplay::GetInstance()->users(); |
383 | 385 |
384 bool single_user = users.size() == 1; | 386 bool single_user = users.size() == 1; |
385 for (UserVector::const_iterator it = users.begin(); | 387 for (UserVector::const_iterator it = users.begin(); |
386 it != users.end(); ++it) { | 388 it != users.end(); ++it) { |
387 const std::string& email = it->email(); | 389 const std::string& email = it->email(); |
388 bool is_owner = email == UserCrosSettingsProvider::cached_owner(); | 390 std::string owner; |
391 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); | |
392 bool is_owner = (email == owner); | |
389 | 393 |
390 if (non_owner_count < max_non_owner_users || is_owner) { | 394 if (non_owner_count < max_non_owner_users || is_owner) { |
391 DictionaryValue* user_dict = new DictionaryValue(); | 395 DictionaryValue* user_dict = new DictionaryValue(); |
392 user_dict->SetString(kKeyName, it->GetDisplayName()); | 396 user_dict->SetString(kKeyName, it->GetDisplayName()); |
393 user_dict->SetString(kKeyEmailAddress, email); | 397 user_dict->SetString(kKeyEmailAddress, email); |
394 user_dict->SetInteger(kKeyOauthTokenStatus, it->oauth_token_status()); | 398 user_dict->SetInteger(kKeyOauthTokenStatus, it->oauth_token_status()); |
395 | 399 |
396 // Single user check here is necessary because owner info might not be | 400 // Single user check here is necessary because owner info might not be |
397 // available when running into login screen on first boot. | 401 // available when running into login screen on first boot. |
398 // See http://crosbug.com/12723 | 402 // See http://crosbug.com/12723 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
472 | 476 |
473 cookie_remover_ = new BrowsingDataRemover( | 477 cookie_remover_ = new BrowsingDataRemover( |
474 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()), | 478 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()), |
475 BrowsingDataRemover::EVERYTHING, | 479 BrowsingDataRemover::EVERYTHING, |
476 base::Time()); | 480 base::Time()); |
477 cookie_remover_->AddObserver(this); | 481 cookie_remover_->AddObserver(this); |
478 cookie_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA); | 482 cookie_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA); |
479 } | 483 } |
480 | 484 |
481 } // namespace chromeos | 485 } // namespace chromeos |
OLD | NEW |