| 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 "chrome/browser/extensions/webstore_data_fetcher.h" | 5 #include "chrome/browser/extensions/webstore_data_fetcher.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 if (max_auto_retries_ > 0) { | 49 if (max_auto_retries_ > 0) { |
| 50 webstore_data_url_fetcher_->SetMaxRetriesOn5xx(max_auto_retries_); | 50 webstore_data_url_fetcher_->SetMaxRetriesOn5xx(max_auto_retries_); |
| 51 webstore_data_url_fetcher_->SetAutomaticallyRetryOnNetworkChanges( | 51 webstore_data_url_fetcher_->SetAutomaticallyRetryOnNetworkChanges( |
| 52 max_auto_retries_); | 52 max_auto_retries_); |
| 53 } | 53 } |
| 54 webstore_data_url_fetcher_->Start(); | 54 webstore_data_url_fetcher_->Start(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void WebstoreDataFetcher::OnJsonParseSuccess( | 57 void WebstoreDataFetcher::OnJsonParseSuccess( |
| 58 std::unique_ptr<base::Value> parsed_json) { | 58 std::unique_ptr<base::Value> parsed_json) { |
| 59 if (!parsed_json->IsType(base::Value::TYPE_DICTIONARY)) { | 59 if (!parsed_json->IsType(base::Value::Type::DICTIONARY)) { |
| 60 OnJsonParseFailure(kInvalidWebstoreResponseError); | 60 OnJsonParseFailure(kInvalidWebstoreResponseError); |
| 61 return; | 61 return; |
| 62 } | 62 } |
| 63 | 63 |
| 64 delegate_->OnWebstoreResponseParseSuccess( | 64 delegate_->OnWebstoreResponseParseSuccess( |
| 65 std::unique_ptr<base::DictionaryValue>( | 65 std::unique_ptr<base::DictionaryValue>( |
| 66 static_cast<base::DictionaryValue*>(parsed_json.release()))); | 66 static_cast<base::DictionaryValue*>(parsed_json.release()))); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void WebstoreDataFetcher::OnJsonParseFailure( | 69 void WebstoreDataFetcher::OnJsonParseFailure( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 87 fetcher->GetResponseAsString(&webstore_json_data); | 87 fetcher->GetResponseAsString(&webstore_json_data); |
| 88 | 88 |
| 89 // The parser will call us back via one of the callbacks. | 89 // The parser will call us back via one of the callbacks. |
| 90 safe_json::SafeJsonParser::Parse( | 90 safe_json::SafeJsonParser::Parse( |
| 91 webstore_json_data, | 91 webstore_json_data, |
| 92 base::Bind(&WebstoreDataFetcher::OnJsonParseSuccess, AsWeakPtr()), | 92 base::Bind(&WebstoreDataFetcher::OnJsonParseSuccess, AsWeakPtr()), |
| 93 base::Bind(&WebstoreDataFetcher::OnJsonParseFailure, AsWeakPtr())); | 93 base::Bind(&WebstoreDataFetcher::OnJsonParseFailure, AsWeakPtr())); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace extensions | 96 } // namespace extensions |
| OLD | NEW |