| 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 21 matching lines...) Expand all Loading... |
| 32 #endif | 32 #endif |
| 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(Profile* profile, | 40 void CreateShortcutsInApplicationsMenu(Profile* profile, |
| 41 const Extension* app) { | 41 const Extension* app) { |
| 42 ShellIntegration::ShortcutLocations creation_locations; | 42 web_app::ShortcutLocations creation_locations; |
| 43 // Create the shortcut in the Chrome Apps subdir. | 43 // Create the shortcut in the Chrome Apps subdir. |
| 44 creation_locations.applications_menu_location = | 44 creation_locations.applications_menu_location = |
| 45 ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS; | 45 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS; |
| 46 web_app::CreateShortcuts( | 46 web_app::CreateShortcuts( |
| 47 web_app::SHORTCUT_CREATION_AUTOMATED, creation_locations, profile, app); | 47 web_app::SHORTCUT_CREATION_AUTOMATED, creation_locations, profile, app); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool ShouldCreateShortcutFor(const Extension* extension) { | 50 bool ShouldCreateShortcutFor(const Extension* extension) { |
| 51 return extension->is_platform_app() && | 51 return extension->is_platform_app() && |
| 52 extension->location() != extensions::Manifest::COMPONENT && | 52 extension->location() != extensions::Manifest::COMPONENT && |
| 53 extension->ShouldDisplayInAppLauncher(); | 53 extension->ShouldDisplayInAppLauncher(); |
| 54 } | 54 } |
| 55 | 55 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 return; | 175 return; |
| 176 | 176 |
| 177 // Create an applications menu shortcut for each app in this profile. | 177 // Create an applications menu shortcut for each app in this profile. |
| 178 const extensions::ExtensionSet* apps = extension_service->extensions(); | 178 const extensions::ExtensionSet* apps = extension_service->extensions(); |
| 179 for (extensions::ExtensionSet::const_iterator it = apps->begin(); | 179 for (extensions::ExtensionSet::const_iterator it = apps->begin(); |
| 180 it != apps->end(); ++it) { | 180 it != apps->end(); ++it) { |
| 181 if (ShouldCreateShortcutFor(it->get())) | 181 if (ShouldCreateShortcutFor(it->get())) |
| 182 CreateShortcutsInApplicationsMenu(profile_, it->get()); | 182 CreateShortcutsInApplicationsMenu(profile_, it->get()); |
| 183 } | 183 } |
| 184 } | 184 } |
| OLD | NEW |