OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "extensions/browser/updater/extension_downloader.h" | 5 #include "extensions/browser/updater/extension_downloader.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 const base::TimeDelta& backoff_delay, | 503 const base::TimeDelta& backoff_delay, |
504 const std::string& data) { | 504 const std::string& data) { |
505 // We want to try parsing the manifest, and if it indicates updates are | 505 // We want to try parsing the manifest, and if it indicates updates are |
506 // available, we want to fire off requests to fetch those updates. | 506 // available, we want to fire off requests to fetch those updates. |
507 if (status.status() == net::URLRequestStatus::SUCCESS && | 507 if (status.status() == net::URLRequestStatus::SUCCESS && |
508 (response_code == 200 || (url.SchemeIsFile() && data.length() > 0))) { | 508 (response_code == 200 || (url.SchemeIsFile() && data.length() > 0))) { |
509 RETRY_HISTOGRAM("ManifestFetchSuccess", | 509 RETRY_HISTOGRAM("ManifestFetchSuccess", |
510 manifests_queue_.active_request_failure_count(), | 510 manifests_queue_.active_request_failure_count(), |
511 url); | 511 url); |
512 VLOG(2) << "beginning manifest parse for " << url; | 512 VLOG(2) << "beginning manifest parse for " << url; |
513 scoped_refptr<SafeManifestParser> safe_parser(new SafeManifestParser( | 513 auto callback = base::Bind( |
514 data, | 514 &ExtensionDownloader::HandleManifestResults, |
515 base::Bind( | 515 weak_ptr_factory_.GetWeakPtr(), |
516 &ExtensionDownloader::HandleManifestResults, | 516 base::Owned(manifests_queue_.reset_active_request().release())); |
517 weak_ptr_factory_.GetWeakPtr(), | 517 ParseUpdateManifest(data, callback); |
518 base::Owned(manifests_queue_.reset_active_request().release())))); | |
519 safe_parser->Start(); | |
520 } else { | 518 } else { |
521 VLOG(1) << "Failed to fetch manifest '" << url.possibly_invalid_spec() | 519 VLOG(1) << "Failed to fetch manifest '" << url.possibly_invalid_spec() |
522 << "' response code:" << response_code; | 520 << "' response code:" << response_code; |
523 if (ShouldRetryRequest(status, response_code) && | 521 if (ShouldRetryRequest(status, response_code) && |
524 manifests_queue_.active_request_failure_count() < kMaxRetries) { | 522 manifests_queue_.active_request_failure_count() < kMaxRetries) { |
525 manifests_queue_.RetryRequest(backoff_delay); | 523 manifests_queue_.RetryRequest(backoff_delay); |
526 } else { | 524 } else { |
527 RETRY_HISTOGRAM("ManifestFetchFailure", | 525 RETRY_HISTOGRAM("ManifestFetchFailure", |
528 manifests_queue_.active_request_failure_count(), | 526 manifests_queue_.active_request_failure_count(), |
529 url); | 527 url); |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 const GURL& update_url, | 950 const GURL& update_url, |
953 int request_id) { | 951 int request_id) { |
954 ManifestFetchData::PingMode ping_mode = ManifestFetchData::NO_PING; | 952 ManifestFetchData::PingMode ping_mode = ManifestFetchData::NO_PING; |
955 if (update_url.DomainIs(ping_enabled_domain_.c_str())) | 953 if (update_url.DomainIs(ping_enabled_domain_.c_str())) |
956 ping_mode = ManifestFetchData::PING_WITH_ENABLED_STATE; | 954 ping_mode = ManifestFetchData::PING_WITH_ENABLED_STATE; |
957 return new ManifestFetchData( | 955 return new ManifestFetchData( |
958 update_url, request_id, brand_code_, manifest_query_params_, ping_mode); | 956 update_url, request_id, brand_code_, manifest_query_params_, ping_mode); |
959 } | 957 } |
960 | 958 |
961 } // namespace extensions | 959 } // namespace extensions |
OLD | NEW |