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