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

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

Issue 611383007: Clear user session flags before restarting Chrome for guest mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include "chrome/common/chrome_switches.h" 71 #include "chrome/common/chrome_switches.h"
72 #include "chrome/common/logging_chrome.h" 72 #include "chrome/common/logging_chrome.h"
73 #include "chrome/common/pref_names.h" 73 #include "chrome/common/pref_names.h"
74 #include "chromeos/chromeos_switches.h" 74 #include "chromeos/chromeos_switches.h"
75 #include "chromeos/cryptohome/cryptohome_util.h" 75 #include "chromeos/cryptohome/cryptohome_util.h"
76 #include "chromeos/dbus/cryptohome_client.h" 76 #include "chromeos/dbus/cryptohome_client.h"
77 #include "chromeos/dbus/dbus_method_call_status.h" 77 #include "chromeos/dbus/dbus_method_call_status.h"
78 #include "chromeos/dbus/dbus_thread_manager.h" 78 #include "chromeos/dbus/dbus_thread_manager.h"
79 #include "chromeos/dbus/session_manager_client.h" 79 #include "chromeos/dbus/session_manager_client.h"
80 #include "chromeos/login/auth/user_context.h" 80 #include "chromeos/login/auth/user_context.h"
81 #include "chromeos/login/user_names.h"
81 #include "chromeos/settings/cros_settings_names.h" 82 #include "chromeos/settings/cros_settings_names.h"
82 #include "components/signin/core/browser/signin_manager.h" 83 #include "components/signin/core/browser/signin_manager.h"
83 #include "components/user_manager/user.h" 84 #include "components/user_manager/user.h"
84 #include "components/user_manager/user_manager.h" 85 #include "components/user_manager/user_manager.h"
85 #include "content/public/browser/browser_thread.h" 86 #include "content/public/browser/browser_thread.h"
86 #include "content/public/browser/notification_service.h" 87 #include "content/public/browser/notification_service.h"
87 #include "google_apis/gaia/gaia_auth_consumer.h" 88 #include "google_apis/gaia/gaia_auth_consumer.h"
88 #include "net/base/network_change_notifier.h" 89 #include "net/base/network_change_notifier.h"
89 #include "net/url_request/url_request_context.h" 90 #include "net/url_request/url_request_context.h"
90 #include "net/url_request/url_request_context_getter.h" 91 #include "net/url_request/url_request_context_getter.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 bool has_active_session, 196 bool has_active_session,
196 LoginUtils::Delegate* delegate) OVERRIDE; 197 LoginUtils::Delegate* delegate) OVERRIDE;
197 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) OVERRIDE; 198 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) OVERRIDE;
198 virtual void CompleteOffTheRecordLogin(const GURL& start_url) OVERRIDE; 199 virtual void CompleteOffTheRecordLogin(const GURL& start_url) OVERRIDE;
199 virtual scoped_refptr<Authenticator> CreateAuthenticator( 200 virtual scoped_refptr<Authenticator> CreateAuthenticator(
200 AuthStatusConsumer* consumer) OVERRIDE; 201 AuthStatusConsumer* consumer) OVERRIDE;
201 virtual bool RestartToApplyPerSessionFlagsIfNeed(Profile* profile, 202 virtual bool RestartToApplyPerSessionFlagsIfNeed(Profile* profile,
202 bool early_restart) OVERRIDE; 203 bool early_restart) OVERRIDE;
203 204
204 // UserSessionManager::Delegate implementation: 205 // UserSessionManager::Delegate implementation:
205 virtual void OnProfilePrepared(Profile* profile) OVERRIDE; 206 virtual void OnProfilePrepared(Profile* profile) OVERRIDE;
206 #if defined(ENABLE_RLZ) 207 #if defined(ENABLE_RLZ)
207 virtual void OnRlzInitialized() OVERRIDE; 208 virtual void OnRlzInitialized() OVERRIDE;
208 #endif 209 #endif
209 210
210 private: 211 private:
211 void DoBrowserLaunchInternal(Profile* profile, 212 void DoBrowserLaunchInternal(Profile* profile,
212 LoginDisplayHost* login_host, 213 LoginDisplayHost* login_host,
213 bool locale_pref_checked); 214 bool locale_pref_checked);
214 215
215 static void RunCallbackOnLocaleLoaded( 216 static void RunCallbackOnLocaleLoaded(
216 const base::Closure& callback, 217 const base::Closure& callback,
217 InputEventsBlocker* input_events_blocker, 218 InputEventsBlocker* input_events_blocker,
218 const std::string& locale, 219 const std::string& locale,
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 // For guest session we ask session manager to restart Chrome with --bwsi 417 // For guest session we ask session manager to restart Chrome with --bwsi
417 // flag. We keep only some of the arguments of this process. 418 // flag. We keep only some of the arguments of this process.
418 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 419 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
419 CommandLine command_line(browser_command_line.GetProgram()); 420 CommandLine command_line(browser_command_line.GetProgram());
420 std::string cmd_line_str = 421 std::string cmd_line_str =
421 GetOffTheRecordCommandLine(start_url, 422 GetOffTheRecordCommandLine(start_url,
422 StartupUtils::IsOobeCompleted(), 423 StartupUtils::IsOobeCompleted(),
423 browser_command_line, 424 browser_command_line,
424 &command_line); 425 &command_line);
425 426
427 // This makes sure that Chrome restarts with no per-session flags. The guest
428 // profile will always have empty set of per-session flags. If this is not
429 // done and device owner has some per-session flags, when Chrome is relaunched
430 // the guest profile session flags will not match the current command line and
431 // another restart will be attempted in order to reset the user flags for the
432 // guest user.
433 DBusThreadManager::Get()->GetSessionManagerClient()->SetFlagsForUser(
434 chromeos::login::kGuestUserName,
435 CommandLine::StringVector());
436
426 RestartChrome(cmd_line_str); 437 RestartChrome(cmd_line_str);
427 } 438 }
428 439
429 scoped_refptr<Authenticator> LoginUtilsImpl::CreateAuthenticator( 440 scoped_refptr<Authenticator> LoginUtilsImpl::CreateAuthenticator(
430 AuthStatusConsumer* consumer) { 441 AuthStatusConsumer* consumer) {
431 // Screen locker needs new Authenticator instance each time. 442 // Screen locker needs new Authenticator instance each time.
432 if (ScreenLocker::default_screen_locker()) { 443 if (ScreenLocker::default_screen_locker()) {
433 if (authenticator_.get()) 444 if (authenticator_.get())
434 authenticator_->SetConsumer(NULL); 445 authenticator_->SetConsumer(NULL);
435 authenticator_ = NULL; 446 authenticator_ = NULL;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 CrosSettings* cros_settings = CrosSettings::Get(); 520 CrosSettings* cros_settings = CrosSettings::Get();
510 bool allow_new_user = false; 521 bool allow_new_user = false;
511 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 522 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
512 if (allow_new_user) 523 if (allow_new_user)
513 return true; 524 return true;
514 return cros_settings->FindEmailInList( 525 return cros_settings->FindEmailInList(
515 kAccountsPrefUsers, username, wildcard_match); 526 kAccountsPrefUsers, username, wildcard_match);
516 } 527 }
517 528
518 } // namespace chromeos 529 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698