| 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 "chrome/browser/extensions/updater/extension_downloader.h" | 5 #include "chrome/browser/extensions/updater/extension_downloader.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/metrics/sparse_histogram.h" | 15 #include "base/metrics/sparse_histogram.h" |
| 16 #include "base/profiler/scoped_profile.h" |
| 16 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
| 17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 19 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 20 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 21 #include "base/version.h" | 22 #include "base/version.h" |
| 22 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
| 23 #include "chrome/browser/extensions/updater/extension_cache.h" | 24 #include "chrome/browser/extensions/updater/extension_cache.h" |
| 24 #include "chrome/browser/extensions/updater/request_queue_impl.h" | 25 #include "chrome/browser/extensions/updater/request_queue_impl.h" |
| 25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 // Update checks can be interrupted if a network change is detected; this is | 480 // Update checks can be interrupted if a network change is detected; this is |
| 480 // common for the retail mode AppPack on ChromeOS. Retrying once should be | 481 // common for the retail mode AppPack on ChromeOS. Retrying once should be |
| 481 // enough to recover in those cases; let the fetcher retry up to 3 times | 482 // enough to recover in those cases; let the fetcher retry up to 3 times |
| 482 // just in case. http://crosbug.com/130602 | 483 // just in case. http://crosbug.com/130602 |
| 483 manifest_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); | 484 manifest_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); |
| 484 manifest_fetcher_->Start(); | 485 manifest_fetcher_->Start(); |
| 485 } | 486 } |
| 486 | 487 |
| 487 void ExtensionDownloader::OnURLFetchComplete( | 488 void ExtensionDownloader::OnURLFetchComplete( |
| 488 const net::URLFetcher* source) { | 489 const net::URLFetcher* source) { |
| 490 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. |
| 491 tracked_objects::ScopedProfile tracking_profile( |
| 492 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 493 "422577 ExtensionDownloader::OnURLFetchComplete")); |
| 494 |
| 489 VLOG(2) << source->GetResponseCode() << " " << source->GetURL(); | 495 VLOG(2) << source->GetResponseCode() << " " << source->GetURL(); |
| 490 | 496 |
| 491 if (source == manifest_fetcher_.get()) { | 497 if (source == manifest_fetcher_.get()) { |
| 492 std::string data; | 498 std::string data; |
| 493 source->GetResponseAsString(&data); | 499 source->GetResponseAsString(&data); |
| 494 OnManifestFetchComplete(source->GetURL(), | 500 OnManifestFetchComplete(source->GetURL(), |
| 495 source->GetStatus(), | 501 source->GetStatus(), |
| 496 source->GetResponseCode(), | 502 source->GetResponseCode(), |
| 497 source->GetBackoffDelay(), | 503 source->GetBackoffDelay(), |
| 498 data); | 504 data); |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 ping_mode = ManifestFetchData::PING_WITH_METRICS; | 961 ping_mode = ManifestFetchData::PING_WITH_METRICS; |
| 956 } else { | 962 } else { |
| 957 ping_mode = ManifestFetchData::PING; | 963 ping_mode = ManifestFetchData::PING; |
| 958 } | 964 } |
| 959 } | 965 } |
| 960 return new ManifestFetchData( | 966 return new ManifestFetchData( |
| 961 update_url, request_id, brand_code_, manifest_query_params_, ping_mode); | 967 update_url, request_id, brand_code_, manifest_query_params_, ping_mode); |
| 962 } | 968 } |
| 963 | 969 |
| 964 } // namespace extensions | 970 } // namespace extensions |
| OLD | NEW |