| 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_util.h" | 7 #include "chrome/browser/download/download_util.h" |
| 8 #include "chrome/browser/extensions/crx_installer.h" | 8 #include "chrome/browser/extensions/crx_installer.h" |
| 9 #include "chrome/browser/extensions/extension_install_prompt.h" | 9 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 return new ExtensionInstallPrompt(web_contents); | 52 return new ExtensionInstallPrompt(web_contents); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) { | 56 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) { |
| 57 extensions::ExtensionPrefs* prefs = extensions::ExtensionSystem::Get( | 57 extensions::ExtensionPrefs* prefs = extensions::ExtensionSystem::Get( |
| 58 profile)->extension_service()->extension_prefs(); | 58 profile)->extension_service()->extension_prefs(); |
| 59 CHECK(prefs); | 59 CHECK(prefs); |
| 60 | 60 |
| 61 URLPatternSet url_patterns = prefs->GetAllowedInstallSites(); | 61 extensions::URLPatternSet url_patterns = prefs->GetAllowedInstallSites(); |
| 62 | 62 |
| 63 // TODO(aa): RefererURL is cleared in some cases, for example when going | 63 // TODO(aa): RefererURL is cleared in some cases, for example when going |
| 64 // between secure and non-secure URLs. It would be better if DownloadItem | 64 // between secure and non-secure URLs. It would be better if DownloadItem |
| 65 // tracked the initiating page explicitly. | 65 // tracked the initiating page explicitly. |
| 66 return url_patterns.MatchesURL(item.GetURL()) && | 66 return url_patterns.MatchesURL(item.GetURL()) && |
| 67 url_patterns.MatchesURL(item.GetReferrerUrl()); | 67 url_patterns.MatchesURL(item.GetReferrerUrl()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace | 70 } // namespace |
| 71 | 71 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (download_item.GetMimeType() == extensions::Extension::kMimeType || | 126 if (download_item.GetMimeType() == extensions::Extension::kMimeType || |
| 127 extensions::UserScript::IsURLUserScript(download_item.GetURL(), | 127 extensions::UserScript::IsURLUserScript(download_item.GetURL(), |
| 128 download_item.GetMimeType())) { | 128 download_item.GetMimeType())) { |
| 129 return true; | 129 return true; |
| 130 } else { | 130 } else { |
| 131 return false; | 131 return false; |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace download_crx_util | 135 } // namespace download_crx_util |
| OLD | NEW |