OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/shortcut_manager.h" | 5 #include "chrome/browser/apps/shortcut_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 content::Details<const extensions::InstalledExtensionInfo>(details) | 119 content::Details<const extensions::InstalledExtensionInfo>(details) |
120 .ptr(); | 120 .ptr(); |
121 const Extension* extension = installed_info->extension; | 121 const Extension* extension = installed_info->extension; |
122 if (ShouldCreateShortcutFor(extension)) { | 122 if (ShouldCreateShortcutFor(extension)) { |
123 // If the app is being updated, update any existing shortcuts but do not | 123 // If the app is being updated, update any existing shortcuts but do not |
124 // create new ones. If it is being installed, automatically create a | 124 // create new ones. If it is being installed, automatically create a |
125 // shortcut in the applications menu (e.g., Start Menu). | 125 // shortcut in the applications menu (e.g., Start Menu). |
126 base::Callback<void(const ShellIntegration::ShortcutInfo&)> | 126 base::Callback<void(const ShellIntegration::ShortcutInfo&)> |
127 create_or_update; | 127 create_or_update; |
128 if (installed_info->is_update) { | 128 if (installed_info->is_update) { |
129 base::string16 old_title = UTF8ToUTF16(installed_info->old_name); | 129 base::string16 old_title = |
| 130 base::UTF8ToUTF16(installed_info->old_name); |
130 create_or_update = base::Bind(&web_app::UpdateAllShortcuts, | 131 create_or_update = base::Bind(&web_app::UpdateAllShortcuts, |
131 old_title); | 132 old_title); |
132 } else { | 133 } else { |
133 create_or_update = base::Bind(&CreateShortcutsInApplicationsMenu); | 134 create_or_update = base::Bind(&CreateShortcutsInApplicationsMenu); |
134 } | 135 } |
135 | 136 |
136 web_app::UpdateShortcutInfoAndIconForApp(*extension, profile_, | 137 web_app::UpdateShortcutInfoAndIconForApp(*extension, profile_, |
137 create_or_update); | 138 create_or_update); |
138 } | 139 } |
139 break; | 140 break; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 *it->get(), profile_, base::Bind(&CreateShortcutsInApplicationsMenu)); | 195 *it->get(), profile_, base::Bind(&CreateShortcutsInApplicationsMenu)); |
195 } | 196 } |
196 } | 197 } |
197 | 198 |
198 void AppShortcutManager::DeleteApplicationShortcuts( | 199 void AppShortcutManager::DeleteApplicationShortcuts( |
199 const Extension* extension) { | 200 const Extension* extension) { |
200 ShellIntegration::ShortcutInfo delete_info = | 201 ShellIntegration::ShortcutInfo delete_info = |
201 web_app::ShortcutInfoForExtensionAndProfile(extension, profile_); | 202 web_app::ShortcutInfoForExtensionAndProfile(extension, profile_); |
202 web_app::DeleteAllShortcuts(delete_info); | 203 web_app::DeleteAllShortcuts(delete_info); |
203 } | 204 } |
OLD | NEW |