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