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