| 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/login/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" | 49 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" |
| 50 #include "chrome/browser/chromeos/login/startup_utils.h" | 50 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 51 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" | 51 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" |
| 52 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 52 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 53 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 53 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 54 #include "chrome/browser/chromeos/login/users/user.h" | 54 #include "chrome/browser/chromeos/login/users/user.h" |
| 55 #include "chrome/browser/chromeos/login/users/user_manager.h" | 55 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 56 #include "chrome/browser/chromeos/settings/cros_settings.h" | 56 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 57 #include "chrome/browser/extensions/extension_service.h" | 57 #include "chrome/browser/extensions/extension_service.h" |
| 58 #include "chrome/browser/first_run/first_run.h" | 58 #include "chrome/browser/first_run/first_run.h" |
| 59 #include "chrome/browser/google/google_util_chromeos.h" | 59 #include "chrome/browser/google/google_brand_chromeos.h" |
| 60 #include "chrome/browser/lifetime/application_lifetime.h" | 60 #include "chrome/browser/lifetime/application_lifetime.h" |
| 61 #include "chrome/browser/pref_service_flags_storage.h" | 61 #include "chrome/browser/pref_service_flags_storage.h" |
| 62 #include "chrome/browser/profiles/profile.h" | 62 #include "chrome/browser/profiles/profile.h" |
| 63 #include "chrome/browser/profiles/profile_manager.h" | 63 #include "chrome/browser/profiles/profile_manager.h" |
| 64 #include "chrome/browser/rlz/rlz.h" | 64 #include "chrome/browser/rlz/rlz.h" |
| 65 #include "chrome/browser/signin/signin_manager_factory.h" | 65 #include "chrome/browser/signin/signin_manager_factory.h" |
| 66 #include "chrome/browser/sync/profile_sync_service.h" | 66 #include "chrome/browser/sync/profile_sync_service.h" |
| 67 #include "chrome/browser/sync/profile_sync_service_factory.h" | 67 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 68 #include "chrome/browser/ui/app_list/start_page_service.h" | 68 #include "chrome/browser/ui/app_list/start_page_service.h" |
| 69 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 69 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 // 'if' statement with a CHECK(delegate_) once the underlying issue is | 666 // 'if' statement with a CHECK(delegate_) once the underlying issue is |
| 667 // resolved. | 667 // resolved. |
| 668 if (delegate_) | 668 if (delegate_) |
| 669 delegate_->OnProfilePrepared(user_profile); | 669 delegate_->OnProfilePrepared(user_profile); |
| 670 } | 670 } |
| 671 | 671 |
| 672 void LoginUtilsImpl::InitRlzDelayed(Profile* user_profile) { | 672 void LoginUtilsImpl::InitRlzDelayed(Profile* user_profile) { |
| 673 #if defined(ENABLE_RLZ) | 673 #if defined(ENABLE_RLZ) |
| 674 if (!g_browser_process->local_state()->HasPrefPath(prefs::kRLZBrand)) { | 674 if (!g_browser_process->local_state()->HasPrefPath(prefs::kRLZBrand)) { |
| 675 // Read brand code asynchronously from an OEM data and repost ourselves. | 675 // Read brand code asynchronously from an OEM data and repost ourselves. |
| 676 google_util::chromeos::InitBrand( | 676 google_brand::chromeos::InitBrand( |
| 677 base::Bind(&LoginUtilsImpl::InitRlzDelayed, AsWeakPtr(), user_profile)); | 677 base::Bind(&LoginUtilsImpl::InitRlzDelayed, AsWeakPtr(), user_profile)); |
| 678 return; | 678 return; |
| 679 } | 679 } |
| 680 base::PostTaskAndReplyWithResult( | 680 base::PostTaskAndReplyWithResult( |
| 681 base::WorkerPool::GetTaskRunner(false), | 681 base::WorkerPool::GetTaskRunner(false), |
| 682 FROM_HERE, | 682 FROM_HERE, |
| 683 base::Bind(&base::PathExists, GetRlzDisabledFlagPath()), | 683 base::Bind(&base::PathExists, GetRlzDisabledFlagPath()), |
| 684 base::Bind(&LoginUtilsImpl::InitRlz, AsWeakPtr(), user_profile)); | 684 base::Bind(&LoginUtilsImpl::InitRlz, AsWeakPtr(), user_profile)); |
| 685 #endif | 685 #endif |
| 686 } | 686 } |
| 687 | 687 |
| 688 void LoginUtilsImpl::InitRlz(Profile* user_profile, bool disabled) { | 688 void LoginUtilsImpl::InitRlz(Profile* user_profile, bool disabled) { |
| 689 #if defined(ENABLE_RLZ) | 689 #if defined(ENABLE_RLZ) |
| 690 PrefService* local_state = g_browser_process->local_state(); | 690 PrefService* local_state = g_browser_process->local_state(); |
| 691 if (disabled) { | 691 if (disabled) { |
| 692 // Empty brand code means an organic install (no RLZ pings are sent). | 692 // Empty brand code means an organic install (no RLZ pings are sent). |
| 693 google_util::chromeos::ClearBrandForCurrentSession(); | 693 google_brand::chromeos::ClearBrandForCurrentSession(); |
| 694 } | 694 } |
| 695 if (disabled != local_state->GetBoolean(prefs::kRLZDisabled)) { | 695 if (disabled != local_state->GetBoolean(prefs::kRLZDisabled)) { |
| 696 // When switching to RLZ enabled/disabled state, clear all recorded events. | 696 // When switching to RLZ enabled/disabled state, clear all recorded events. |
| 697 RLZTracker::ClearRlzState(); | 697 RLZTracker::ClearRlzState(); |
| 698 local_state->SetBoolean(prefs::kRLZDisabled, disabled); | 698 local_state->SetBoolean(prefs::kRLZDisabled, disabled); |
| 699 } | 699 } |
| 700 // Init the RLZ library. | 700 // Init the RLZ library. |
| 701 int ping_delay = user_profile->GetPrefs()->GetInteger( | 701 int ping_delay = user_profile->GetPrefs()->GetInteger( |
| 702 first_run::GetPingDelayPrefName().c_str()); | 702 first_run::GetPingDelayPrefName().c_str()); |
| 703 // Negative ping delay means to send ping immediately after a first search is | 703 // Negative ping delay means to send ping immediately after a first search is |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 CrosSettings* cros_settings = CrosSettings::Get(); | 953 CrosSettings* cros_settings = CrosSettings::Get(); |
| 954 bool allow_new_user = false; | 954 bool allow_new_user = false; |
| 955 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 955 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
| 956 if (allow_new_user) | 956 if (allow_new_user) |
| 957 return true; | 957 return true; |
| 958 return cros_settings->FindEmailInList( | 958 return cros_settings->FindEmailInList( |
| 959 kAccountsPrefUsers, username, wildcard_match); | 959 kAccountsPrefUsers, username, wildcard_match); |
| 960 } | 960 } |
| 961 | 961 |
| 962 } // namespace chromeos | 962 } // namespace chromeos |
| OLD | NEW |