| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 void DeletePlatformShortcuts( | 33 void DeletePlatformShortcuts( |
| 34 const base::FilePath& web_app_path, | 34 const base::FilePath& web_app_path, |
| 35 const ShellIntegration::ShortcutInfo& shortcut_info) { | 35 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 36 ShellIntegrationLinux::DeleteDesktopShortcuts(shortcut_info.profile_path, | 36 ShellIntegrationLinux::DeleteDesktopShortcuts(shortcut_info.profile_path, |
| 37 shortcut_info.extension_id); | 37 shortcut_info.extension_id); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void UpdatePlatformShortcuts( | 40 void UpdatePlatformShortcuts( |
| 41 const base::FilePath& web_app_path, | 41 const base::FilePath& web_app_path, |
| 42 const ShellIntegration::ShortcutInfo& shortcut_info) { | 42 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 43 // TODO(benwells): Implement this. | 43 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| 44 |
| 45 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 46 |
| 47 // Find out whether shortcuts are already installed. |
| 48 ShellIntegration::ShortcutLocations creation_locations = |
| 49 ShellIntegrationLinux::DesktopShortcutLocations( |
| 50 env.get(), shortcut_info.profile_path, shortcut_info.extension_id); |
| 51 |
| 52 // If there is are existing shortcuts, this will update them and the icon. |
| 53 // If not, this will create an app shortcut with NoDisplay=true, which allows |
| 54 // the operating system to identify the app, but not show it in the menu. |
| 55 // Note that a shortcut with NoDisplay=true does not cause app_shortcut_info |
| 56 // to be true, so the update will preserve the value of NoDisplay. |
| 57 CreatePlatformShortcuts(web_app_path, shortcut_info, creation_locations); |
| 44 } | 58 } |
| 45 | 59 |
| 46 } // namespace internals | 60 } // namespace internals |
| 47 | 61 |
| 48 } // namespace web_app | 62 } // namespace web_app |
| OLD | NEW |