| 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 "components/password_manager/core/browser/affiliation_fetcher.h" |    5 #include "components/password_manager/core/browser/affiliation_fetcher.h" | 
|    6  |    6  | 
|    7 #include "components/password_manager/core/browser/affiliation_api.pb.h" |    7 #include "components/password_manager/core/browser/affiliation_api.pb.h" | 
|    8 #include "components/password_manager/core/browser/affiliation_utils.h" |    8 #include "components/password_manager/core/browser/affiliation_utils.h" | 
|    9 #include "google_apis/google_api_keys.h" |    9 #include "google_apis/google_api_keys.h" | 
|   10 #include "net/base/load_flags.h" |   10 #include "net/base/load_flags.h" | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   42 void AffiliationFetcher::StartRequest() { |   42 void AffiliationFetcher::StartRequest() { | 
|   43   DCHECK(!fetcher_); |   43   DCHECK(!fetcher_); | 
|   44  |   44  | 
|   45   fetcher_.reset( |   45   fetcher_.reset( | 
|   46       net::URLFetcher::Create(BuildQueryURL(), net::URLFetcher::POST, this)); |   46       net::URLFetcher::Create(BuildQueryURL(), net::URLFetcher::POST, this)); | 
|   47   fetcher_->SetRequestContext(request_context_getter_.get()); |   47   fetcher_->SetRequestContext(request_context_getter_.get()); | 
|   48   fetcher_->SetUploadData("application/x-protobuf", PreparePayload()); |   48   fetcher_->SetUploadData("application/x-protobuf", PreparePayload()); | 
|   49   fetcher_->SetLoadFlags( |   49   fetcher_->SetLoadFlags( | 
|   50       net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES | |   50       net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES | | 
|   51       net::LOAD_DO_NOT_SEND_AUTH_DATA | net::LOAD_BYPASS_CACHE | |   51       net::LOAD_DO_NOT_SEND_AUTH_DATA | net::LOAD_BYPASS_CACHE | | 
|   52       net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_PROMPT_FOR_LOGIN); |   52       net::LOAD_DISABLE_CACHE); | 
|   53   fetcher_->SetAutomaticallyRetryOn5xx(false); |   53   fetcher_->SetAutomaticallyRetryOn5xx(false); | 
|   54   fetcher_->SetAutomaticallyRetryOnNetworkChanges(0); |   54   fetcher_->SetAutomaticallyRetryOnNetworkChanges(0); | 
|   55   fetcher_->Start(); |   55   fetcher_->Start(); | 
|   56 } |   56 } | 
|   57  |   57  | 
|   58 GURL AffiliationFetcher::BuildQueryURL() const { |   58 GURL AffiliationFetcher::BuildQueryURL() const { | 
|   59   return net::AppendQueryParameter( |   59   return net::AppendQueryParameter( | 
|   60       GURL("https://www.googleapis.com/affiliation/v1/affiliation:lookup"), |   60       GURL("https://www.googleapis.com/affiliation/v1/affiliation:lookup"), | 
|   61       "key", google_apis::GetAPIKey()); |   61       "key", google_apis::GetAPIKey()); | 
|   62 } |   62 } | 
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  155     if (ParseResponse(result.get())) |  155     if (ParseResponse(result.get())) | 
|  156       delegate_->OnFetchSucceeded(result.Pass()); |  156       delegate_->OnFetchSucceeded(result.Pass()); | 
|  157     else |  157     else | 
|  158       delegate_->OnMalformedResponse(); |  158       delegate_->OnMalformedResponse(); | 
|  159   } else { |  159   } else { | 
|  160     delegate_->OnFetchFailed(); |  160     delegate_->OnFetchFailed(); | 
|  161   } |  161   } | 
|  162 } |  162 } | 
|  163  |  163  | 
|  164 }  // namespace password_manager |  164 }  // namespace password_manager | 
| OLD | NEW |