| 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/webstore_installer.h" | 5 #include "chrome/browser/extensions/webstore_installer.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 23 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
| 24 #include "chrome/browser/download/download_crx_util.h" | 24 #include "chrome/browser/download/download_crx_util.h" |
| 25 #include "chrome/browser/download/download_prefs.h" | 25 #include "chrome/browser/download/download_prefs.h" |
| 26 #include "chrome/browser/download/download_stats.h" | 26 #include "chrome/browser/download/download_stats.h" |
| 27 #include "chrome/browser/extensions/crx_installer.h" | 27 #include "chrome/browser/extensions/crx_installer.h" |
| 28 #include "chrome/browser/extensions/install_tracker.h" | 28 #include "chrome/browser/extensions/install_tracker.h" |
| 29 #include "chrome/browser/extensions/install_tracker_factory.h" | 29 #include "chrome/browser/extensions/install_tracker_factory.h" |
| 30 #include "chrome/browser/extensions/install_verifier.h" | 30 #include "chrome/browser/extensions/install_verifier.h" |
| 31 #include "chrome/browser/extensions/shared_module_service.h" | 31 #include "chrome/browser/extensions/shared_module_service.h" |
| 32 #include "chrome/browser/omaha_query_params/omaha_query_params.h" | |
| 33 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 34 #include "chrome/browser/ui/browser_list.h" | 33 #include "chrome/browser/ui/browser_list.h" |
| 35 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 34 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 36 #include "chrome/common/chrome_paths.h" | 35 #include "chrome/common/chrome_paths.h" |
| 37 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
| 38 #include "chrome/common/extensions/extension_constants.h" | 37 #include "chrome/common/extensions/extension_constants.h" |
| 38 #include "components/omaha_query_params/omaha_query_params.h" |
| 39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/download_manager.h" | 40 #include "content/public/browser/download_manager.h" |
| 41 #include "content/public/browser/download_save_info.h" | 41 #include "content/public/browser/download_save_info.h" |
| 42 #include "content/public/browser/download_url_parameters.h" | 42 #include "content/public/browser/download_url_parameters.h" |
| 43 #include "content/public/browser/navigation_controller.h" | 43 #include "content/public/browser/navigation_controller.h" |
| 44 #include "content/public/browser/navigation_entry.h" | 44 #include "content/public/browser/navigation_entry.h" |
| 45 #include "content/public/browser/notification_details.h" | 45 #include "content/public/browser/notification_details.h" |
| 46 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
| 47 #include "content/public/browser/notification_source.h" | 47 #include "content/public/browser/notification_source.h" |
| 48 #include "content/public/browser/render_process_host.h" | 48 #include "content/public/browser/render_process_host.h" |
| 49 #include "content/public/browser/render_view_host.h" | 49 #include "content/public/browser/render_view_host.h" |
| 50 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
| 51 #include "extensions/browser/extension_registry.h" | 51 #include "extensions/browser/extension_registry.h" |
| 52 #include "extensions/browser/extension_system.h" | 52 #include "extensions/browser/extension_system.h" |
| 53 #include "extensions/common/extension.h" | 53 #include "extensions/common/extension.h" |
| 54 #include "extensions/common/manifest_constants.h" | 54 #include "extensions/common/manifest_constants.h" |
| 55 #include "extensions/common/manifest_handlers/shared_module_info.h" | 55 #include "extensions/common/manifest_handlers/shared_module_info.h" |
| 56 #include "net/base/escape.h" | 56 #include "net/base/escape.h" |
| 57 #include "url/gurl.h" | 57 #include "url/gurl.h" |
| 58 | 58 |
| 59 #if defined(OS_CHROMEOS) | 59 #if defined(OS_CHROMEOS) |
| 60 #include "chrome/browser/chromeos/drive/file_system_util.h" | 60 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 using chrome::OmahaQueryParams; | |
| 64 using content::BrowserContext; | 63 using content::BrowserContext; |
| 65 using content::BrowserThread; | 64 using content::BrowserThread; |
| 66 using content::DownloadItem; | 65 using content::DownloadItem; |
| 67 using content::DownloadManager; | 66 using content::DownloadManager; |
| 68 using content::NavigationController; | 67 using content::NavigationController; |
| 69 using content::DownloadUrlParameters; | 68 using content::DownloadUrlParameters; |
| 70 | 69 |
| 71 namespace { | 70 namespace { |
| 72 | 71 |
| 73 // Key used to attach the Approval to the DownloadItem. | 72 // Key used to attach the Approval to the DownloadItem. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 extension_id.c_str())); | 194 extension_id.c_str())); |
| 196 } | 195 } |
| 197 std::vector<std::string> params; | 196 std::vector<std::string> params; |
| 198 params.push_back("id=" + extension_id); | 197 params.push_back("id=" + extension_id); |
| 199 if (!install_source.empty()) | 198 if (!install_source.empty()) |
| 200 params.push_back("installsource=" + install_source); | 199 params.push_back("installsource=" + install_source); |
| 201 params.push_back("uc"); | 200 params.push_back("uc"); |
| 202 std::string url_string = extension_urls::GetWebstoreUpdateUrl().spec(); | 201 std::string url_string = extension_urls::GetWebstoreUpdateUrl().spec(); |
| 203 | 202 |
| 204 GURL url(url_string + "?response=redirect&" + | 203 GURL url(url_string + "?response=redirect&" + |
| 205 OmahaQueryParams::Get(OmahaQueryParams::CRX) + "&x=" + | 204 omaha_query_params::OmahaQueryParams::Get( |
| 206 net::EscapeQueryParamValue(JoinString(params, '&'), true)); | 205 omaha_query_params::OmahaQueryParams::CRX) + |
| 206 "&x=" + net::EscapeQueryParamValue(JoinString(params, '&'), true)); |
| 207 DCHECK(url.is_valid()); | 207 DCHECK(url.is_valid()); |
| 208 | 208 |
| 209 return url; | 209 return url; |
| 210 } | 210 } |
| 211 | 211 |
| 212 void WebstoreInstaller::Delegate::OnExtensionDownloadStarted( | 212 void WebstoreInstaller::Delegate::OnExtensionDownloadStarted( |
| 213 const std::string& id, | 213 const std::string& id, |
| 214 content::DownloadItem* item) { | 214 content::DownloadItem* item) { |
| 215 } | 215 } |
| 216 | 216 |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 1, | 749 1, |
| 750 kMaxSizeKb, | 750 kMaxSizeKb, |
| 751 kNumBuckets); | 751 kNumBuckets); |
| 752 } | 752 } |
| 753 UMA_HISTOGRAM_BOOLEAN( | 753 UMA_HISTOGRAM_BOOLEAN( |
| 754 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", | 754 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", |
| 755 total_bytes <= 0); | 755 total_bytes <= 0); |
| 756 } | 756 } |
| 757 | 757 |
| 758 } // namespace extensions | 758 } // namespace extensions |
| OLD | NEW |