OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cloud_print/gcp20/prototype/cloud_print_request.h" | 5 #include "cloud_print/gcp20/prototype/cloud_print_request.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 scoped_ptr<CloudPrintRequest> CloudPrintRequest::CreatePost( | 52 scoped_ptr<CloudPrintRequest> CloudPrintRequest::CreatePost( |
53 const GURL& url, | 53 const GURL& url, |
54 const std::string& content, | 54 const std::string& content, |
55 const std::string& mimetype, | 55 const std::string& mimetype, |
56 Delegate* delegate) { | 56 Delegate* delegate) { |
57 scoped_ptr<CloudPrintRequest> request( | 57 scoped_ptr<CloudPrintRequest> request( |
58 new CloudPrintRequest(url, URLFetcher::POST, delegate)); | 58 new CloudPrintRequest(url, URLFetcher::POST, delegate)); |
59 request->fetcher_->SetUploadData(mimetype, content); | 59 request->fetcher_->SetUploadData(mimetype, content); |
60 return std::move(request); | 60 return request; |
61 } | 61 } |
62 | 62 |
63 void CloudPrintRequest::Run( | 63 void CloudPrintRequest::Run( |
64 const std::string& access_token, | 64 const std::string& access_token, |
65 scoped_refptr<net::URLRequestContextGetter> context_getter) { | 65 scoped_refptr<net::URLRequestContextGetter> context_getter) { |
66 if (!access_token.empty()) | 66 if (!access_token.empty()) |
67 fetcher_->AddExtraRequestHeader(base::StringPrintf( | 67 fetcher_->AddExtraRequestHeader(base::StringPrintf( |
68 "Authorization: Bearer \"%s\"", access_token.c_str())); | 68 "Authorization: Bearer \"%s\"", access_token.c_str())); |
69 | 69 |
70 fetcher_->SetRequestContext(context_getter.get()); | 70 fetcher_->SetRequestContext(context_getter.get()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // TODO(maksymb): Add Privet |server_http_code| and |server_api| support in | 111 // TODO(maksymb): Add Privet |server_http_code| and |server_api| support in |
112 // case of server errors. | 112 // case of server errors. |
113 NOTIMPLEMENTED() << "HTTP code: " << http_code; | 113 NOTIMPLEMENTED() << "HTTP code: " << http_code; |
114 delegate_->OnFetchError("dummy", -1, http_code); // After this object can | 114 delegate_->OnFetchError("dummy", -1, http_code); // After this object can |
115 // be deleted. | 115 // be deleted. |
116 // Do *NOT* access members | 116 // Do *NOT* access members |
117 // after this call. | 117 // after this call. |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
OLD | NEW |