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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/crx_installer.h" | 10 #include "chrome/browser/extensions/crx_installer.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 Profile* profile = Profile::FromBrowserContext( | 100 Profile* profile = Profile::FromBrowserContext( |
101 web_ui()->GetWebContents()->GetBrowserContext()); | 101 web_ui()->GetWebContents()->GetBrowserContext()); |
102 scoped_ptr<ExtensionInstallPrompt> prompt( | 102 scoped_ptr<ExtensionInstallPrompt> prompt( |
103 new ExtensionInstallPrompt(web_ui()->GetWebContents())); | 103 new ExtensionInstallPrompt(web_ui()->GetWebContents())); |
104 scoped_refptr<CrxInstaller> crx_installer(CrxInstaller::Create( | 104 scoped_refptr<CrxInstaller> crx_installer(CrxInstaller::Create( |
105 ExtensionSystem::Get(profile)->extension_service(), | 105 ExtensionSystem::Get(profile)->extension_service(), |
106 prompt.Pass())); | 106 prompt.Pass())); |
107 crx_installer->set_error_on_unsupported_requirements(true); | 107 crx_installer->set_error_on_unsupported_requirements(true); |
108 crx_installer->set_off_store_install_allow_reason( | 108 crx_installer->set_off_store_install_allow_reason( |
109 CrxInstaller::OffStoreInstallAllowedFromSettingsPage); | 109 CrxInstaller::OffStoreInstallAllowedFromSettingsPage); |
110 crx_installer->set_install_wait_for_idle(false); | 110 crx_installer->set_install_immediately(true); |
111 | 111 |
112 const bool kCaseSensitive = false; | 112 const bool kCaseSensitive = false; |
113 | 113 |
114 if (EndsWith(file_display_name_, | 114 if (EndsWith(file_display_name_, |
115 base::ASCIIToUTF16(".user.js"), | 115 base::ASCIIToUTF16(".user.js"), |
116 kCaseSensitive)) { | 116 kCaseSensitive)) { |
117 crx_installer->InstallUserScript( | 117 crx_installer->InstallUserScript( |
118 file_to_install_, | 118 file_to_install_, |
119 net::FilePathToFileURL(file_to_install_)); | 119 net::FilePathToFileURL(file_to_install_)); |
120 } else if (EndsWith(file_display_name_, | 120 } else if (EndsWith(file_display_name_, |
(...skipping 11 matching lines...) Expand all Loading... |
132 void InstallExtensionHandler::HandleInstallDirectoryMessage( | 132 void InstallExtensionHandler::HandleInstallDirectoryMessage( |
133 const base::ListValue* args) { | 133 const base::ListValue* args) { |
134 Profile* profile = Profile::FromBrowserContext( | 134 Profile* profile = Profile::FromBrowserContext( |
135 web_ui()->GetWebContents()->GetBrowserContext()); | 135 web_ui()->GetWebContents()->GetBrowserContext()); |
136 UnpackedInstaller::Create( | 136 UnpackedInstaller::Create( |
137 ExtensionSystem::Get(profile)-> | 137 ExtensionSystem::Get(profile)-> |
138 extension_service())->Load(file_to_install_); | 138 extension_service())->Load(file_to_install_); |
139 } | 139 } |
140 | 140 |
141 } // namespace extensions | 141 } // namespace extensions |
OLD | NEW |