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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/webstore_data_fetcher_delegate.h" | 9 #include "chrome/browser/extensions/webstore_data_fetcher_delegate.h" |
10 #include "chrome/browser/safe_json_parser.h" | 10 #include "chrome/browser/safe_json_parser.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 referrer_url_(referrer_url), | 31 referrer_url_(referrer_url), |
32 id_(webstore_item_id), | 32 id_(webstore_item_id), |
33 max_auto_retries_(0) { | 33 max_auto_retries_(0) { |
34 } | 34 } |
35 | 35 |
36 WebstoreDataFetcher::~WebstoreDataFetcher() {} | 36 WebstoreDataFetcher::~WebstoreDataFetcher() {} |
37 | 37 |
38 void WebstoreDataFetcher::Start() { | 38 void WebstoreDataFetcher::Start() { |
39 GURL webstore_data_url(extension_urls::GetWebstoreItemJsonDataURL(id_)); | 39 GURL webstore_data_url(extension_urls::GetWebstoreItemJsonDataURL(id_)); |
40 | 40 |
41 webstore_data_url_fetcher_.reset(net::URLFetcher::Create( | 41 webstore_data_url_fetcher_ = |
42 webstore_data_url, net::URLFetcher::GET, this)); | 42 net::URLFetcher::Create(webstore_data_url, net::URLFetcher::GET, this); |
43 webstore_data_url_fetcher_->SetRequestContext(request_context_); | 43 webstore_data_url_fetcher_->SetRequestContext(request_context_); |
44 webstore_data_url_fetcher_->SetReferrer(referrer_url_.spec()); | 44 webstore_data_url_fetcher_->SetReferrer(referrer_url_.spec()); |
45 webstore_data_url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | | 45 webstore_data_url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
46 net::LOAD_DISABLE_CACHE); | 46 net::LOAD_DISABLE_CACHE); |
47 if (max_auto_retries_ > 0) { | 47 if (max_auto_retries_ > 0) { |
48 webstore_data_url_fetcher_->SetMaxRetriesOn5xx(max_auto_retries_); | 48 webstore_data_url_fetcher_->SetMaxRetriesOn5xx(max_auto_retries_); |
49 webstore_data_url_fetcher_->SetAutomaticallyRetryOnNetworkChanges( | 49 webstore_data_url_fetcher_->SetAutomaticallyRetryOnNetworkChanges( |
50 max_auto_retries_); | 50 max_auto_retries_); |
51 } | 51 } |
52 webstore_data_url_fetcher_->Start(); | 52 webstore_data_url_fetcher_->Start(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 new SafeJsonParser(webstore_json_data, | 86 new SafeJsonParser(webstore_json_data, |
87 base::Bind(&WebstoreDataFetcher::OnJsonParseSuccess, | 87 base::Bind(&WebstoreDataFetcher::OnJsonParseSuccess, |
88 AsWeakPtr()), | 88 AsWeakPtr()), |
89 base::Bind(&WebstoreDataFetcher::OnJsonParseFailure, | 89 base::Bind(&WebstoreDataFetcher::OnJsonParseFailure, |
90 AsWeakPtr())); | 90 AsWeakPtr())); |
91 // The parser will call us back via one of the callbacks. | 91 // The parser will call us back via one of the callbacks. |
92 parser->Start(); | 92 parser->Start(); |
93 } | 93 } |
94 | 94 |
95 } // namespace extensions | 95 } // namespace extensions |
OLD | NEW |