Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: apps/shortcut_manager.cc

Issue 14238037: Made it possible to tell whether an extension is being installed or updated. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added extra check. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/enterprise_extension_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/enterprise_extension_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698