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_api_flow_impl.h" | 5 #include "chrome/browser/local_discovery/gcd_api_flow_impl.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 void GCDApiFlowImpl::OnGetTokenFailure( | 57 void GCDApiFlowImpl::OnGetTokenFailure( |
58 const OAuth2TokenService::Request* request, | 58 const OAuth2TokenService::Request* request, |
59 const GoogleServiceAuthError& error) { | 59 const GoogleServiceAuthError& error) { |
60 request_->OnGCDAPIFlowError(ERROR_TOKEN); | 60 request_->OnGCDAPIFlowError(ERROR_TOKEN); |
61 } | 61 } |
62 | 62 |
63 void GCDApiFlowImpl::CreateRequest(const GURL& url) { | 63 void GCDApiFlowImpl::CreateRequest(const GURL& url) { |
64 net::URLFetcher::RequestType request_type = request_->GetRequestType(); | 64 net::URLFetcher::RequestType request_type = request_->GetRequestType(); |
65 | 65 |
66 url_fetcher_.reset(net::URLFetcher::Create(url, request_type, this)); | 66 url_fetcher_ = net::URLFetcher::Create(url, request_type, this); |
67 | 67 |
68 if (request_type != net::URLFetcher::GET) { | 68 if (request_type != net::URLFetcher::GET) { |
69 std::string upload_type; | 69 std::string upload_type; |
70 std::string upload_data; | 70 std::string upload_data; |
71 request_->GetUploadData(&upload_type, &upload_data); | 71 request_->GetUploadData(&upload_type, &upload_data); |
72 url_fetcher_->SetUploadData(upload_type, upload_data); | 72 url_fetcher_->SetUploadData(upload_type, upload_data); |
73 } | 73 } |
74 | 74 |
75 url_fetcher_->SetRequestContext(request_context_.get()); | 75 url_fetcher_->SetRequestContext(request_context_.get()); |
76 | 76 |
(...skipping 26 matching lines...) Expand all Loading... |
103 | 103 |
104 if (!value || !value->GetAsDictionary(&dictionary_value)) { | 104 if (!value || !value->GetAsDictionary(&dictionary_value)) { |
105 request_->OnGCDAPIFlowError(ERROR_MALFORMED_RESPONSE); | 105 request_->OnGCDAPIFlowError(ERROR_MALFORMED_RESPONSE); |
106 return; | 106 return; |
107 } | 107 } |
108 | 108 |
109 request_->OnGCDAPIFlowComplete(*dictionary_value); | 109 request_->OnGCDAPIFlowComplete(*dictionary_value); |
110 } | 110 } |
111 | 111 |
112 } // namespace local_discovery | 112 } // namespace local_discovery |
OLD | NEW |