Index: chrome/browser/extensions/app_shortcut_manager.cc |
diff --git a/chrome/browser/extensions/app_shortcut_manager.cc b/chrome/browser/extensions/app_shortcut_manager.cc |
index cdf2ce2e8d54476110471b9401ff15f80737ee87..6d8fc81656d41ba09b50568b643fabf5760c487d 100644 |
--- a/chrome/browser/extensions/app_shortcut_manager.cc |
+++ b/chrome/browser/extensions/app_shortcut_manager.cc |
@@ -29,6 +29,23 @@ const int kDesiredSizes[] = {16, 32, 128, 256, 512}; |
#else |
const int kDesiredSizes[] = {32}; |
#endif |
+ |
+ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile( |
+ const Extension* extension, Profile* profile) { |
+ ShellIntegration::ShortcutInfo shortcut_info; |
+ shortcut_info.extension_id = extension->id(); |
+ shortcut_info.url = GURL(extension->launch_web_url()); |
+ shortcut_info.title = UTF8ToUTF16(extension->name()); |
+ shortcut_info.description = UTF8ToUTF16(extension->description()); |
+ shortcut_info.extension_path = extension->path(); |
+ shortcut_info.is_platform_app = extension->is_platform_app(); |
+ shortcut_info.create_in_applications_menu = true; |
+ shortcut_info.create_in_quick_launch_bar = true; |
+ shortcut_info.create_on_desktop = true; |
+ shortcut_info.profile_path = profile->GetPath(); |
+ return shortcut_info; |
+} |
+ |
} // namespace |
AppShortcutManager::AppShortcutManager(Profile* profile) |
@@ -57,7 +74,7 @@ void AppShortcutManager::OnImageLoaded(const gfx::Image& image, |
shortcut_info_.favicon = image; |
} |
- web_app::CreateShortcut(profile_->GetPath(), shortcut_info_); |
+ web_app::CreateShortcuts(shortcut_info_); |
} |
void AppShortcutManager::Observe(int type, |
@@ -76,10 +93,10 @@ void AppShortcutManager::Observe(int type, |
break; |
} |
case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { |
- std::string extension_id = |
- content::Details<const Extension>(details).ptr()->id(); |
+ const Extension* extension = content::Details<const Extension>( |
+ details).ptr(); |
if (!disable_shortcut_creation_for_tests) |
- web_app::DeleteAllShortcuts(profile_->GetPath(), extension_id); |
+ DeleteApplicationShortcuts(extension); |
break; |
} |
default: |
@@ -95,17 +112,7 @@ void AppShortcutManager::SetShortcutCreationDisabledForTesting(bool disabled) { |
void AppShortcutManager::InstallApplicationShortcuts( |
const Extension* extension) { |
- shortcut_info_.extension_id = extension->id(); |
- shortcut_info_.url = GURL(extension->launch_web_url()); |
- shortcut_info_.title = UTF8ToUTF16(extension->name()); |
- shortcut_info_.description = UTF8ToUTF16(extension->description()); |
- shortcut_info_.extension_path = extension->path(); |
- shortcut_info_.is_platform_app = extension->is_platform_app(); |
- shortcut_info_.create_in_applications_menu = true; |
- shortcut_info_.create_in_quick_launch_bar = true; |
- shortcut_info_.create_on_desktop = true; |
- shortcut_info_.profile_path = profile_->GetPath(); |
- |
+ shortcut_info_ = ShortcutInfoForExtensionAndProfile(extension, profile_); |
std::vector<ImageLoadingTracker::ImageInfo> info_list; |
for (size_t i = 0; i < arraysize(kDesiredSizes); ++i) { |
int size = kDesiredSizes[i]; |
@@ -139,3 +146,10 @@ void AppShortcutManager::InstallApplicationShortcuts( |
// immediately. |
tracker_.LoadImages(extension, info_list, ImageLoadingTracker::DONT_CACHE); |
} |
+ |
+void AppShortcutManager::DeleteApplicationShortcuts( |
+ const Extension* extension) { |
+ ShellIntegration::ShortcutInfo delete_info = |
+ ShortcutInfoForExtensionAndProfile(extension, profile_); |
+ web_app::DeleteAllShortcuts(delete_info); |
+} |