| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 return; | 223 return; |
| 224 } | 224 } |
| 225 | 225 |
| 226 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension.get(), | 226 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension.get(), |
| 227 SkBitmap()); | 227 SkBitmap()); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void CrxInstaller::InstallWebApp(const WebApplicationInfo& web_app) { | 230 void CrxInstaller::InstallWebApp(const WebApplicationInfo& web_app) { |
| 231 NotifyCrxInstallBegin(); | 231 NotifyCrxInstallBegin(); |
| 232 | 232 |
| 233 // Web apps can only ever be converted to bookmark apps. |
| 234 DCHECK(creation_flags_ & Extension::FROM_BOOKMARK); |
| 233 if (!installer_task_runner_->PostTask( | 235 if (!installer_task_runner_->PostTask( |
| 234 FROM_HERE, | 236 FROM_HERE, |
| 235 base::Bind(&CrxInstaller::ConvertWebAppOnFileThread, | 237 base::Bind(&CrxInstaller::ConvertWebAppOnFileThread, this, web_app))) |
| 236 this, | |
| 237 web_app, | |
| 238 install_directory_))) | |
| 239 NOTREACHED(); | 238 NOTREACHED(); |
| 240 } | 239 } |
| 241 | 240 |
| 242 void CrxInstaller::ConvertWebAppOnFileThread( | 241 void CrxInstaller::ConvertWebAppOnFileThread( |
| 243 const WebApplicationInfo& web_app, | 242 const WebApplicationInfo& web_app) { |
| 244 const base::FilePath& install_directory) { | 243 scoped_refptr<Extension> extension(ConvertWebAppToExtension( |
| 245 base::string16 error; | 244 web_app, base::Time::Now(), creation_flags_, install_directory_)); |
| 246 scoped_refptr<Extension> extension( | |
| 247 ConvertWebAppToExtension(web_app, base::Time::Now(), install_directory)); | |
| 248 if (!extension.get()) { | 245 if (!extension.get()) { |
| 249 // Validation should have stopped any potential errors before getting here. | 246 // Validation should have stopped any potential errors before getting here. |
| 250 NOTREACHED() << "Could not convert web app to extension."; | 247 NOTREACHED() << "Could not convert web app to extension."; |
| 251 return; | 248 return; |
| 252 } | 249 } |
| 253 | 250 |
| 254 // TODO(aa): conversion data gets lost here :( | 251 // TODO(aa): conversion data gets lost here :( |
| 255 | 252 |
| 256 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension.get(), | 253 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension.get(), |
| 257 SkBitmap()); | 254 SkBitmap()); |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 906 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
| 910 return; | 907 return; |
| 911 | 908 |
| 912 if (client_) { | 909 if (client_) { |
| 913 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 910 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
| 914 client_->ConfirmReEnable(this, extension()); | 911 client_->ConfirmReEnable(this, extension()); |
| 915 } | 912 } |
| 916 } | 913 } |
| 917 | 914 |
| 918 } // namespace extensions | 915 } // namespace extensions |
| OLD | NEW |