diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-27 20:43:10 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-27 20:43:10 +0000 |
commit | 9a386cce2066036f6e83fea9f071aad7ebbd5416 (patch) | |
tree | 137ce86141290bf8f5897d35acccf8bd5d627388 | |
parent | 66e4eb3c01053c6642804a4f8e188bd05aab4790 (diff) | |
download | chromium_src-9a386cce2066036f6e83fea9f071aad7ebbd5416.zip chromium_src-9a386cce2066036f6e83fea9f071aad7ebbd5416.tar.gz chromium_src-9a386cce2066036f6e83fea9f071aad7ebbd5416.tar.bz2 |
Revert 64114 - Second attempt to land http://codereview.chromium.org/4003006
Added mock implementation of prewarm method
TBR: nkostylev@chromium.org
BUG=chromium-os:7971
TEST=Login and examine /tmp/login-times-sent
Review URL: http://codereview.chromium.org/4133002
TBR=davemoore@chromium.org
Review URL: http://codereview.chromium.org/4186005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64140 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/boot_times_loader.cc | 2 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/existing_user_controller.cc | 1 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/login_utils.cc | 52 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/login_utils.h | 3 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/mock_authenticator.h | 3 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/wizard_controller.cc | 1 | ||||
-rw-r--r-- | chrome/browser/sessions/session_restore.cc | 4 |
7 files changed, 7 insertions, 59 deletions
diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index db9aa4b..00151b8 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -334,7 +334,7 @@ void BootTimesLoader::Observe( // and the page is reloaded. if (NetworkStateNotifier::Get()->is_connected()) { // Post difference between first tab and login success time. - AddLoginTimeMarker("LoginDone", true); + AddLoginTimeMarker("LoginDone", false); RecordCurrentStats(kChromeFirstRender); // Post chrome first render stat. registrar_.Remove(this, NotificationType::LOAD_START, diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index eb677fb..9c29a0e 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc @@ -191,7 +191,6 @@ void ExistingUserController::Init() { WmMessageListener::instance()->AddObserver(this); - LoginUtils::Get()->PrewarmAuthentication(); if (CrosLibrary::Get()->EnsureLoaded()) CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady(); } diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index 0edf124..2241b7d 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc @@ -19,7 +19,6 @@ #include "chrome/browser/browser_thread.h" #include "chrome/browser/chromeos/boot_times_loader.h" #include "chrome/browser/chromeos/cros/login_library.h" -#include "chrome/browser/chromeos/cros/network_library.h" #include "chrome/browser/chromeos/external_cookie_handler.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/chromeos/login/cookie_fetcher.h" @@ -30,7 +29,6 @@ #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/net/gaia/token_service.h" -#include "chrome/browser/net/preconnect.h" #include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/profile.h" #include "chrome/browser/profile_manager.h" @@ -38,7 +36,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/logging_chrome.h" -#include "chrome/common/net/gaia/gaia_authenticator2.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/net/url_request_context_getter.h" #include "chrome/common/pref_names.h" @@ -59,15 +56,12 @@ const char kAuthSuffix[] = "\n"; } // namespace -class LoginUtilsImpl : public LoginUtils, public NetworkLibrary::Observer { +class LoginUtilsImpl : public LoginUtils { public: LoginUtilsImpl() - : browser_launch_enabled_(true), - waiting_for_network_(false) { + : browser_launch_enabled_(true) { } - ~LoginUtilsImpl(); - // Invoked after the user has successfully logged in. This launches a browser // and does other bookkeeping after logging in. virtual void CompleteLogin( @@ -90,18 +84,9 @@ class LoginUtilsImpl : public LoginUtils, public NetworkLibrary::Observer { // Returns if browser launch enabled now or not. virtual bool IsBrowserLaunchEnabled() const; - // Warms the url used by authentication. - virtual void PrewarmAuthentication(); - - // NetworkLibrary::Observer implementation. - virtual void NetworkChanged(NetworkLibrary* obj); - - private: // Indicates if DoBrowserLaunch will actually launch the browser or not. bool browser_launch_enabled_; - // Indicates if we are registered for network notifications. - bool waiting_for_network_; DISALLOW_COPY_AND_ASSIGN(LoginUtilsImpl); }; @@ -128,14 +113,6 @@ class LoginUtilsWrapper { DISALLOW_COPY_AND_ASSIGN(LoginUtilsWrapper); }; -LoginUtilsImpl::~LoginUtilsImpl() { - if (waiting_for_network_ && - CrosLibrary::Get()->EnsureLoaded() && - CrosLibrary::Get()->GetNetworkLibrary()) { - CrosLibrary::Get()->GetNetworkLibrary()->RemoveObserver(this); - } -} - void LoginUtilsImpl::CompleteLogin( const std::string& username, const std::string& password, @@ -313,31 +290,6 @@ bool LoginUtilsImpl::IsBrowserLaunchEnabled() const { return browser_launch_enabled_; } -// If we're now connected, prewarm the auth url. -void LoginUtilsImpl::NetworkChanged(NetworkLibrary* network) { - if (network->Connected()) { - chrome_browser_net::Preconnect::PreconnectOnUIThread( - GURL(GaiaAuthenticator2::kClientLoginUrl), - chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED); - network->RemoveObserver(this); - waiting_for_network_ = false; - } -} - -void LoginUtilsImpl::PrewarmAuthentication() { - if (CrosLibrary::Get()->EnsureLoaded()) { - NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary(); - if (network->Connected()) { - chrome_browser_net::Preconnect::PreconnectOnUIThread( - GURL(GaiaAuthenticator2::kClientLoginUrl), - chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED); - } else { - network->AddObserver(this); - waiting_for_network_ = true; - } - } -} - LoginUtils* LoginUtils::Get() { return Singleton<LoginUtilsWrapper>::get()->get(); } diff --git a/chrome/browser/chromeos/login/login_utils.h b/chrome/browser/chromeos/login/login_utils.h index 26c4c50..a7c1786 100644 --- a/chrome/browser/chromeos/login/login_utils.h +++ b/chrome/browser/chromeos/login/login_utils.h @@ -56,9 +56,6 @@ class LoginUtils { // Returns if browser launch enabled now or not. virtual bool IsBrowserLaunchEnabled() const = 0; - // Prewarms the authentication network connection. - virtual void PrewarmAuthentication() = 0; - }; } // namespace chromeos diff --git a/chrome/browser/chromeos/login/mock_authenticator.h b/chrome/browser/chromeos/login/mock_authenticator.h index d58c110..6100f5c 100644 --- a/chrome/browser/chromeos/login/mock_authenticator.h +++ b/chrome/browser/chromeos/login/mock_authenticator.h @@ -136,9 +136,6 @@ class MockLoginUtils : public LoginUtils { return auth_token_; } - virtual void PrewarmAuthentication() { - } - private: std::string expected_username_; std::string expected_password_; diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index 4899525..cb2629a 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc @@ -981,7 +981,6 @@ void ShowLoginWizard(const std::string& first_screen_name, controller->Init(first_screen_name, screen_bounds); controller->Show(); - chromeos::LoginUtils::Get()->PrewarmAuthentication(); if (chromeos::CrosLibrary::Get()->EnsureLoaded()) chromeos::CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady(); diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index 48cea7f..77cf37e 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc @@ -503,6 +503,10 @@ class SessionRestoreImpl : public NotificationObserver { } void RestoreTabsToBrowser(const SessionWindow& window, Browser* browser) { +#if defined(OS_CHROMEOS) + chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( + "SessionRestore", true); +#endif DCHECK(!window.tabs.empty()); for (std::vector<SessionTab*>::const_iterator i = window.tabs.begin(); i != window.tabs.end(); ++i) { |