| 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 "apps/pref_names.h" | 7 #include "apps/pref_names.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 using extensions::Extension; | 34 using extensions::Extension; |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 // Creates a shortcut for an application in the applications menu, if there is | 38 // Creates a shortcut for an application in the applications menu, if there is |
| 39 // not already one present. | 39 // not already one present. |
| 40 void CreateShortcutsInApplicationsMenu( | 40 void CreateShortcutsInApplicationsMenu( |
| 41 const ShellIntegration::ShortcutInfo& shortcut_info) { | 41 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 42 ShellIntegration::ShortcutLocations creation_locations; | 42 ShellIntegration::ShortcutLocations creation_locations; |
| 43 creation_locations.in_applications_menu = true; | 43 creation_locations.in_applications_menu_root = true; |
| 44 // Create the shortcut in the Chrome Apps subdir. | 44 // Create the shortcut in the Chrome Apps subdir. |
| 45 creation_locations.applications_menu_subdir = | 45 creation_locations.in_applications_menu_chrome_apps_subdir = true; |
| 46 web_app::GetAppShortcutsSubdirName(); | |
| 47 web_app::CreateShortcuts(shortcut_info, creation_locations, | 46 web_app::CreateShortcuts(shortcut_info, creation_locations, |
| 48 web_app::SHORTCUT_CREATION_AUTOMATED); | 47 web_app::SHORTCUT_CREATION_AUTOMATED); |
| 49 } | 48 } |
| 50 | 49 |
| 51 bool ShouldCreateShortcutFor(const extensions::Extension* extension) { | 50 bool ShouldCreateShortcutFor(const extensions::Extension* extension) { |
| 52 return extension->is_platform_app() && | 51 return extension->is_platform_app() && |
| 53 extension->location() != extensions::Manifest::COMPONENT && | 52 extension->location() != extensions::Manifest::COMPONENT && |
| 54 extension->ShouldDisplayInAppLauncher(); | 53 extension->ShouldDisplayInAppLauncher(); |
| 55 } | 54 } |
| 56 | 55 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 *it->get(), profile_, base::Bind(&CreateShortcutsInApplicationsMenu)); | 184 *it->get(), profile_, base::Bind(&CreateShortcutsInApplicationsMenu)); |
| 186 } | 185 } |
| 187 } | 186 } |
| 188 | 187 |
| 189 void AppShortcutManager::DeleteApplicationShortcuts( | 188 void AppShortcutManager::DeleteApplicationShortcuts( |
| 190 const Extension* extension) { | 189 const Extension* extension) { |
| 191 ShellIntegration::ShortcutInfo delete_info = | 190 ShellIntegration::ShortcutInfo delete_info = |
| 192 web_app::ShortcutInfoForExtensionAndProfile(extension, profile_); | 191 web_app::ShortcutInfoForExtensionAndProfile(extension, profile_); |
| 193 web_app::DeleteAllShortcuts(delete_info); | 192 web_app::DeleteAllShortcuts(delete_info); |
| 194 } | 193 } |
| OLD | NEW |