| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/service/cloud_print/cloud_print_wipeout.h" | 5 #include "chrome/service/cloud_print/cloud_print_wipeout.h" |
| 6 | 6 |
| 7 #include "chrome/common/cloud_print/cloud_print_constants.h" | 7 #include "chrome/common/cloud_print/cloud_print_constants.h" |
| 8 #include "chrome/common/cloud_print/cloud_print_helpers.h" | 8 #include "chrome/common/cloud_print/cloud_print_helpers.h" |
| 9 | 9 |
| 10 const int kMaxWipeoutAttempts = 3; | 10 const int kMaxWipeoutAttempts = 3; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 client_->OnUnregisterPrintersComplete(); | 31 client_->OnUnregisterPrintersComplete(); |
| 32 return; | 32 return; |
| 33 } | 33 } |
| 34 | 34 |
| 35 std::string printer_id = printer_ids_.front(); | 35 std::string printer_id = printer_ids_.front(); |
| 36 printer_ids_.pop_front(); | 36 printer_ids_.pop_front(); |
| 37 | 37 |
| 38 GURL url = GetUrlForPrinterDelete(cloud_print_server_url_, | 38 GURL url = GetUrlForPrinterDelete(cloud_print_server_url_, |
| 39 printer_id, | 39 printer_id, |
| 40 "connector_disabled"); | 40 "connector_disabled"); |
| 41 request_ = new CloudPrintURLFetcher; | 41 request_ = CloudPrintURLFetcher::Create(); |
| 42 request_->StartGetRequest(url, this, kMaxWipeoutAttempts, std::string()); | 42 request_->StartGetRequest(url, this, kMaxWipeoutAttempts, std::string()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 CloudPrintURLFetcher::ResponseAction CloudPrintWipeout::HandleJSONData( | 45 CloudPrintURLFetcher::ResponseAction CloudPrintWipeout::HandleJSONData( |
| 46 const net::URLFetcher* source, | 46 const net::URLFetcher* source, |
| 47 const GURL& url, | 47 const GURL& url, |
| 48 base::DictionaryValue* json_data, | 48 base::DictionaryValue* json_data, |
| 49 bool succeeded) { | 49 bool succeeded) { |
| 50 // We don't care if delete was sucessful or not here. | 50 // We don't care if delete was sucessful or not here. |
| 51 UnregisterNextPrinter(); | 51 UnregisterNextPrinter(); |
| 52 return CloudPrintURLFetcher::STOP_PROCESSING; | 52 return CloudPrintURLFetcher::STOP_PROCESSING; |
| 53 } | 53 } |
| 54 | 54 |
| 55 void CloudPrintWipeout::OnRequestGiveUp() { | 55 void CloudPrintWipeout::OnRequestGiveUp() { |
| 56 UnregisterNextPrinter(); | 56 UnregisterNextPrinter(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 CloudPrintURLFetcher::ResponseAction CloudPrintWipeout::OnRequestAuthError() { | 59 CloudPrintURLFetcher::ResponseAction CloudPrintWipeout::OnRequestAuthError() { |
| 60 // We can't recover from auth rrror. Report complition to stop service. | 60 // We can't recover from auth rrror. Report complition to stop service. |
| 61 client_->OnUnregisterPrintersComplete(); | 61 client_->OnUnregisterPrintersComplete(); |
| 62 return CloudPrintURLFetcher::STOP_PROCESSING; | 62 return CloudPrintURLFetcher::STOP_PROCESSING; |
| 63 } | 63 } |
| 64 | 64 |
| 65 std::string CloudPrintWipeout::GetAuthHeader() { | 65 std::string CloudPrintWipeout::GetAuthHeader() { |
| 66 return GetCloudPrintAuthHeader(auth_token_); | 66 return GetCloudPrintAuthHeader(auth_token_); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace cloud_print | 69 } // namespace cloud_print |
| OLD | NEW |