diff options
-rw-r--r-- | chrome/browser/browser_init.cc | 3 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/owner_manager.cc | 9 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/user_manager.cc | 9 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/user_manager.h | 9 | ||||
-rw-r--r-- | chrome/browser/defaults.cc | 2 | ||||
-rw-r--r-- | chrome/browser/defaults.h | 3 |
6 files changed, 33 insertions, 2 deletions
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index f28029f..7c1712d 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -684,7 +684,8 @@ bool BrowserInit::LaunchWithProfile::ProcessStartupURLs( return false; } - if (pref.type == SessionStartupPref::LAST) { + if (!browser_defaults::skip_restore && + pref.type == SessionStartupPref::LAST) { if (!profile_->DidLastSessionExitCleanly() && !command_line_.HasSwitch(switches::kRestoreLastSession)) { // The last session crashed. It's possible automatically loading the diff --git a/chrome/browser/chromeos/login/owner_manager.cc b/chrome/browser/chromeos/login/owner_manager.cc index b2715f3..71b15a8 100644 --- a/chrome/browser/chromeos/login/owner_manager.cc +++ b/chrome/browser/chromeos/login/owner_manager.cc @@ -11,6 +11,7 @@ #include "base/file_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_thread.h" +#include "chrome/browser/chromeos/boot_times_loader.h" #include "chrome/browser/chromeos/login/signed_settings_temp_storage.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" @@ -26,6 +27,7 @@ OwnerManager::OwnerManager() OwnerManager::~OwnerManager() {} void OwnerManager::LoadOwnerKey() { + BootTimesLoader::Get()->AddLoginTimeMarker("LoadOwnerKeyStart", false); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); VLOG(1) << "Loading owner key"; NotificationType result = NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED; @@ -81,6 +83,7 @@ void OwnerManager::ExportKey() { NotificationType::OWNER_KEY_FETCH_ATTEMPT_FAILED, NotificationService::NoDetails())); } + BootTimesLoader::Get()->AddLoginTimeMarker("ExportKeyEnd", false); } void OwnerManager::OnComplete(bool value) { @@ -126,6 +129,7 @@ bool OwnerManager::EnsurePrivateKey() { void OwnerManager::Sign(const BrowserThread::ID thread_id, const std::string& data, Delegate* d) { + BootTimesLoader::Get()->AddLoginTimeMarker("SignStart", false); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); // If it's not the case that we can get both keys... @@ -135,6 +139,7 @@ void OwnerManager::Sign(const BrowserThread::ID thread_id, NewRunnableMethod(this, &OwnerManager::CallDelegate, d, KEY_UNAVAILABLE, std::vector<uint8>())); + BootTimesLoader::Get()->AddLoginTimeMarker("SignEnd", false); return; } @@ -150,12 +155,14 @@ void OwnerManager::Sign(const BrowserThread::ID thread_id, NewRunnableMethod(this, &OwnerManager::CallDelegate, d, return_code, signature)); + BootTimesLoader::Get()->AddLoginTimeMarker("SignEnd", false); } void OwnerManager::Verify(const BrowserThread::ID thread_id, const std::string& data, const std::vector<uint8>& signature, Delegate* d) { + BootTimesLoader::Get()->AddLoginTimeMarker("VerifyStart", false); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); if (!EnsurePublicKey()) { @@ -164,6 +171,7 @@ void OwnerManager::Verify(const BrowserThread::ID thread_id, NewRunnableMethod(this, &OwnerManager::CallDelegate, d, KEY_UNAVAILABLE, std::vector<uint8>())); + BootTimesLoader::Get()->AddLoginTimeMarker("VerifyEnd", false); return; } @@ -177,6 +185,7 @@ void OwnerManager::Verify(const BrowserThread::ID thread_id, NewRunnableMethod(this, &OwnerManager::CallDelegate, d, return_code, std::vector<uint8>())); + BootTimesLoader::Get()->AddLoginTimeMarker("VerifyEnd", false); } void OwnerManager::SendNotification(NotificationType type, diff --git a/chrome/browser/chromeos/login/user_manager.cc b/chrome/browser/chromeos/login/user_manager.cc index 74aad31..1cb75fd 100644 --- a/chrome/browser/chromeos/login/user_manager.cc +++ b/chrome/browser/chromeos/login/user_manager.cc @@ -22,6 +22,7 @@ #include "chrome/browser/chromeos/cros_settings_provider_user.h" #include "chrome/browser/chromeos/login/ownership_service.h" #include "chrome/browser/chromeos/wm_ipc.h" +#include "chrome/browser/defaults.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/notification_service.h" @@ -237,6 +238,11 @@ void UserManager::UserLoggedIn(const std::string& email) { return; } + if (!IsKnownUser(email)) { + current_user_is_new_ = true; + browser_defaults::skip_restore = true; + } + // Get a copy of the current users. std::vector<User> users = GetUsers(); @@ -393,7 +399,8 @@ void UserManager::OnImageLoaded(const std::string& username, // Private constructor and destructor. Do nothing. UserManager::UserManager() : ALLOW_THIS_IN_INITIALIZER_LIST(image_loader_(new UserImageLoader(this))), - current_user_is_owner_(false) { + current_user_is_owner_(false), + current_user_is_new_(false) { registrar_.Add(this, NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, NotificationService::AllSources()); } diff --git a/chrome/browser/chromeos/login/user_manager.h b/chrome/browser/chromeos/login/user_manager.h index 01766d0..4a29614 100644 --- a/chrome/browser/chromeos/login/user_manager.h +++ b/chrome/browser/chromeos/login/user_manager.h @@ -107,6 +107,11 @@ class UserManager : public UserImageLoader::Delegate, current_user_is_owner_ = current_user_is_owner; } + // Accessor for current_user_is_new_. + bool current_user_is_new() const { + return current_user_is_new_; + } + protected: UserManager(); virtual ~UserManager(); @@ -131,6 +136,10 @@ class UserManager : public UserImageLoader::Delegate, // Cached flag of whether currently logged-in user is owner or not. bool current_user_is_owner_; + // Cached flag of whether the currently logged-in user existed before this + // login. + bool current_user_is_new_; + NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(UserManager); diff --git a/chrome/browser/defaults.cc b/chrome/browser/defaults.cc index b1c2820..4bb5288 100644 --- a/chrome/browser/defaults.cc +++ b/chrome/browser/defaults.cc @@ -84,4 +84,6 @@ const bool kBrowserAliveWithNoWindows = false; bool bookmarks_enabled = true; +bool skip_restore = false; + } // namespace browser_defaults diff --git a/chrome/browser/defaults.h b/chrome/browser/defaults.h index adc8577..b20cc12 100644 --- a/chrome/browser/defaults.h +++ b/chrome/browser/defaults.h @@ -81,6 +81,9 @@ extern const bool kShowCancelButtonInTaskManager; // Are bookmark enabled? True by default. extern bool bookmarks_enabled; +// Should we skip the user's preference for restore. False by default. +extern bool skip_restore; + } // namespace browser_defaults #endif // CHROME_BROWSER_DEFAULTS_H_ |