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

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 on ToT (solved merging conflict). Created 9 years, 1 month 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/logging.h" 11 #include "base/logging.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/chromeos/cros_settings.h"
16 #include "chrome/browser/chromeos/cros/cros_library.h" 17 #include "chrome/browser/chromeos/cros/cros_library.h"
17 #include "chrome/browser/chromeos/cros/network_library.h" 18 #include "chrome/browser/chromeos/cros/network_library.h"
18 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" 19 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
19 #include "chrome/browser/chromeos/dbus/power_manager_client.h" 20 #include "chrome/browser/chromeos/dbus/power_manager_client.h"
20 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 21 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
21 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 22 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
22 #include "chrome/browser/chromeos/login/screen_locker.h" 23 #include "chrome/browser/chromeos/login/screen_locker.h"
23 #include "chrome/browser/chromeos/login/user.h" 24 #include "chrome/browser/chromeos/login/user.h"
24 #include "chrome/browser/chromeos/login/webui_login_display.h" 25 #include "chrome/browser/chromeos/login/webui_login_display.h"
25 #include "chrome/browser/chromeos/user_cros_settings_provider.h"
26 #include "chrome/browser/io_thread.h" 26 #include "chrome/browser/io_thread.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/common/chrome_notification_types.h" 28 #include "chrome/common/chrome_notification_types.h"
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/net/gaia/gaia_urls.h" 30 #include "chrome/common/net/gaia/gaia_urls.h"
31 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
32 #include "content/browser/tab_contents/tab_contents.h" 32 #include "content/browser/tab_contents/tab_contents.h"
33 #include "content/public/browser/notification_observer.h" 33 #include "content/public/browser/notification_observer.h"
34 #include "content/public/browser/notification_registrar.h" 34 #include "content/public/browser/notification_registrar.h"
35 #include "content/public/browser/notification_service.h" 35 #include "content/public/browser/notification_service.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 464
465 void SigninScreenHandler::LoadAuthExtension(bool force, bool silent_load) { 465 void SigninScreenHandler::LoadAuthExtension(bool force, bool silent_load) {
466 DictionaryValue params; 466 DictionaryValue params;
467 467
468 params.SetBoolean("forceReload", force); 468 params.SetBoolean("forceReload", force);
469 params.SetBoolean("silentLoad", silent_load); 469 params.SetBoolean("silentLoad", silent_load);
470 params.SetString("startUrl", kGaiaExtStartPage); 470 params.SetString("startUrl", kGaiaExtStartPage);
471 params.SetString("email", email_); 471 params.SetString("email", email_);
472 email_.clear(); 472 email_.clear();
473 473
474 params.SetBoolean("createAccount", 474 // TODO(pastarmovj): Observe for changes of this variables to update the UI
Mattias Nissler (ping if slow) 2011/11/18 14:12:00 "Watch for" or "Observe". I have never heard of "o
pastarmovj 2011/11/18 15:01:38 Done.
475 UserCrosSettingsProvider::cached_allow_new_user()); 475 // properly when the policy has been fetched on sign-on screen.
476 params.SetBoolean("guestSignin", 476 bool allow_new_user;
Mattias Nissler (ping if slow) 2011/11/18 14:12:00 Properly initialize these variables (also below) i
pastarmovj 2011/11/18 15:01:38 done.
477 UserCrosSettingsProvider::cached_allow_guest()); 477 CrosSettings::Get()->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
478 params.SetBoolean("createAccount", allow_new_user);
479 bool allow_guest;
480 CrosSettings::Get()->GetBoolean(kAccountsPrefAllowGuest, &allow_guest);
481 params.SetBoolean("guestSignin", allow_guest);
478 482
479 const std::string app_locale = g_browser_process->GetApplicationLocale(); 483 const std::string app_locale = g_browser_process->GetApplicationLocale();
480 if (!app_locale.empty()) 484 if (!app_locale.empty())
481 params.SetString("hl", app_locale); 485 params.SetString("hl", app_locale);
482 486
483 params.SetString("gaiaOrigin", GaiaUrls::GetInstance()->gaia_origin_url()); 487 params.SetString("gaiaOrigin", GaiaUrls::GetInstance()->gaia_origin_url());
484 488
485 // Test automation data: 489 // Test automation data:
486 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 490 const CommandLine* command_line = CommandLine::ForCurrentProcess();
487 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { 491 if (command_line->HasSwitch(switches::kAuthExtensionPath)) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 599
596 size_t max_non_owner_users = show_guest ? kMaxUsers - 2 : kMaxUsers - 1; 600 size_t max_non_owner_users = show_guest ? kMaxUsers - 2 : kMaxUsers - 1;
597 size_t non_owner_count = 0; 601 size_t non_owner_count = 0;
598 602
599 ListValue users_list; 603 ListValue users_list;
600 const UserList& users = delegate_->GetUsers(); 604 const UserList& users = delegate_->GetUsers();
601 605
602 bool single_user = users.size() == 1; 606 bool single_user = users.size() == 1;
603 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { 607 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) {
604 const std::string& email = (*it)->email(); 608 const std::string& email = (*it)->email();
605 bool is_owner = email == UserCrosSettingsProvider::cached_owner(); 609 std::string owner;
610 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner);
611 bool is_owner = (email == owner);
606 bool signed_in = UserManager::Get()->user_is_logged_in() && 612 bool signed_in = UserManager::Get()->user_is_logged_in() &&
607 email == UserManager::Get()->logged_in_user().email(); 613 email == UserManager::Get()->logged_in_user().email();
608 614
609 if (non_owner_count < max_non_owner_users || is_owner) { 615 if (non_owner_count < max_non_owner_users || is_owner) {
610 DictionaryValue* user_dict = new DictionaryValue(); 616 DictionaryValue* user_dict = new DictionaryValue();
611 user_dict->SetString(kKeyName, (*it)->GetDisplayName()); 617 user_dict->SetString(kKeyName, (*it)->GetDisplayName());
612 user_dict->SetString(kKeyEmailAddress, email); 618 user_dict->SetString(kKeyEmailAddress, email);
613 user_dict->SetInteger(kKeyOauthTokenStatus, (*it)->oauth_token_status()); 619 user_dict->SetInteger(kKeyOauthTokenStatus, (*it)->oauth_token_status());
614 user_dict->SetBoolean(kKeySignedIn, signed_in); 620 user_dict->SetBoolean(kKeySignedIn, signed_in);
615 621
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 731
726 cookie_remover_ = new BrowsingDataRemover( 732 cookie_remover_ = new BrowsingDataRemover(
727 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()), 733 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()),
728 BrowsingDataRemover::EVERYTHING, 734 BrowsingDataRemover::EVERYTHING,
729 base::Time()); 735 base::Time());
730 cookie_remover_->AddObserver(this); 736 cookie_remover_->AddObserver(this);
731 cookie_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA); 737 cookie_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA);
732 } 738 }
733 739
734 } // namespace chromeos 740 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698