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" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/extensions/extension_system.h" | 16 #include "chrome/browser/extensions/extension_system.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/profiles/profile_info_cache.h" | 18 #include "chrome/browser/profiles/profile_info_cache.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
20 #include "chrome/browser/shell_integration.h" | 20 #include "chrome/browser/shell_integration.h" |
21 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 21 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
22 #include "chrome/browser/web_applications/web_app.h" | 22 #include "chrome/browser/web_applications/web_app.h" |
23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
24 #include "chrome/common/extensions/extension_set.h" | |
25 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
26 #include "components/user_prefs/pref_registry_syncable.h" | 25 #include "components/user_prefs/pref_registry_syncable.h" |
27 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/notification_details.h" | 27 #include "content/public/browser/notification_details.h" |
29 #include "content/public/browser/notification_source.h" | 28 #include "content/public/browser/notification_source.h" |
| 29 #include "extensions/common/extension_set.h" |
30 | 30 |
31 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
32 #include "apps/app_shim/app_shim_mac.h" | 32 #include "apps/app_shim/app_shim_mac.h" |
33 #endif | 33 #endif |
34 | 34 |
35 using extensions::Extension; | 35 using extensions::Extension; |
36 | 36 |
37 namespace { | 37 namespace { |
38 | 38 |
39 // Creates a shortcut for an application in the applications menu, if there is | 39 // Creates a shortcut for an application in the applications menu, if there is |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 // Check if extension system/service are available. They might not be in | 180 // Check if extension system/service are available. They might not be in |
181 // tests. | 181 // tests. |
182 extensions::ExtensionSystem* extension_system; | 182 extensions::ExtensionSystem* extension_system; |
183 ExtensionServiceInterface* extension_service; | 183 ExtensionServiceInterface* extension_service; |
184 if (!(extension_system = extensions::ExtensionSystem::Get(profile_)) || | 184 if (!(extension_system = extensions::ExtensionSystem::Get(profile_)) || |
185 !(extension_service = extension_system->extension_service())) | 185 !(extension_service = extension_system->extension_service())) |
186 return; | 186 return; |
187 | 187 |
188 // Create an applications menu shortcut for each app in this profile. | 188 // Create an applications menu shortcut for each app in this profile. |
189 const ExtensionSet* apps = extension_service->extensions(); | 189 const extensions::ExtensionSet* apps = extension_service->extensions(); |
190 for (ExtensionSet::const_iterator it = apps->begin(); | 190 for (extensions::ExtensionSet::const_iterator it = apps->begin(); |
191 it != apps->end(); ++it) { | 191 it != apps->end(); ++it) { |
192 if (ShouldCreateShortcutFor(it->get())) | 192 if (ShouldCreateShortcutFor(it->get())) |
193 web_app::UpdateShortcutInfoAndIconForApp( | 193 web_app::UpdateShortcutInfoAndIconForApp( |
194 *it->get(), profile_, base::Bind(&CreateShortcutsInApplicationsMenu)); | 194 *it->get(), profile_, base::Bind(&CreateShortcutsInApplicationsMenu)); |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 void AppShortcutManager::DeleteApplicationShortcuts( | 198 void AppShortcutManager::DeleteApplicationShortcuts( |
199 const Extension* extension) { | 199 const Extension* extension) { |
200 ShellIntegration::ShortcutInfo delete_info = | 200 ShellIntegration::ShortcutInfo delete_info = |
201 web_app::ShortcutInfoForExtensionAndProfile(extension, profile_); | 201 web_app::ShortcutInfoForExtensionAndProfile(extension, profile_); |
202 web_app::DeleteAllShortcuts(delete_info); | 202 web_app::DeleteAllShortcuts(delete_info); |
203 } | 203 } |
OLD | NEW |