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 DCHECK(creation_flags_ & Extension::FROM_BOOKMARK); | |
not at google - send to devlin
2014/06/05 17:50:45
could you briefly explain why this check is made?
xiyuan
2014/06/05 18:06:53
This is inherited from the current ConvertWebAppTo
not at google - send to devlin
2014/06/05 18:11:54
Yeah, I think that a comment like "Web apps can on
xiyuan
2014/06/05 18:27:35
Done.
| |
232 if (!installer_task_runner_->PostTask( | 233 if (!installer_task_runner_->PostTask( |
233 FROM_HERE, | 234 FROM_HERE, |
234 base::Bind(&CrxInstaller::ConvertWebAppOnFileThread, | 235 base::Bind(&CrxInstaller::ConvertWebAppOnFileThread, |
235 this, | 236 this, |
236 web_app, | 237 web_app, |
238 creation_flags_, | |
237 install_directory_))) | 239 install_directory_))) |
238 NOTREACHED(); | 240 NOTREACHED(); |
239 } | 241 } |
240 | 242 |
241 void CrxInstaller::ConvertWebAppOnFileThread( | 243 void CrxInstaller::ConvertWebAppOnFileThread( |
242 const WebApplicationInfo& web_app, | 244 const WebApplicationInfo& web_app, |
245 int creation_flags, | |
not at google - send to devlin
2014/06/05 17:50:45
this shouldn't be necessary, it can be read from c
xiyuan
2014/06/05 18:06:53
I am slightly prefer to have an arg here because i
not at google - send to devlin
2014/06/05 18:11:54
I see your point. It looks like a bunch of this ac
xiyuan
2014/06/05 18:27:35
Right. I might be over-thinking it. :p
- Removed
not at google - send to devlin
2014/06/05 18:31:45
ah.
| |
243 const base::FilePath& install_directory) { | 246 const base::FilePath& install_directory) { |
244 base::string16 error; | 247 scoped_refptr<Extension> extension(ConvertWebAppToExtension( |
245 scoped_refptr<Extension> extension( | 248 web_app, base::Time::Now(), creation_flags, install_directory)); |
246 ConvertWebAppToExtension(web_app, base::Time::Now(), install_directory)); | |
247 if (!extension.get()) { | 249 if (!extension.get()) { |
248 // Validation should have stopped any potential errors before getting here. | 250 // Validation should have stopped any potential errors before getting here. |
249 NOTREACHED() << "Could not convert web app to extension."; | 251 NOTREACHED() << "Could not convert web app to extension."; |
250 return; | 252 return; |
251 } | 253 } |
252 | 254 |
253 // TODO(aa): conversion data gets lost here :( | 255 // TODO(aa): conversion data gets lost here :( |
254 | 256 |
255 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension.get(), | 257 OnUnpackSuccess(extension->path(), extension->path(), NULL, extension.get(), |
256 SkBitmap()); | 258 SkBitmap()); |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
907 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 909 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
908 return; | 910 return; |
909 | 911 |
910 if (client_) { | 912 if (client_) { |
911 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 913 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
912 client_->ConfirmReEnable(this, extension()); | 914 client_->ConfirmReEnable(this, extension()); |
913 } | 915 } |
914 } | 916 } |
915 | 917 |
916 } // namespace extensions | 918 } // namespace extensions |
OLD | NEW |