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 const int creation_flags = creation_flags_ == Extension::NO_FLAGS | |
233 ? Extension::FROM_BOOKMARK | |
not at google - send to devlin
2014/06/05 16:54:05
what does this mean?
xiyuan
2014/06/05 17:06:19
This is to keep the current behavior, where Extens
not at google - send to devlin
2014/06/05 17:17:58
Yes I would prefer that. DCHECK if you wish.
xiyuan
2014/06/05 17:48:32
Done. Two callers: BookmarkAppHelper and AppLaunch
| |
234 : creation_flags_; | |
232 if (!installer_task_runner_->PostTask( | 235 if (!installer_task_runner_->PostTask( |
233 FROM_HERE, | 236 FROM_HERE, |
234 base::Bind(&CrxInstaller::ConvertWebAppOnFileThread, | 237 base::Bind(&CrxInstaller::ConvertWebAppOnFileThread, |
235 this, | 238 this, |
236 web_app, | 239 web_app, |
240 creation_flags, | |
237 install_directory_))) | 241 install_directory_))) |
238 NOTREACHED(); | 242 NOTREACHED(); |
239 } | 243 } |
240 | 244 |
241 void CrxInstaller::ConvertWebAppOnFileThread( | 245 void CrxInstaller::ConvertWebAppOnFileThread( |
242 const WebApplicationInfo& web_app, | 246 const WebApplicationInfo& web_app, |
247 int creation_flags, | |
243 const base::FilePath& install_directory) { | 248 const base::FilePath& install_directory) { |
244 base::string16 error; | 249 scoped_refptr<Extension> extension(ConvertWebAppToExtension( |
245 scoped_refptr<Extension> extension( | 250 web_app, base::Time::Now(), creation_flags, install_directory)); |
246 ConvertWebAppToExtension(web_app, base::Time::Now(), install_directory)); | |
247 if (!extension.get()) { | 251 if (!extension.get()) { |
248 // Validation should have stopped any potential errors before getting here. | 252 // Validation should have stopped any potential errors before getting here. |
249 NOTREACHED() << "Could not convert web app to extension."; | 253 NOTREACHED() << "Could not convert web app to extension."; |
250 return; | 254 return; |
251 } | 255 } |
252 | 256 |
253 // TODO(aa): conversion data gets lost here :( | 257 // TODO(aa): conversion data gets lost here :( |
254 | 258 |
255 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension.get(), | 259 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension.get(), |
256 SkBitmap()); | 260 SkBitmap()); |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
907 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 911 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
908 return; | 912 return; |
909 | 913 |
910 if (client_) { | 914 if (client_) { |
911 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 915 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
912 client_->ConfirmReEnable(this, extension()); | 916 client_->ConfirmReEnable(this, extension()); |
913 } | 917 } |
914 } | 918 } |
915 | 919 |
916 } // namespace extensions | 920 } // namespace extensions |
OLD | NEW |