| 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/memory/scoped_handle.h" | 14 #include "base/memory/scoped_handle.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/metrics/sparse_histogram.h" | 16 #include "base/metrics/sparse_histogram.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 "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
| 24 #include "chrome/browser/extensions/updater/extension_cache.h" | 24 #include "chrome/browser/extensions/updater/extension_cache.h" |
| 25 #include "chrome/browser/extensions/updater/request_queue_impl.h" | 25 #include "chrome/browser/extensions/updater/request_queue_impl.h" |
| 26 #include "chrome/browser/extensions/updater/safe_manifest_parser.h" | 26 #include "chrome/browser/extensions/updater/safe_manifest_parser.h" |
| 27 #include "chrome/browser/metrics/metrics_service.h" | 27 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/common/chrome_version_info.h" | 29 #include "chrome/common/chrome_version_info.h" |
| 30 #include "chrome/common/extensions/extension_constants.h" | 30 #include "chrome/common/extensions/extension_constants.h" |
| 31 #include "chrome/common/extensions/manifest_url_handler.h" | 31 #include "chrome/common/extensions/manifest_url_handler.h" |
| 32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| 33 #include "content/public/browser/notification_details.h" | 33 #include "content/public/browser/notification_details.h" |
| 34 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 35 #include "net/base/backoff_entry.h" | 35 #include "net/base/backoff_entry.h" |
| 36 #include "net/base/load_flags.h" | 36 #include "net/base/load_flags.h" |
| 37 #include "net/base/net_errors.h" | 37 #include "net/base/net_errors.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 default: | 336 default: |
| 337 ++url_stats_.pending_count; | 337 ++url_stats_.pending_count; |
| 338 break; | 338 break; |
| 339 } | 339 } |
| 340 | 340 |
| 341 std::vector<GURL> update_urls; | 341 std::vector<GURL> update_urls; |
| 342 update_urls.push_back(update_url); | 342 update_urls.push_back(update_url); |
| 343 // If UMA is enabled, also add to ManifestFetchData for the | 343 // If UMA is enabled, also add to ManifestFetchData for the |
| 344 // webstore update URL. | 344 // webstore update URL. |
| 345 if (!extension_urls::IsWebstoreUpdateUrl(update_url) && | 345 if (!extension_urls::IsWebstoreUpdateUrl(update_url) && |
| 346 MetricsServiceHelper::IsMetricsReportingEnabled()) { | 346 ChromeMetricsServiceAccessor::IsMetricsReportingEnabled()) { |
| 347 update_urls.push_back(extension_urls::GetWebstoreUpdateUrl()); | 347 update_urls.push_back(extension_urls::GetWebstoreUpdateUrl()); |
| 348 } | 348 } |
| 349 | 349 |
| 350 for (size_t i = 0; i < update_urls.size(); ++i) { | 350 for (size_t i = 0; i < update_urls.size(); ++i) { |
| 351 DCHECK(!update_urls[i].is_empty()); | 351 DCHECK(!update_urls[i].is_empty()); |
| 352 DCHECK(update_urls[i].is_valid()); | 352 DCHECK(update_urls[i].is_valid()); |
| 353 | 353 |
| 354 std::string install_source = i == 0 ? | 354 std::string install_source = i == 0 ? |
| 355 kDefaultInstallSource : kNotFromWebstoreInstallSource; | 355 kDefaultInstallSource : kNotFromWebstoreInstallSource; |
| 356 | 356 |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 void ExtensionDownloader::NotifyUpdateFound(const std::string& id, | 825 void ExtensionDownloader::NotifyUpdateFound(const std::string& id, |
| 826 const std::string& version) { | 826 const std::string& version) { |
| 827 UpdateDetails updateInfo(id, Version(version)); | 827 UpdateDetails updateInfo(id, Version(version)); |
| 828 content::NotificationService::current()->Notify( | 828 content::NotificationService::current()->Notify( |
| 829 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, | 829 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, |
| 830 content::NotificationService::AllBrowserContextsAndSources(), | 830 content::NotificationService::AllBrowserContextsAndSources(), |
| 831 content::Details<UpdateDetails>(&updateInfo)); | 831 content::Details<UpdateDetails>(&updateInfo)); |
| 832 } | 832 } |
| 833 | 833 |
| 834 } // namespace extensions | 834 } // namespace extensions |
| OLD | NEW |