| 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 22 matching lines...) Expand all Loading... |
| 33 // to set one. | 33 // to set one. |
| 34 ExtensionInstallPrompt* CreateExtensionInstallPrompt(Profile* profile) { | 34 ExtensionInstallPrompt* CreateExtensionInstallPrompt(Profile* profile) { |
| 35 // Use a mock if one is present. Otherwise, create a real extensions | 35 // Use a mock if one is present. Otherwise, create a real extensions |
| 36 // install UI. | 36 // install UI. |
| 37 ExtensionInstallPrompt* result = NULL; | 37 ExtensionInstallPrompt* result = NULL; |
| 38 if (mock_install_prompt_for_testing) { | 38 if (mock_install_prompt_for_testing) { |
| 39 result = mock_install_prompt_for_testing; | 39 result = mock_install_prompt_for_testing; |
| 40 mock_install_prompt_for_testing = NULL; | 40 mock_install_prompt_for_testing = NULL; |
| 41 } else { | 41 } else { |
| 42 Browser* browser = browser::FindLastActiveWithProfile(profile); | 42 Browser* browser = browser::FindLastActiveWithProfile(profile); |
| 43 result = new ExtensionInstallPrompt(browser); | 43 result = chrome::CreateExtensionInstallPromptWithBrowser(browser); |
| 44 } | 44 } |
| 45 | 45 |
| 46 return result; | 46 return result; |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) { | 49 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) { |
| 50 ExtensionPrefs* prefs = | 50 ExtensionPrefs* prefs = |
| 51 ExtensionSystem::Get(profile)->extension_service()->extension_prefs(); | 51 ExtensionSystem::Get(profile)->extension_service()->extension_prefs(); |
| 52 CHECK(prefs); | 52 CHECK(prefs); |
| 53 | 53 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 if (download_item.GetMimeType() == extensions::Extension::kMimeType || | 118 if (download_item.GetMimeType() == extensions::Extension::kMimeType || |
| 119 UserScript::IsURLUserScript(download_item.GetURL(), | 119 UserScript::IsURLUserScript(download_item.GetURL(), |
| 120 download_item.GetMimeType())) { | 120 download_item.GetMimeType())) { |
| 121 return true; | 121 return true; |
| 122 } else { | 122 } else { |
| 123 return false; | 123 return false; |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace download_crx_util | 127 } // namespace download_crx_util |
| OLD | NEW |