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/extensions/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 return; | 221 return; |
222 } | 222 } |
223 | 223 |
224 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension.get(), | 224 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension.get(), |
225 SkBitmap()); | 225 SkBitmap()); |
226 } | 226 } |
227 | 227 |
228 void CrxInstaller::InstallWebApp(const WebApplicationInfo& web_app) { | 228 void CrxInstaller::InstallWebApp(const WebApplicationInfo& web_app) { |
229 NotifyCrxInstallBegin(); | 229 NotifyCrxInstallBegin(); |
230 | 230 |
| 231 const int creation_flags = creation_flags_ == Extension::NO_FLAGS |
| 232 ? Extension::FROM_BOOKMARK |
| 233 : creation_flags_; |
231 if (!installer_task_runner_->PostTask( | 234 if (!installer_task_runner_->PostTask( |
232 FROM_HERE, | 235 FROM_HERE, |
233 base::Bind(&CrxInstaller::ConvertWebAppOnFileThread, | 236 base::Bind(&CrxInstaller::ConvertWebAppOnFileThread, |
234 this, | 237 this, |
235 web_app, | 238 web_app, |
| 239 creation_flags, |
236 install_directory_))) | 240 install_directory_))) |
237 NOTREACHED(); | 241 NOTREACHED(); |
238 } | 242 } |
239 | 243 |
240 void CrxInstaller::ConvertWebAppOnFileThread( | 244 void CrxInstaller::ConvertWebAppOnFileThread( |
241 const WebApplicationInfo& web_app, | 245 const WebApplicationInfo& web_app, |
| 246 int creation_flags, |
242 const base::FilePath& install_directory) { | 247 const base::FilePath& install_directory) { |
243 base::string16 error; | 248 scoped_refptr<Extension> extension(ConvertWebAppToExtension( |
244 scoped_refptr<Extension> extension( | 249 web_app, base::Time::Now(), creation_flags, install_directory)); |
245 ConvertWebAppToExtension(web_app, base::Time::Now(), install_directory)); | |
246 if (!extension.get()) { | 250 if (!extension.get()) { |
247 // Validation should have stopped any potential errors before getting here. | 251 // Validation should have stopped any potential errors before getting here. |
248 NOTREACHED() << "Could not convert web app to extension."; | 252 NOTREACHED() << "Could not convert web app to extension."; |
249 return; | 253 return; |
250 } | 254 } |
251 | 255 |
252 // TODO(aa): conversion data gets lost here :( | 256 // TODO(aa): conversion data gets lost here :( |
253 | 257 |
254 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension.get(), | 258 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension.get(), |
255 SkBitmap()); | 259 SkBitmap()); |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 902 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
899 return; | 903 return; |
900 | 904 |
901 if (client_) { | 905 if (client_) { |
902 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 906 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
903 client_->ConfirmReEnable(this, extension()); | 907 client_->ConfirmReEnable(this, extension()); |
904 } | 908 } |
905 } | 909 } |
906 | 910 |
907 } // namespace extensions | 911 } // namespace extensions |
OLD | NEW |