Chromium Code Reviews| Index: chrome/browser/extensions/webstore_data_fetcher.cc |
| diff --git a/chrome/browser/extensions/webstore_data_fetcher.cc b/chrome/browser/extensions/webstore_data_fetcher.cc |
| index c914ff374d5f8cc22053c54a6acd45b734dbdec0..2db75452da35451ba4795e4e07437030c93b8215 100644 |
| --- a/chrome/browser/extensions/webstore_data_fetcher.cc |
| +++ b/chrome/browser/extensions/webstore_data_fetcher.cc |
| @@ -37,15 +37,26 @@ WebstoreDataFetcher::WebstoreDataFetcher( |
| WebstoreDataFetcher::~WebstoreDataFetcher() {} |
| +void WebstoreDataFetcher::SetJsonPostData(std::unique_ptr<std::string> json) { |
| + json_post_data_.swap(*json); |
|
Devlin
2017/01/27 20:31:34
If we always dereference this, why pass it as a un
robertshield
2017/01/28 03:58:48
Indeed, simplified.
|
| +} |
| + |
| void WebstoreDataFetcher::Start() { |
| GURL webstore_data_url(extension_urls::GetWebstoreItemJsonDataURL(id_)); |
| - |
| + net::URLFetcher::RequestType request_type = |
| + json_post_data_.empty() ? net::URLFetcher::GET : net::URLFetcher::POST; |
| webstore_data_url_fetcher_ = |
| - net::URLFetcher::Create(webstore_data_url, net::URLFetcher::GET, this); |
| + net::URLFetcher::Create(webstore_data_url, request_type, this); |
| webstore_data_url_fetcher_->SetRequestContext(request_context_); |
| webstore_data_url_fetcher_->SetReferrer(referrer_url_.spec()); |
| webstore_data_url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
| net::LOAD_DISABLE_CACHE); |
| + |
| + if (!json_post_data_.empty()) { |
| + webstore_data_url_fetcher_->SetUploadData("application/json", |
| + json_post_data_); |
| + } |
| + |
| if (max_auto_retries_ > 0) { |
| webstore_data_url_fetcher_->SetMaxRetriesOn5xx(max_auto_retries_); |
| webstore_data_url_fetcher_->SetAutomaticallyRetryOnNetworkChanges( |