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

Side by Side Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 12676017: Adding policy support to the new network configuration stack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed clang errors. Created 7 years, 8 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) 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 <vector> 8 #include <vector>
9 9
10 #include "base/chromeos/chromeos_version.h" 10 #include "base/chromeos/chromeos_version.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include "chrome/browser/signin/token_service.h" 67 #include "chrome/browser/signin/token_service.h"
68 #include "chrome/browser/signin/token_service_factory.h" 68 #include "chrome/browser/signin/token_service_factory.h"
69 #include "chrome/browser/sync/profile_sync_service.h" 69 #include "chrome/browser/sync/profile_sync_service.h"
70 #include "chrome/browser/sync/profile_sync_service_factory.h" 70 #include "chrome/browser/sync/profile_sync_service_factory.h"
71 #include "chrome/browser/ui/startup/startup_browser_creator.h" 71 #include "chrome/browser/ui/startup/startup_browser_creator.h"
72 #include "chrome/common/chrome_notification_types.h" 72 #include "chrome/common/chrome_notification_types.h"
73 #include "chrome/common/chrome_paths.h" 73 #include "chrome/common/chrome_paths.h"
74 #include "chrome/common/chrome_switches.h" 74 #include "chrome/common/chrome_switches.h"
75 #include "chrome/common/logging_chrome.h" 75 #include "chrome/common/logging_chrome.h"
76 #include "chrome/common/pref_names.h" 76 #include "chrome/common/pref_names.h"
77 #include "chromeos/chromeos_switches.h"
77 #include "chromeos/dbus/dbus_thread_manager.h" 78 #include "chromeos/dbus/dbus_thread_manager.h"
78 #include "chromeos/dbus/session_manager_client.h" 79 #include "chromeos/dbus/session_manager_client.h"
79 #include "content/public/browser/browser_thread.h" 80 #include "content/public/browser/browser_thread.h"
80 #include "content/public/browser/notification_observer.h" 81 #include "content/public/browser/notification_observer.h"
81 #include "content/public/browser/notification_service.h" 82 #include "content/public/browser/notification_service.h"
82 #include "google_apis/gaia/gaia_auth_consumer.h" 83 #include "google_apis/gaia/gaia_auth_consumer.h"
83 #include "google_apis/gaia/gaia_constants.h" 84 #include "google_apis/gaia/gaia_constants.h"
84 #include "google_apis/gaia/gaia_urls.h" 85 #include "google_apis/gaia/gaia_urls.h"
85 #include "googleurl/src/gurl.h" 86 #include "googleurl/src/gurl.h"
86 #include "net/base/network_change_notifier.h" 87 #include "net/base/network_change_notifier.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 should_restore_auth_session_(false), 125 should_restore_auth_session_(false),
125 session_restore_strategy_( 126 session_restore_strategy_(
126 OAuthLoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN), 127 OAuthLoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN),
127 url_request_context_getter_(NULL) { 128 url_request_context_getter_(NULL) {
128 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); 129 net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
129 // During tests, the browser_process may not be initialized yet causing 130 // During tests, the browser_process may not be initialized yet causing
130 // this to fail. 131 // this to fail.
131 // TODO(dzhioev): Disabled in tests for a while. 132 // TODO(dzhioev): Disabled in tests for a while.
132 // TODO(dzhioev): Move prewarm out of LoginUtils. 133 // TODO(dzhioev): Move prewarm out of LoginUtils.
133 if (g_browser_process && 134 if (g_browser_process &&
134 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { 135 !CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestType)) {
135 registrar_.Add( 136 registrar_.Add(
136 this, 137 this,
137 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, 138 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED,
138 content::Source<Profile>(ProfileHelper::GetSigninProfile())); 139 content::Source<Profile>(ProfileHelper::GetSigninProfile()));
139 } 140 }
140 } 141 }
141 142
142 virtual ~LoginUtilsImpl() { 143 virtual ~LoginUtilsImpl() {
143 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); 144 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
144 } 145 }
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 UserManager::Get()->GetLoggedInUser()->display_email()); 431 UserManager::Get()->GetLoggedInUser()->display_email());
431 } 432 }
432 433
433 // Make sure we flip every profile to not share proxies if the user hasn't 434 // Make sure we flip every profile to not share proxies if the user hasn't
434 // specified so explicitly. 435 // specified so explicitly.
435 const PrefService::Preference* use_shared_proxies_pref = 436 const PrefService::Preference* use_shared_proxies_pref =
436 user_profile->GetPrefs()->FindPreference(prefs::kUseSharedProxies); 437 user_profile->GetPrefs()->FindPreference(prefs::kUseSharedProxies);
437 if (use_shared_proxies_pref->IsDefaultValue()) 438 if (use_shared_proxies_pref->IsDefaultValue())
438 user_profile->GetPrefs()->SetBoolean(prefs::kUseSharedProxies, false); 439 user_profile->GetPrefs()->SetBoolean(prefs::kUseSharedProxies, false);
439 440
440 // Locally managed users do not have user policy initialized. 441 // Notify the network configuration updater that policies are initialized. If
441 if (!UserManager::Get()->IsLoggedInAsLocallyManagedUser()) { 442 // there is no policy, it will read an empty policy which is fine.
442 policy::NetworkConfigurationUpdater* network_configuration_updater = 443 g_browser_process->browser_policy_connector()->
443 g_browser_process->browser_policy_connector()-> 444 GetNetworkConfigurationUpdater()->OnUserPolicyInitialized();
444 GetNetworkConfigurationUpdater();
445 if (network_configuration_updater)
446 network_configuration_updater->OnUserPolicyInitialized();
447 }
448 445
449 RespectLocalePreference(user_profile); 446 RespectLocalePreference(user_profile);
450 } 447 }
451 448
452 void LoginUtilsImpl::InitSessionRestoreStrategy() { 449 void LoginUtilsImpl::InitSessionRestoreStrategy() {
453 CommandLine* command_line = CommandLine::ForCurrentProcess(); 450 CommandLine* command_line = CommandLine::ForCurrentProcess();
454 bool in_app_mode = chrome::IsRunningInForcedAppMode(); 451 bool in_app_mode = chrome::IsRunningInForcedAppMode();
455 452
456 // Are we in kiosk app mode? 453 // Are we in kiosk app mode?
457 if (in_app_mode) { 454 if (in_app_mode) {
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 bool LoginUtils::IsWhitelisted(const std::string& username) { 958 bool LoginUtils::IsWhitelisted(const std::string& username) {
962 CrosSettings* cros_settings = CrosSettings::Get(); 959 CrosSettings* cros_settings = CrosSettings::Get();
963 bool allow_new_user = false; 960 bool allow_new_user = false;
964 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 961 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
965 if (allow_new_user) 962 if (allow_new_user)
966 return true; 963 return true;
967 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); 964 return cros_settings->FindEmailInList(kAccountsPrefUsers, username);
968 } 965 }
969 966
970 } // namespace chromeos 967 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698