Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc

Issue 7867044: PART1: Initiated the SignedSettings refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to ToT and cleaned up some tests. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "base/task.h" 12 #include "base/task.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/browser_shutdown.h" 15 #include "chrome/browser/browser_shutdown.h"
16 #include "chrome/browser/io_thread.h" 16 #include "chrome/browser/io_thread.h"
17 #include "chrome/browser/chromeos/cros_settings.h"
17 #include "chrome/browser/chromeos/cros/cros_library.h" 18 #include "chrome/browser/chromeos/cros/cros_library.h"
18 #include "chrome/browser/chromeos/cros/network_library.h" 19 #include "chrome/browser/chromeos/cros/network_library.h"
19 #include "chrome/browser/chromeos/cros/power_library.h" 20 #include "chrome/browser/chromeos/cros/power_library.h"
20 #include "chrome/browser/chromeos/login/user_manager.h" 21 #include "chrome/browser/chromeos/login/user_manager.h"
21 #include "chrome/browser/chromeos/login/webui_login_display.h" 22 #include "chrome/browser/chromeos/login/webui_login_display.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/chromeos/user_cros_settings_provider.h"
24 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/net/gaia/gaia_urls.h" 26 #include "chrome/common/net/gaia/gaia_urls.h"
27 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
28 #include "content/browser/tab_contents/tab_contents.h" 28 #include "content/browser/tab_contents/tab_contents.h"
29 #include "content/common/notification_service.h" 29 #include "content/common/notification_service.h"
30 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
31 #include "net/base/dnsrr_resolver.h" 31 #include "net/base/dnsrr_resolver.h"
32 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
33 33
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 DictionaryValue params; 382 DictionaryValue params;
383 params.SetString("startUrl", kGaiaExtStartPage); 383 params.SetString("startUrl", kGaiaExtStartPage);
384 params.SetString("email", email_); 384 params.SetString("email", email_);
385 email_.clear(); 385 email_.clear();
386 386
387 const std::string app_locale = g_browser_process->GetApplicationLocale(); 387 const std::string app_locale = g_browser_process->GetApplicationLocale();
388 if (!app_locale.empty()) 388 if (!app_locale.empty())
389 params.SetString("hl", app_locale); 389 params.SetString("hl", app_locale);
390 390
391 params.SetBoolean("createAccount", 391 // TODO(pastarmovj): Observe for changes of this variables to update the UI
392 UserCrosSettingsProvider::cached_allow_new_user()); 392 // properly when the policy has been fetched on sign-on screen.
393 params.SetBoolean("guestSignin", 393 bool allow_new_user;
394 UserCrosSettingsProvider::cached_allow_guest()); 394 CrosSettings::Get()->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
395 params.SetBoolean("createAccount", allow_new_user);
396 bool allow_guest;
397 CrosSettings::Get()->GetBoolean(kAccountsPrefAllowGuest, &allow_guest);
398 params.SetBoolean("guestSignin", allow_guest);
395 params.SetString("gaiaOrigin", GaiaUrls::GetInstance()->gaia_origin_url()); 399 params.SetString("gaiaOrigin", GaiaUrls::GetInstance()->gaia_origin_url());
396 400
401
397 // Test automation data: 402 // Test automation data:
398 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 403 const CommandLine* command_line = CommandLine::ForCurrentProcess();
399 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { 404 if (command_line->HasSwitch(switches::kAuthExtensionPath)) {
400 if (!test_user_.empty()) { 405 if (!test_user_.empty()) {
401 params.SetString("test_email", test_user_); 406 params.SetString("test_email", test_user_);
402 test_user_.clear(); 407 test_user_.clear();
403 } 408 }
404 if (!test_pass_.empty()) { 409 if (!test_pass_.empty()) {
405 params.SetString("test_password", test_pass_); 410 params.SetString("test_password", test_pass_);
406 test_pass_.clear(); 411 test_pass_.clear();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 size_t max_non_owner_users = show_guest ? kMaxUsers - 2 : kMaxUsers - 1; 511 size_t max_non_owner_users = show_guest ? kMaxUsers - 2 : kMaxUsers - 1;
507 size_t non_owner_count = 0; 512 size_t non_owner_count = 0;
508 513
509 ListValue users_list; 514 ListValue users_list;
510 UserVector users = WebUILoginDisplay::GetInstance()->users(); 515 UserVector users = WebUILoginDisplay::GetInstance()->users();
511 516
512 bool single_user = users.size() == 1; 517 bool single_user = users.size() == 1;
513 for (UserVector::const_iterator it = users.begin(); 518 for (UserVector::const_iterator it = users.begin();
514 it != users.end(); ++it) { 519 it != users.end(); ++it) {
515 const std::string& email = it->email(); 520 const std::string& email = it->email();
516 bool is_owner = email == UserCrosSettingsProvider::cached_owner(); 521 std::string owner;
522 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner);
523 bool is_owner = (email == owner);
517 524
518 if (non_owner_count < max_non_owner_users || is_owner) { 525 if (non_owner_count < max_non_owner_users || is_owner) {
519 DictionaryValue* user_dict = new DictionaryValue(); 526 DictionaryValue* user_dict = new DictionaryValue();
520 user_dict->SetString(kKeyName, it->GetDisplayName()); 527 user_dict->SetString(kKeyName, it->GetDisplayName());
521 user_dict->SetString(kKeyEmailAddress, email); 528 user_dict->SetString(kKeyEmailAddress, email);
522 user_dict->SetInteger(kKeyOauthTokenStatus, it->oauth_token_status()); 529 user_dict->SetInteger(kKeyOauthTokenStatus, it->oauth_token_status());
523 530
524 // Single user check here is necessary because owner info might not be 531 // Single user check here is necessary because owner info might not be
525 // available when running into login screen on first boot. 532 // available when running into login screen on first boot.
526 // See http://crosbug.com/12723 533 // See http://crosbug.com/12723
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 637
631 cookie_remover_ = new BrowsingDataRemover( 638 cookie_remover_ = new BrowsingDataRemover(
632 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()), 639 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()),
633 BrowsingDataRemover::EVERYTHING, 640 BrowsingDataRemover::EVERYTHING,
634 base::Time()); 641 base::Time());
635 cookie_remover_->AddObserver(this); 642 cookie_remover_->AddObserver(this);
636 cookie_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA); 643 cookie_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA);
637 } 644 }
638 645
639 } // namespace chromeos 646 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698