| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_applications/web_app.h" | 5 #include "chrome/browser/web_applications/web_app.h" | 
| 6 | 6 | 
| 7 #include "base/environment.h" | 7 #include "base/environment.h" | 
| 8 #include "base/logging.h" | 8 #include "base/logging.h" | 
| 9 #include "chrome/browser/shell_integration_linux.h" | 9 #include "chrome/browser/shell_integration_linux.h" | 
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" | 
| 11 | 11 | 
| 12 namespace web_app { | 12 namespace web_app { | 
| 13 | 13 | 
| 14 namespace internals { | 14 namespace internals { | 
| 15 | 15 | 
| 16 bool CreatePlatformShortcuts( | 16 bool CreatePlatformShortcuts( | 
| 17     const base::FilePath& web_app_path, | 17     const base::FilePath& web_app_path, | 
| 18     const ShellIntegration::ShortcutInfo& shortcut_info, | 18     const web_app::ShortcutInfo& shortcut_info, | 
| 19     const ShellIntegration::ShortcutLocations& creation_locations, | 19     const web_app::ShortcutLocations& creation_locations, | 
| 20     ShortcutCreationReason /*creation_reason*/) { | 20     ShortcutCreationReason /*creation_reason*/) { | 
| 21 #if !defined(OS_CHROMEOS) | 21 #if !defined(OS_CHROMEOS) | 
| 22   DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 22   DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 
| 23   return ShellIntegrationLinux::CreateDesktopShortcut( | 23   return ShellIntegrationLinux::CreateDesktopShortcut( | 
| 24       shortcut_info, creation_locations); | 24       shortcut_info, creation_locations); | 
| 25 #else | 25 #else | 
| 26   return false; | 26   return false; | 
| 27 #endif | 27 #endif | 
| 28 } | 28 } | 
| 29 | 29 | 
| 30 void DeletePlatformShortcuts( | 30 void DeletePlatformShortcuts( | 
| 31     const base::FilePath& web_app_path, | 31     const base::FilePath& web_app_path, | 
| 32     const ShellIntegration::ShortcutInfo& shortcut_info) { | 32     const web_app::ShortcutInfo& shortcut_info) { | 
| 33 #if !defined(OS_CHROMEOS) | 33 #if !defined(OS_CHROMEOS) | 
| 34   ShellIntegrationLinux::DeleteDesktopShortcuts(shortcut_info.profile_path, | 34   ShellIntegrationLinux::DeleteDesktopShortcuts(shortcut_info.profile_path, | 
| 35       shortcut_info.extension_id); | 35       shortcut_info.extension_id); | 
| 36 #endif | 36 #endif | 
| 37 } | 37 } | 
| 38 | 38 | 
| 39 void UpdatePlatformShortcuts( | 39 void UpdatePlatformShortcuts( | 
| 40     const base::FilePath& web_app_path, | 40     const base::FilePath& web_app_path, | 
| 41     const base::string16& /*old_app_title*/, | 41     const base::string16& /*old_app_title*/, | 
| 42     const ShellIntegration::ShortcutInfo& shortcut_info) { | 42     const web_app::ShortcutInfo& shortcut_info) { | 
| 43   DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 43   DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 
| 44 | 44 | 
| 45   scoped_ptr<base::Environment> env(base::Environment::Create()); | 45   scoped_ptr<base::Environment> env(base::Environment::Create()); | 
| 46 | 46 | 
| 47   // Find out whether shortcuts are already installed. | 47   // Find out whether shortcuts are already installed. | 
| 48   ShellIntegration::ShortcutLocations creation_locations = | 48   web_app::ShortcutLocations creation_locations = | 
| 49       ShellIntegrationLinux::GetExistingShortcutLocations( | 49       ShellIntegrationLinux::GetExistingShortcutLocations( | 
| 50           env.get(), shortcut_info.profile_path, shortcut_info.extension_id); | 50           env.get(), shortcut_info.profile_path, shortcut_info.extension_id); | 
| 51   // Always create a hidden shortcut in applications if a visible one is not | 51   // Always create a hidden shortcut in applications if a visible one is not | 
| 52   // being created. This allows the operating system to identify the app, but | 52   // being created. This allows the operating system to identify the app, but | 
| 53   // not show it in the menu. | 53   // not show it in the menu. | 
| 54   creation_locations.hidden = true; | 54   creation_locations.hidden = true; | 
| 55 | 55 | 
| 56   CreatePlatformShortcuts(web_app_path, shortcut_info, creation_locations, | 56   CreatePlatformShortcuts(web_app_path, shortcut_info, creation_locations, | 
| 57                           SHORTCUT_CREATION_BY_USER); | 57                           SHORTCUT_CREATION_BY_USER); | 
| 58 } | 58 } | 
| 59 | 59 | 
| 60 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) { | 60 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) { | 
| 61 #if !defined(OS_CHROMEOS) | 61 #if !defined(OS_CHROMEOS) | 
| 62   ShellIntegrationLinux::DeleteAllDesktopShortcuts(profile_path); | 62   ShellIntegrationLinux::DeleteAllDesktopShortcuts(profile_path); | 
| 63 #endif | 63 #endif | 
| 64 } | 64 } | 
| 65 | 65 | 
| 66 }  // namespace internals | 66 }  // namespace internals | 
| 67 | 67 | 
| 68 }  // namespace web_app | 68 }  // namespace web_app | 
| OLD | NEW | 
|---|