| 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 "apps/shortcut_manager.h" | 5 #include "apps/shortcut_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "chrome/browser/shell_integration.h" | 9 #include "chrome/browser/shell_integration.h" |
| 10 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 10 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 ShortcutManager::~ShortcutManager() {} | 29 ShortcutManager::~ShortcutManager() {} |
| 30 | 30 |
| 31 void ShortcutManager::Observe(int type, | 31 void ShortcutManager::Observe(int type, |
| 32 const content::NotificationSource& source, | 32 const content::NotificationSource& source, |
| 33 const content::NotificationDetails& details) { | 33 const content::NotificationDetails& details) { |
| 34 switch (type) { | 34 switch (type) { |
| 35 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { | 35 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { |
| 36 #if !defined(OS_MACOSX) | 36 #if !defined(OS_MACOSX) |
| 37 const Extension* extension = content::Details<const Extension>( | 37 const Extension* extension = |
| 38 details).ptr(); | 38 content::Details<const extensions::InstalledExtensionInfo>(details)-> |
| 39 extension; |
| 39 if (extension->is_platform_app() && | 40 if (extension->is_platform_app() && |
| 40 extension->location() != extensions::Manifest::COMPONENT) { | 41 extension->location() != extensions::Manifest::COMPONENT) { |
| 41 web_app::UpdateShortcutInfoAndIconForApp(*extension, profile_, | 42 web_app::UpdateShortcutInfoAndIconForApp(*extension, profile_, |
| 42 base::Bind(&web_app::UpdateAllShortcuts)); | 43 base::Bind(&web_app::UpdateAllShortcuts)); |
| 43 } | 44 } |
| 44 #endif // !defined(OS_MACOSX) | 45 #endif // !defined(OS_MACOSX) |
| 45 break; | 46 break; |
| 46 } | 47 } |
| 47 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { | 48 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { |
| 48 const Extension* extension = content::Details<const Extension>( | 49 const Extension* extension = content::Details<const Extension>( |
| 49 details).ptr(); | 50 details).ptr(); |
| 50 DeleteApplicationShortcuts(extension); | 51 DeleteApplicationShortcuts(extension); |
| 51 break; | 52 break; |
| 52 } | 53 } |
| 53 default: | 54 default: |
| 54 NOTREACHED(); | 55 NOTREACHED(); |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 | 58 |
| 58 void ShortcutManager::DeleteApplicationShortcuts( | 59 void ShortcutManager::DeleteApplicationShortcuts( |
| 59 const Extension* extension) { | 60 const Extension* extension) { |
| 60 ShellIntegration::ShortcutInfo delete_info = | 61 ShellIntegration::ShortcutInfo delete_info = |
| 61 web_app::ShortcutInfoForExtensionAndProfile(extension, profile_); | 62 web_app::ShortcutInfoForExtensionAndProfile(extension, profile_); |
| 62 web_app::DeleteAllShortcuts(delete_info); | 63 web_app::DeleteAllShortcuts(delete_info); |
| 63 } | 64 } |
| 64 | 65 |
| 65 } // namespace apps | 66 } // namespace apps |
| OLD | NEW |