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

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

Issue 6027012: Fix so that login errors are shown from login/oobe screens.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/lock.h" 12 #include "base/lock.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
15 #include "base/singleton.h" 15 #include "base/singleton.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/stringprintf.h" 17 #include "base/stringprintf.h"
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/browser_thread.h" 21 #include "chrome/browser/browser_thread.h"
22 #include "chrome/browser/chromeos/boot_times_loader.h" 22 #include "chrome/browser/chromeos/boot_times_loader.h"
23 #include "chrome/browser/chromeos/cros/login_library.h" 23 #include "chrome/browser/chromeos/cros/login_library.h"
24 #include "chrome/browser/chromeos/cros/network_library.h" 24 #include "chrome/browser/chromeos/cros/network_library.h"
25 #include "chrome/browser/chromeos/input_method/input_method_util.h" 25 #include "chrome/browser/chromeos/input_method/input_method_util.h"
26 #include "chrome/browser/chromeos/login/background_view.h"
26 #include "chrome/browser/chromeos/login/cookie_fetcher.h" 27 #include "chrome/browser/chromeos/login/cookie_fetcher.h"
27 #include "chrome/browser/chromeos/login/google_authenticator.h" 28 #include "chrome/browser/chromeos/login/google_authenticator.h"
28 #include "chrome/browser/chromeos/login/language_switch_menu.h" 29 #include "chrome/browser/chromeos/login/language_switch_menu.h"
29 #include "chrome/browser/chromeos/login/ownership_service.h" 30 #include "chrome/browser/chromeos/login/ownership_service.h"
30 #include "chrome/browser/chromeos/login/parallel_authenticator.h" 31 #include "chrome/browser/chromeos/login/parallel_authenticator.h"
31 #include "chrome/browser/chromeos/login/user_image_downloader.h" 32 #include "chrome/browser/chromeos/login/user_image_downloader.h"
32 #include "chrome/browser/chromeos/login/user_manager.h" 33 #include "chrome/browser/chromeos/login/user_manager.h"
33 #include "chrome/browser/chromeos/proxy_config_service.h" 34 #include "chrome/browser/chromeos/proxy_config_service.h"
34 #include "chrome/browser/extensions/extension_service.h" 35 #include "chrome/browser/extensions/extension_service.h"
35 #include "chrome/browser/net/chrome_url_request_context.h" 36 #include "chrome/browser/net/chrome_url_request_context.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 scoped_ptr<net::ProxyConfigService> proxy_config_service_; 93 scoped_ptr<net::ProxyConfigService> proxy_config_service_;
93 94
94 DISALLOW_COPY_AND_ASSIGN(ResetDefaultProxyConfigServiceTask); 95 DISALLOW_COPY_AND_ASSIGN(ResetDefaultProxyConfigServiceTask);
95 }; 96 };
96 97
97 } // namespace 98 } // namespace
98 99
99 class LoginUtilsImpl : public LoginUtils { 100 class LoginUtilsImpl : public LoginUtils {
100 public: 101 public:
101 LoginUtilsImpl() 102 LoginUtilsImpl()
102 : browser_launch_enabled_(true) { 103 : browser_launch_enabled_(true),
104 background_view_(NULL) {
103 } 105 }
104 106
105 // Invoked after the user has successfully logged in. This launches a browser 107 // Invoked after the user has successfully logged in. This launches a browser
106 // and does other bookkeeping after logging in. 108 // and does other bookkeeping after logging in.
107 virtual void CompleteLogin( 109 virtual void CompleteLogin(
108 const std::string& username, 110 const std::string& username,
109 const std::string& password, 111 const std::string& password,
110 const GaiaAuthConsumer::ClientLoginResult& credentials, 112 const GaiaAuthConsumer::ClientLoginResult& credentials,
111 bool pending_requests); 113 bool pending_requests);
112 114
(...skipping 23 matching lines...) Expand all
136 // full-fledged Google authentication cookies. 138 // full-fledged Google authentication cookies.
137 virtual void FetchCookies( 139 virtual void FetchCookies(
138 Profile* profile, 140 Profile* profile,
139 const GaiaAuthConsumer::ClientLoginResult& credentials); 141 const GaiaAuthConsumer::ClientLoginResult& credentials);
140 142
141 // Supply credentials for sync and others to use. 143 // Supply credentials for sync and others to use.
142 virtual void FetchTokens( 144 virtual void FetchTokens(
143 Profile* profile, 145 Profile* profile,
144 const GaiaAuthConsumer::ClientLoginResult& credentials); 146 const GaiaAuthConsumer::ClientLoginResult& credentials);
145 147
148 // Sets the current background view.
149 virtual void SetBackgroundView(chromeos::BackgroundView* background_view);
150
151 // Gets the current background view.
152 virtual chromeos::BackgroundView* GetBackgroundView();
153
146 private: 154 private:
147 // Check user's profile for kApplicationLocale setting. 155 // Check user's profile for kApplicationLocale setting.
148 void RespectLocalePreference(PrefService* pref); 156 void RespectLocalePreference(PrefService* pref);
149 157
150 // Indicates if DoBrowserLaunch will actually launch the browser or not. 158 // Indicates if DoBrowserLaunch will actually launch the browser or not.
151 bool browser_launch_enabled_; 159 bool browser_launch_enabled_;
152 160
161 // The current background view.
162 chromeos::BackgroundView* background_view_;
163
153 DISALLOW_COPY_AND_ASSIGN(LoginUtilsImpl); 164 DISALLOW_COPY_AND_ASSIGN(LoginUtilsImpl);
154 }; 165 };
155 166
156 class LoginUtilsWrapper { 167 class LoginUtilsWrapper {
157 public: 168 public:
158 static LoginUtilsWrapper* GetInstance() { 169 static LoginUtilsWrapper* GetInstance() {
159 return Singleton<LoginUtilsWrapper>::get(); 170 return Singleton<LoginUtilsWrapper>::get();
160 } 171 }
161 172
162 LoginUtils* get() { 173 LoginUtils* get() {
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 chrome_browser_net::Preconnect::PreconnectOnUIThread( 508 chrome_browser_net::Preconnect::PreconnectOnUIThread(
498 GURL(GaiaAuthFetcher::kClientLoginUrl), 509 GURL(GaiaAuthFetcher::kClientLoginUrl),
499 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED, 510 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED,
500 kConnectionsNeeded); 511 kConnectionsNeeded);
501 } else { 512 } else {
502 new WarmingObserver(); 513 new WarmingObserver();
503 } 514 }
504 } 515 }
505 } 516 }
506 517
518 void LoginUtilsImpl::SetBackgroundView(BackgroundView* background_view) {
519 background_view_ = background_view;
520 }
521
522 BackgroundView* LoginUtilsImpl::GetBackgroundView() {
523 return background_view_;
524 }
525
507 LoginUtils* LoginUtils::Get() { 526 LoginUtils* LoginUtils::Get() {
508 return LoginUtilsWrapper::GetInstance()->get(); 527 return LoginUtilsWrapper::GetInstance()->get();
509 } 528 }
510 529
511 void LoginUtils::Set(LoginUtils* mock) { 530 void LoginUtils::Set(LoginUtils* mock) {
512 LoginUtilsWrapper::GetInstance()->reset(mock); 531 LoginUtilsWrapper::GetInstance()->reset(mock);
513 } 532 }
514 533
515 void LoginUtils::DoBrowserLaunch(Profile* profile) { 534 void LoginUtils::DoBrowserLaunch(Profile* profile) {
516 BootTimesLoader::Get()->AddLoginTimeMarker("BrowserLaunched", false); 535 BootTimesLoader::Get()->AddLoginTimeMarker("BrowserLaunched", false);
517 // Browser launch was disabled due to some post login screen. 536 // Browser launch was disabled due to some post login screen.
518 if (!LoginUtils::Get()->IsBrowserLaunchEnabled()) 537 if (!LoginUtils::Get()->IsBrowserLaunchEnabled())
519 return; 538 return;
520 539
521 // Update command line in case loose values were added. 540 // Update command line in case loose values were added.
522 CommandLine::ForCurrentProcess()->InitFromArgv( 541 CommandLine::ForCurrentProcess()->InitFromArgv(
523 CommandLine::ForCurrentProcess()->argv()); 542 CommandLine::ForCurrentProcess()->argv());
524 543
525 VLOG(1) << "Launching browser..."; 544 VLOG(1) << "Launching browser...";
526 BrowserInit browser_init; 545 BrowserInit browser_init;
527 int return_code; 546 int return_code;
528 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), 547 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(),
529 profile, 548 profile,
530 FilePath(), 549 FilePath(),
531 true, 550 true,
532 &return_code); 551 &return_code);
533 } 552 }
534 553
535 } // namespace chromeos 554 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698