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/ui/webui/extensions/install_extension_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/install_extension_handler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 return; | 98 return; |
99 } | 99 } |
100 | 100 |
101 Profile* profile = Profile::FromBrowserContext( | 101 Profile* profile = Profile::FromBrowserContext( |
102 web_ui()->GetWebContents()->GetBrowserContext()); | 102 web_ui()->GetWebContents()->GetBrowserContext()); |
103 | 103 |
104 if (file_display_name_.MatchesExtension(FILE_PATH_LITERAL(".zip"))) { | 104 if (file_display_name_.MatchesExtension(FILE_PATH_LITERAL(".zip"))) { |
105 ZipFileInstaller::Create(ExtensionSystem::Get(profile)->extension_service()) | 105 ZipFileInstaller::Create(ExtensionSystem::Get(profile)->extension_service()) |
106 ->LoadFromZipFile(file_to_install_); | 106 ->LoadFromZipFile(file_to_install_); |
107 } else { | 107 } else { |
108 scoped_ptr<ExtensionInstallPrompt> prompt( | 108 std::unique_ptr<ExtensionInstallPrompt> prompt( |
109 new ExtensionInstallPrompt(web_ui()->GetWebContents())); | 109 new ExtensionInstallPrompt(web_ui()->GetWebContents())); |
110 scoped_refptr<CrxInstaller> crx_installer(CrxInstaller::Create( | 110 scoped_refptr<CrxInstaller> crx_installer(CrxInstaller::Create( |
111 ExtensionSystem::Get(profile)->extension_service(), std::move(prompt))); | 111 ExtensionSystem::Get(profile)->extension_service(), std::move(prompt))); |
112 crx_installer->set_error_on_unsupported_requirements(true); | 112 crx_installer->set_error_on_unsupported_requirements(true); |
113 crx_installer->set_off_store_install_allow_reason( | 113 crx_installer->set_off_store_install_allow_reason( |
114 CrxInstaller::OffStoreInstallAllowedFromSettingsPage); | 114 CrxInstaller::OffStoreInstallAllowedFromSettingsPage); |
115 crx_installer->set_install_immediately(true); | 115 crx_installer->set_install_immediately(true); |
116 | 116 |
117 if (file_display_name_.MatchesExtension(FILE_PATH_LITERAL(".user.js"))) { | 117 if (file_display_name_.MatchesExtension(FILE_PATH_LITERAL(".user.js"))) { |
118 crx_installer->InstallUserScript( | 118 crx_installer->InstallUserScript( |
(...skipping 12 matching lines...) Expand all Loading... |
131 void InstallExtensionHandler::HandleInstallDirectoryMessage( | 131 void InstallExtensionHandler::HandleInstallDirectoryMessage( |
132 const base::ListValue* args) { | 132 const base::ListValue* args) { |
133 Profile* profile = Profile::FromBrowserContext( | 133 Profile* profile = Profile::FromBrowserContext( |
134 web_ui()->GetWebContents()->GetBrowserContext()); | 134 web_ui()->GetWebContents()->GetBrowserContext()); |
135 UnpackedInstaller::Create( | 135 UnpackedInstaller::Create( |
136 ExtensionSystem::Get(profile)-> | 136 ExtensionSystem::Get(profile)-> |
137 extension_service())->Load(file_to_install_); | 137 extension_service())->Load(file_to_install_); |
138 } | 138 } |
139 | 139 |
140 } // namespace extensions | 140 } // namespace extensions |
OLD | NEW |