| 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/cookie_fetcher.h" | 5 #include "chrome/browser/chromeos/login/cookie_fetcher.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/login/client_login_response_handler.h" | 10 #include "chrome/browser/chromeos/login/client_login_response_handler.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 CookieFetcher::CookieFetcher(Profile* profile) : profile_(profile) { | 22 CookieFetcher::CookieFetcher(Profile* profile) : profile_(profile) { |
| 23 CHECK(profile_); | 23 CHECK(profile_); |
| 24 client_login_handler_.reset( | 24 client_login_handler_.reset( |
| 25 new ClientLoginResponseHandler(profile_->GetRequestContext())); | 25 new ClientLoginResponseHandler(profile_->GetRequestContext())); |
| 26 issue_handler_.reset( | 26 issue_handler_.reset( |
| 27 new IssueResponseHandler(profile_->GetRequestContext())); | 27 new IssueResponseHandler(profile_->GetRequestContext())); |
| 28 launcher_.reset(new DelegateImpl); | 28 launcher_.reset(new DelegateImpl); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void CookieFetcher::AttemptFetch(const std::string& credentials) { | 31 void CookieFetcher::AttemptFetch(const std::string& credentials) { |
| 32 LOG(INFO) << "getting auth token..."; | 32 VLOG(1) << "Getting auth token..."; |
| 33 fetcher_.reset(client_login_handler_->Handle(credentials, this)); | 33 fetcher_.reset(client_login_handler_->Handle(credentials, this)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void CookieFetcher::OnURLFetchComplete(const URLFetcher* source, | 36 void CookieFetcher::OnURLFetchComplete(const URLFetcher* source, |
| 37 const GURL& url, | 37 const GURL& url, |
| 38 const URLRequestStatus& status, | 38 const URLRequestStatus& status, |
| 39 int response_code, | 39 int response_code, |
| 40 const ResponseCookies& cookies, | 40 const ResponseCookies& cookies, |
| 41 const std::string& data) { | 41 const std::string& data) { |
| 42 if (status.is_success() && response_code == kHttpSuccess) { | 42 if (status.is_success() && response_code == kHttpSuccess) { |
| 43 if (issue_handler_->CanHandle(url)) { | 43 if (issue_handler_->CanHandle(url)) { |
| 44 LOG(INFO) << "Handling auth token"; | 44 VLOG(1) << "Handling auth token"; |
| 45 fetcher_.reset(issue_handler_->Handle(data, this)); | 45 fetcher_.reset(issue_handler_->Handle(data, this)); |
| 46 return; | 46 return; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 LOG(INFO) << "Calling DoLaunch"; | 49 VLOG(1) << "Calling DoLaunch"; |
| 50 launcher_->DoLaunch(profile_); | 50 launcher_->DoLaunch(profile_); |
| 51 delete this; | 51 delete this; |
| 52 } | 52 } |
| 53 | 53 |
| 54 void CookieFetcher::DelegateImpl::DoLaunch(Profile* profile) { | 54 void CookieFetcher::DelegateImpl::DoLaunch(Profile* profile) { |
| 55 if (profile == ProfileManager::GetDefaultProfile()) { | 55 if (profile == ProfileManager::GetDefaultProfile()) { |
| 56 LoginUtils::DoBrowserLaunch(profile); | 56 LoginUtils::DoBrowserLaunch(profile); |
| 57 } else { | 57 } else { |
| 58 LOG(ERROR) << | 58 LOG(ERROR) << |
| 59 "Profile has changed since we started populating it with cookies"; | 59 "Profile has changed since we started populating it with cookies"; |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace chromeos | 63 } // namespace chromeos |
| OLD | NEW |