| 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 23 matching lines...) Expand all Loading... |
| 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 |
| 40 // not already one present. | 40 // not already one present. |
| 41 void CreateShortcutsInApplicationsMenu( | 41 void CreateShortcutsInApplicationsMenu( |
| 42 const ShellIntegration::ShortcutInfo& shortcut_info) { | 42 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 43 ShellIntegration::ShortcutLocations creation_locations; | 43 ShellIntegration::ShortcutLocations creation_locations; |
| 44 creation_locations.in_applications_menu = true; | |
| 45 // Create the shortcut in the Chrome Apps subdir. | 44 // Create the shortcut in the Chrome Apps subdir. |
| 46 creation_locations.applications_menu_subdir = | 45 creation_locations.applications_menu_location = |
| 47 web_app::GetAppShortcutsSubdirName(); | 46 ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS; |
| 48 web_app::CreateShortcuts(shortcut_info, creation_locations, | 47 web_app::CreateShortcuts(shortcut_info, creation_locations, |
| 49 web_app::SHORTCUT_CREATION_AUTOMATED); | 48 web_app::SHORTCUT_CREATION_AUTOMATED); |
| 50 } | 49 } |
| 51 | 50 |
| 52 bool ShouldCreateShortcutFor(const extensions::Extension* extension) { | 51 bool ShouldCreateShortcutFor(const extensions::Extension* extension) { |
| 53 return extension->is_platform_app() && | 52 return extension->is_platform_app() && |
| 54 extension->location() != extensions::Manifest::COMPONENT && | 53 extension->location() != extensions::Manifest::COMPONENT && |
| 55 extension->ShouldDisplayInAppLauncher(); | 54 extension->ShouldDisplayInAppLauncher(); |
| 56 } | 55 } |
| 57 | 56 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 *it->get(), profile_, base::Bind(&CreateShortcutsInApplicationsMenu)); | 194 *it->get(), profile_, base::Bind(&CreateShortcutsInApplicationsMenu)); |
| 196 } | 195 } |
| 197 } | 196 } |
| 198 | 197 |
| 199 void AppShortcutManager::DeleteApplicationShortcuts( | 198 void AppShortcutManager::DeleteApplicationShortcuts( |
| 200 const Extension* extension) { | 199 const Extension* extension) { |
| 201 ShellIntegration::ShortcutInfo delete_info = | 200 ShellIntegration::ShortcutInfo delete_info = |
| 202 web_app::ShortcutInfoForExtensionAndProfile(extension, profile_); | 201 web_app::ShortcutInfoForExtensionAndProfile(extension, profile_); |
| 203 web_app::DeleteAllShortcuts(delete_info); | 202 web_app::DeleteAllShortcuts(delete_info); |
| 204 } | 203 } |
| OLD | NEW |