| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/login/client_login_response_handler.h" | 9 #include "chrome/browser/chromeos/login/client_login_response_handler.h" |
| 10 #include "chrome/browser/chromeos/login/issue_response_handler.h" | 10 #include "chrome/browser/chromeos/login/issue_response_handler.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 issue_handler_(i_handler) { | 34 issue_handler_(i_handler) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 CookieFetcher::~CookieFetcher() {} | 37 CookieFetcher::~CookieFetcher() {} |
| 38 | 38 |
| 39 void CookieFetcher::AttemptFetch(const std::string& credentials) { | 39 void CookieFetcher::AttemptFetch(const std::string& credentials) { |
| 40 VLOG(1) << "Getting auth token..."; | 40 VLOG(1) << "Getting auth token..."; |
| 41 fetcher_.reset(client_login_handler_->Handle(credentials, this)); | 41 fetcher_.reset(client_login_handler_->Handle(credentials, this)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void CookieFetcher::OnURLFetchComplete(const URLFetcher* source) { | 44 void CookieFetcher:: |
| 45 if (source->status().is_success() && | 45 OnURLFetchComplete(const content::URLFetcher* source) { |
| 46 source->response_code() == kHttpSuccess) { | 46 if (source->GetStatus().is_success() && |
| 47 if (issue_handler_->CanHandle(source->url())) { | 47 source->GetResponseCode() == kHttpSuccess) { |
| 48 if (issue_handler_->CanHandle(source->GetUrl())) { |
| 48 VLOG(1) << "Handling auth token"; | 49 VLOG(1) << "Handling auth token"; |
| 49 std::string data; | 50 std::string data; |
| 50 source->GetResponseAsString(&data); | 51 source->GetResponseAsString(&data); |
| 51 fetcher_.reset(issue_handler_->Handle(data, this)); | 52 fetcher_.reset(issue_handler_->Handle(data, this)); |
| 52 return; | 53 return; |
| 53 } | 54 } |
| 54 } | 55 } |
| 55 delete this; | 56 delete this; |
| 56 } | 57 } |
| 57 | 58 |
| 58 } // namespace chromeos | 59 } // namespace chromeos |
| OLD | NEW |