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