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 <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_tracker.h" | |
17 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
18 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
20 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
21 #include "base/time/time.h" | 20 #include "base/time/time.h" |
22 #include "base/version.h" | 21 #include "base/version.h" |
23 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/notification_details.h" | 23 #include "content/public/browser/notification_details.h" |
25 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
26 #include "extensions/browser/extensions_browser_client.h" | 25 #include "extensions/browser/extensions_browser_client.h" |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 net::LOAD_DISABLE_CACHE); | 484 net::LOAD_DISABLE_CACHE); |
486 // Update checks can be interrupted if a network change is detected; this is | 485 // Update checks can be interrupted if a network change is detected; this is |
487 // common for the retail mode AppPack on ChromeOS. Retrying once should be | 486 // common for the retail mode AppPack on ChromeOS. Retrying once should be |
488 // enough to recover in those cases; let the fetcher retry up to 3 times | 487 // enough to recover in those cases; let the fetcher retry up to 3 times |
489 // just in case. http://crosbug.com/130602 | 488 // just in case. http://crosbug.com/130602 |
490 manifest_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); | 489 manifest_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); |
491 manifest_fetcher_->Start(); | 490 manifest_fetcher_->Start(); |
492 } | 491 } |
493 | 492 |
494 void ExtensionDownloader::OnURLFetchComplete(const net::URLFetcher* source) { | 493 void ExtensionDownloader::OnURLFetchComplete(const net::URLFetcher* source) { |
495 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422577 is fixed. | |
496 tracked_objects::ScopedTracker tracking_profile( | |
497 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
498 "422577 ExtensionDownloader::OnURLFetchComplete")); | |
499 | |
500 VLOG(2) << source->GetResponseCode() << " " << source->GetURL(); | 494 VLOG(2) << source->GetResponseCode() << " " << source->GetURL(); |
501 | 495 |
502 if (source == manifest_fetcher_.get()) { | 496 if (source == manifest_fetcher_.get()) { |
503 std::string data; | 497 std::string data; |
504 source->GetResponseAsString(&data); | 498 source->GetResponseAsString(&data); |
505 OnManifestFetchComplete(source->GetURL(), | 499 OnManifestFetchComplete(source->GetURL(), |
506 source->GetStatus(), | 500 source->GetStatus(), |
507 source->GetResponseCode(), | 501 source->GetResponseCode(), |
508 source->GetBackoffDelay(), | 502 source->GetBackoffDelay(), |
509 data); | 503 data); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 ping_mode = ManifestFetchData::PING_WITH_METRICS; | 957 ping_mode = ManifestFetchData::PING_WITH_METRICS; |
964 } else { | 958 } else { |
965 ping_mode = ManifestFetchData::PING; | 959 ping_mode = ManifestFetchData::PING; |
966 } | 960 } |
967 } | 961 } |
968 return new ManifestFetchData( | 962 return new ManifestFetchData( |
969 update_url, request_id, brand_code_, manifest_query_params_, ping_mode); | 963 update_url, request_id, brand_code_, manifest_query_params_, ping_mode); |
970 } | 964 } |
971 | 965 |
972 } // namespace extensions | 966 } // namespace extensions |
OLD | NEW |