| OLD | NEW |
| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/lock.h" | 10 #include "base/lock.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/chromeos/login/cookie_fetcher.h" | 22 #include "chrome/browser/chromeos/login/cookie_fetcher.h" |
| 23 #include "chrome/browser/chromeos/login/google_authenticator.h" | 23 #include "chrome/browser/chromeos/login/google_authenticator.h" |
| 24 #include "chrome/browser/chromeos/login/user_image_downloader.h" | 24 #include "chrome/browser/chromeos/login/user_image_downloader.h" |
| 25 #include "chrome/browser/chromeos/login/user_manager.h" | 25 #include "chrome/browser/chromeos/login/user_manager.h" |
| 26 #include "chrome/browser/net/gaia/token_service.h" | 26 #include "chrome/browser/net/gaia/token_service.h" |
| 27 #include "chrome/browser/profile.h" | 27 #include "chrome/browser/profile.h" |
| 28 #include "chrome/browser/profile_manager.h" | 28 #include "chrome/browser/profile_manager.h" |
| 29 #include "chrome/common/logging_chrome.h" | 29 #include "chrome/common/logging_chrome.h" |
| 30 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/common/net/gaia/gaia_constants.h" |
| 32 #include "chrome/common/net/url_request_context_getter.h" | 33 #include "chrome/common/net/url_request_context_getter.h" |
| 33 #include "chrome/common/notification_observer.h" | 34 #include "chrome/common/notification_observer.h" |
| 34 #include "chrome/common/notification_registrar.h" | 35 #include "chrome/common/notification_registrar.h" |
| 35 #include "chrome/common/notification_service.h" | 36 #include "chrome/common/notification_service.h" |
| 36 #include "chrome/common/notification_type.h" | 37 #include "chrome/common/notification_type.h" |
| 37 #include "googleurl/src/gurl.h" | 38 #include "googleurl/src/gurl.h" |
| 38 #include "net/base/cookie_store.h" | 39 #include "net/base/cookie_store.h" |
| 39 #include "net/url_request/url_request_context.h" | 40 #include "net/url_request/url_request_context.h" |
| 40 #include "views/widget/widget_gtk.h" | 41 #include "views/widget/widget_gtk.h" |
| 41 | 42 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // The default profile will have been changed because the ProfileManager | 148 // The default profile will have been changed because the ProfileManager |
| 148 // will process the notification that the UserManager sends out. | 149 // will process the notification that the UserManager sends out. |
| 149 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); | 150 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); |
| 150 | 151 |
| 151 logging::RedirectChromeLogging( | 152 logging::RedirectChromeLogging( |
| 152 user_data_dir.Append(profile_manager->GetCurrentProfileDir()), | 153 user_data_dir.Append(profile_manager->GetCurrentProfileDir()), |
| 153 *(CommandLine::ForCurrentProcess()), | 154 *(CommandLine::ForCurrentProcess()), |
| 154 logging::DELETE_OLD_LOG_FILE); | 155 logging::DELETE_OLD_LOG_FILE); |
| 155 | 156 |
| 156 // Supply credentials for sync and others to use | 157 // Supply credentials for sync and others to use |
| 157 profile->GetTokenService()->SetClientLoginResult(credentials); | 158 profile->GetTokenService()->Initialize(GaiaConstants::kChromeOSSource, |
| 159 profile->GetRequestContext(), |
| 160 credentials); |
| 158 | 161 |
| 159 // Take the credentials passed in and try to exchange them for | 162 // Take the credentials passed in and try to exchange them for |
| 160 // full-fledged Google authentication cookies. This is | 163 // full-fledged Google authentication cookies. This is |
| 161 // best-effort; it's possible that we'll fail due to network | 164 // best-effort; it's possible that we'll fail due to network |
| 162 // troubles or some such. Either way, |cf| will call | 165 // troubles or some such. Either way, |cf| will call |
| 163 // DoBrowserLaunch on the UI thread when it's done, and then | 166 // DoBrowserLaunch on the UI thread when it's done, and then |
| 164 // delete itself. | 167 // delete itself. |
| 165 CookieFetcher* cf = new CookieFetcher(profile); | 168 CookieFetcher* cf = new CookieFetcher(profile); |
| 166 cf->AttemptFetch(credentials.data); | 169 cf->AttemptFetch(credentials.data); |
| 167 auth_token_ = credentials.token; | 170 auth_token_ = credentials.token; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 if (start == std::string::npos) | 245 if (start == std::string::npos) |
| 243 return std::string(); | 246 return std::string(); |
| 244 start += param_prefix.size(); | 247 start += param_prefix.size(); |
| 245 size_t end = credentials.find(param_suffix, start); | 248 size_t end = credentials.find(param_suffix, start); |
| 246 if (end == std::string::npos) | 249 if (end == std::string::npos) |
| 247 return std::string(); | 250 return std::string(); |
| 248 return credentials.substr(start, end - start); | 251 return credentials.substr(start, end - start); |
| 249 } | 252 } |
| 250 | 253 |
| 251 } // namespace chromeos | 254 } // namespace chromeos |
| OLD | NEW |