| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/local_discovery/gcd_registration_ticket_request.h" | 5 #include "chrome/browser/local_discovery/gcd_registration_ticket_request.h" |
| 6 | 6 |
| 7 #include "chrome/browser/local_discovery/gcd_constants.h" | 7 #include "chrome/browser/local_discovery/gcd_constants.h" |
| 8 #include "chrome/common/cloud_print/cloud_print_constants.h" | 8 #include "chrome/common/cloud_print/cloud_print_constants.h" |
| 9 #include "components/cloud_devices/common/cloud_devices_urls.h" | 9 #include "components/cloud_devices/common/cloud_devices_urls.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // TODO(noamsml): Move this constant to cloud_devices component. | 32 // TODO(noamsml): Move this constant to cloud_devices component. |
| 33 *upload_type = cloud_print::kContentTypeJSON; | 33 *upload_type = cloud_print::kContentTypeJSON; |
| 34 } | 34 } |
| 35 | 35 |
| 36 net::URLFetcher::RequestType GCDRegistrationTicketRequest::GetRequestType() { | 36 net::URLFetcher::RequestType GCDRegistrationTicketRequest::GetRequestType() { |
| 37 return net::URLFetcher::POST; | 37 return net::URLFetcher::POST; |
| 38 } | 38 } |
| 39 | 39 |
| 40 void GCDRegistrationTicketRequest::OnGCDAPIFlowError( | 40 void GCDRegistrationTicketRequest::OnGCDAPIFlowError( |
| 41 GCDApiFlow::Status status) { | 41 GCDApiFlowInterface::Status status) { |
| 42 callback_.Run(std::string()); | 42 callback_.Run(std::string()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void GCDRegistrationTicketRequest::OnGCDAPIFlowComplete( | 45 void GCDRegistrationTicketRequest::OnGCDAPIFlowComplete( |
| 46 const base::DictionaryValue& value) { | 46 const base::DictionaryValue& value) { |
| 47 std::string kind; | 47 std::string kind; |
| 48 std::string id; | 48 std::string id; |
| 49 value.GetString(kGCDKeyKind, &kind); | 49 value.GetString(kGCDKeyKind, &kind); |
| 50 if (kind == kKindRegistrationTicket) | 50 if (kind == kKindRegistrationTicket) |
| 51 value.GetString(kGCDKeyId, &id); | 51 value.GetString(kGCDKeyId, &id); |
| 52 callback_.Run(id); | 52 callback_.Run(id); |
| 53 } | 53 } |
| 54 | 54 |
| 55 GURL GCDRegistrationTicketRequest::GetURL() { | 55 GURL GCDRegistrationTicketRequest::GetURL() { |
| 56 return cloud_devices::GetCloudDevicesRelativeURL("registrationTickets"); | 56 return cloud_devices::GetCloudDevicesRelativeURL("registrationTickets"); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace local_discovery | 59 } // namespace local_discovery |
| OLD | NEW |