diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 08:47:48 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 08:47:48 +0000 |
commit | 92bcd16fb15f54a0ea510597bebdad7d4d4297dc (patch) | |
tree | 51b8063da05a5d674e993eed0a83aafea6419b7d /chrome/browser/extensions/crx_installer.cc | |
parent | f36ed64560f4b52724d223bc870addc5a5e3b73c (diff) | |
download | chromium_src-92bcd16fb15f54a0ea510597bebdad7d4d4297dc.zip chromium_src-92bcd16fb15f54a0ea510597bebdad7d4d4297dc.tar.gz chromium_src-92bcd16fb15f54a0ea510597bebdad7d4d4297dc.tar.bz2 |
Reland 36337: Add launch configuration to apps. Create a desktop shortcut if launch configuration is present. Future
changes will add UI asking if the user wants to create a shortcut first, and change the presentation when the shortcut is
launched.
TBR=erikkay@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/crx_installer.cc')
-rw-r--r-- | chrome/browser/extensions/crx_installer.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index ca01297..defeff4 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -5,6 +5,7 @@ #include "chrome/browser/extensions/crx_installer.h" #include "app/l10n_util.h" +#include "app/resource_bundle.h" #include "base/file_util.h" #include "base/scoped_temp_dir.h" #include "base/string_util.h" @@ -13,9 +14,12 @@ #include "chrome/browser/chrome_thread.h" #include "chrome/browser/extensions/convert_user_script.h" #include "chrome/browser/extensions/extension_file_util.h" +#include "chrome/browser/shell_integration.h" +#include "chrome/browser/web_applications/web_app.h" #include "chrome/common/extensions/extension_error_reporter.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" +#include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -153,10 +157,11 @@ void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir, return; } - if (client_.get()) { + if (client_.get() || extension_->IsApp()) { Extension::DecodeIcon(extension_.get(), Extension::EXTENSION_ICON_LARGE, &install_icon_); } + ChromeThread::PostTask( ChromeThread::UI, FROM_HERE, NewRunnableMethod(this, &CrxInstaller::ConfirmInstall)); @@ -232,6 +237,24 @@ void CrxInstaller::CompleteInstall() { return; } + if (extension_->IsApp()) { + SkBitmap icon = install_icon_.get() ? *install_icon_ : + *ResourceBundle::GetSharedInstance().GetBitmapNamed( + IDR_EXTENSION_DEFAULT_ICON); + + ShellIntegration::ShortcutInfo shortcut_info; + shortcut_info.url = extension_->app_launch_url(); + shortcut_info.title = UTF8ToUTF16(extension_->name()); + shortcut_info.description = UTF8ToUTF16(extension_->description()); + shortcut_info.favicon = icon; + shortcut_info.create_on_desktop = true; + + // TODO(aa): Seems nasty to be reusing the old webapps code this way. What + // baggage am I inheriting? + web_app::CreateShortcut(frontend_->profile()->GetPath(), shortcut_info, + NULL); + } + // This is lame, but we must reload the extension because absolute paths // inside the content scripts are established inside InitFromValue() and we // just moved the extension. |