| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/automation/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/message_box_flags.h" | 10 #include "app/message_box_flags.h" |
| (...skipping 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2145 void AutomationProvider::InstallExtension(const FilePath& crx_path, | 2145 void AutomationProvider::InstallExtension(const FilePath& crx_path, |
| 2146 IPC::Message* reply_message) { | 2146 IPC::Message* reply_message) { |
| 2147 ExtensionsService* service = profile_->GetExtensionsService(); | 2147 ExtensionsService* service = profile_->GetExtensionsService(); |
| 2148 if (service) { | 2148 if (service) { |
| 2149 // The observer will delete itself when done. | 2149 // The observer will delete itself when done. |
| 2150 new ExtensionNotificationObserver(this, | 2150 new ExtensionNotificationObserver(this, |
| 2151 AutomationMsg_InstallExtension::ID, | 2151 AutomationMsg_InstallExtension::ID, |
| 2152 reply_message); | 2152 reply_message); |
| 2153 | 2153 |
| 2154 const FilePath& install_dir = service->install_directory(); | 2154 const FilePath& install_dir = service->install_directory(); |
| 2155 MessageLoop* io_loop = g_browser_process->file_thread()->message_loop(); | |
| 2156 | |
| 2157 CrxInstaller::Start(crx_path, | 2155 CrxInstaller::Start(crx_path, |
| 2158 install_dir, | 2156 install_dir, |
| 2159 Extension::INTERNAL, | 2157 Extension::INTERNAL, |
| 2160 "", // no expected id | 2158 "", // no expected id |
| 2161 false, // please do not delete crx file | 2159 false, // please do not delete crx file |
| 2162 true, // privilege increase allowed | 2160 true, // privilege increase allowed |
| 2163 io_loop, | |
| 2164 service, | 2161 service, |
| 2165 NULL); // silent isntall, no UI | 2162 NULL); // silent isntall, no UI |
| 2166 } else { | 2163 } else { |
| 2167 AutomationMsg_InstallExtension::WriteReplyParams( | 2164 AutomationMsg_InstallExtension::WriteReplyParams( |
| 2168 reply_message, AUTOMATION_MSG_EXTENSION_INSTALL_FAILED); | 2165 reply_message, AUTOMATION_MSG_EXTENSION_INSTALL_FAILED); |
| 2169 Send(reply_message); | 2166 Send(reply_message); |
| 2170 } | 2167 } |
| 2171 } | 2168 } |
| 2172 | 2169 |
| 2173 void AutomationProvider::LoadExpandedExtension( | 2170 void AutomationProvider::LoadExpandedExtension( |
| 2174 const FilePath& extension_dir, | 2171 const FilePath& extension_dir, |
| 2175 IPC::Message* reply_message) { | 2172 IPC::Message* reply_message) { |
| 2176 if (profile_->GetExtensionsService() && profile_->GetUserScriptMaster()) { | 2173 if (profile_->GetExtensionsService() && profile_->GetUserScriptMaster()) { |
| 2177 // The observer will delete itself when done. | 2174 // The observer will delete itself when done. |
| 2178 new ExtensionNotificationObserver(this, | 2175 new ExtensionNotificationObserver(this, |
| 2179 AutomationMsg_LoadExpandedExtension::ID, | 2176 AutomationMsg_LoadExpandedExtension::ID, |
| 2180 reply_message); | 2177 reply_message); |
| 2181 | 2178 |
| 2182 profile_->GetExtensionsService()->LoadExtension(extension_dir); | 2179 profile_->GetExtensionsService()->LoadExtension(extension_dir); |
| 2183 profile_->GetUserScriptMaster()->AddWatchedPath(extension_dir); | 2180 profile_->GetUserScriptMaster()->AddWatchedPath(extension_dir); |
| 2184 } else { | 2181 } else { |
| 2185 AutomationMsg_LoadExpandedExtension::WriteReplyParams( | 2182 AutomationMsg_LoadExpandedExtension::WriteReplyParams( |
| 2186 reply_message, AUTOMATION_MSG_EXTENSION_INSTALL_FAILED); | 2183 reply_message, AUTOMATION_MSG_EXTENSION_INSTALL_FAILED); |
| 2187 Send(reply_message); | 2184 Send(reply_message); |
| 2188 } | 2185 } |
| 2189 } | 2186 } |
| OLD | NEW |