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 // Download code which handles CRX files (extensions, themes, apps, ...). | 5 // Download code which handles CRX files (extensions, themes, apps, ...). |
6 | 6 |
7 #include "chrome/browser/download/download_crx_util.h" | 7 #include "chrome/browser/download/download_crx_util.h" |
8 | 8 |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/extensions/crx_installer.h" | 10 #include "chrome/browser/extensions/crx_installer.h" |
11 #include "chrome/browser/extensions/extension_install_prompt.h" | 11 #include "chrome/browser/extensions/extension_install_prompt.h" |
12 #include "chrome/browser/extensions/extension_management.h" | 12 #include "chrome/browser/extensions/extension_management.h" |
13 #include "chrome/browser/extensions/webstore_installer.h" | 13 #include "chrome/browser/extensions/webstore_installer.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
16 #include "chrome/browser/ui/host_desktop.h" | 16 #include "chrome/browser/ui/host_desktop.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "content/public/browser/download_item.h" | 18 #include "content/public/browser/download_item.h" |
19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
20 #include "extensions/browser/extension_system.h" | 20 #include "extensions/browser/extension_system.h" |
21 #include "extensions/common/user_script.h" | 21 #include "extensions/common/user_script.h" |
| 22 #include "ui/gfx/host_desktop_type.h" |
22 | 23 |
23 using content::BrowserThread; | 24 using content::BrowserThread; |
24 using content::DownloadItem; | 25 using content::DownloadItem; |
25 using extensions::WebstoreInstaller; | 26 using extensions::WebstoreInstaller; |
26 | 27 |
27 namespace download_crx_util { | 28 namespace download_crx_util { |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 // Hold a mock ExtensionInstallPrompt object that will be used when the | 32 // Hold a mock ExtensionInstallPrompt object that will be used when the |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 133 |
133 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) { | 134 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) { |
134 // TODO(aa): RefererURL is cleared in some cases, for example when going | 135 // TODO(aa): RefererURL is cleared in some cases, for example when going |
135 // between secure and non-secure URLs. It would be better if DownloadItem | 136 // between secure and non-secure URLs. It would be better if DownloadItem |
136 // tracked the initiating page explicitly. | 137 // tracked the initiating page explicitly. |
137 return extensions::ExtensionManagementFactory::GetForBrowserContext(profile) | 138 return extensions::ExtensionManagementFactory::GetForBrowserContext(profile) |
138 ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl()); | 139 ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl()); |
139 } | 140 } |
140 | 141 |
141 } // namespace download_crx_util | 142 } // namespace download_crx_util |
OLD | NEW |