Give names to all utility processes.
[chromium-blink-merge.git] / chrome / browser / web_applications / web_app_linux.cc
blob1cd7e05bf6202c37f7aad68edd390e3dd19f0e51
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
3 // found in the LICENSE file.
5 #include "chrome/browser/web_applications/web_app.h"
7 #include "base/environment.h"
8 #include "base/logging.h"
9 #include "chrome/browser/shell_integration_linux.h"
10 #include "content/public/browser/browser_thread.h"
12 namespace web_app {
14 void UpdateShortcutsForAllApps(Profile* profile,
15 const base::Closure& callback) {
16 callback.Run();
19 namespace internals {
21 bool CreatePlatformShortcuts(
22 const base::FilePath& web_app_path,
23 const ShortcutInfo& shortcut_info,
24 const extensions::FileHandlersInfo& file_handlers_info,
25 const ShortcutLocations& creation_locations,
26 ShortcutCreationReason /*creation_reason*/) {
27 #if !defined(OS_CHROMEOS)
28 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
29 return shell_integration_linux::CreateDesktopShortcut(
30 shortcut_info, creation_locations);
31 #else
32 return false;
33 #endif
36 void DeletePlatformShortcuts(const base::FilePath& web_app_path,
37 const ShortcutInfo& shortcut_info) {
38 #if !defined(OS_CHROMEOS)
39 shell_integration_linux::DeleteDesktopShortcuts(shortcut_info.profile_path,
40 shortcut_info.extension_id);
41 #endif
44 void UpdatePlatformShortcuts(
45 const base::FilePath& web_app_path,
46 const base::string16& /*old_app_title*/,
47 const ShortcutInfo& shortcut_info,
48 const extensions::FileHandlersInfo& file_handlers_info) {
49 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
51 scoped_ptr<base::Environment> env(base::Environment::Create());
53 // Find out whether shortcuts are already installed.
54 ShortcutLocations creation_locations =
55 shell_integration_linux::GetExistingShortcutLocations(
56 env.get(), shortcut_info.profile_path, shortcut_info.extension_id);
58 // Always create a hidden shortcut in applications if a visible one is not
59 // being created. This allows the operating system to identify the app, but
60 // not show it in the menu.
61 if (creation_locations.applications_menu_location == APP_MENU_LOCATION_NONE)
62 creation_locations.applications_menu_location = APP_MENU_LOCATION_HIDDEN;
64 CreatePlatformShortcuts(web_app_path,
65 shortcut_info,
66 file_handlers_info,
67 creation_locations,
68 SHORTCUT_CREATION_AUTOMATED);
71 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) {
72 #if !defined(OS_CHROMEOS)
73 shell_integration_linux::DeleteAllDesktopShortcuts(profile_path);
74 #endif
77 } // namespace internals
79 } // namespace web_app