Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: chrome/browser/shell_integration.cc

Issue 13864015: Move app launcher and chrome apps shortcut strings into the installer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@migrate_app_id_fix
Patch Set: fix linux Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/shell_integration.h" 5 #include "chrome/browser/shell_integration.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/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
15 #include "chrome/browser/policy/policy_path_parser.h" 15 #include "chrome/browser/policy/policy_path_parser.h"
16 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 20
21 #if defined(OS_CHROMEOS) 21 #if defined(OS_CHROMEOS)
22 #include "chromeos/chromeos_switches.h" 22 #include "chromeos/chromeos_switches.h"
23 #endif 23 #endif
24 24
25 #if !defined(OS_WIN)
26 #include "chrome/common/chrome_version_info.h"
27 #include "grit/chromium_strings.h"
28 #include "ui/base/l10n/l10n_util.h"
29 #endif
30
25 using content::BrowserThread; 31 using content::BrowserThread;
26 32
27 ShellIntegration::DefaultWebClientSetPermission 33 ShellIntegration::DefaultWebClientSetPermission
28 ShellIntegration::CanSetAsDefaultProtocolClient() { 34 ShellIntegration::CanSetAsDefaultProtocolClient() {
29 // Allowed as long as the browser can become the operating system default 35 // Allowed as long as the browser can become the operating system default
30 // browser. 36 // browser.
31 return CanSetAsDefaultBrowser(); 37 return CanSetAsDefaultBrowser();
32 } 38 }
33 39
34 ShellIntegration::ShortcutInfo::ShortcutInfo() 40 ShellIntegration::ShortcutInfo::ShortcutInfo()
35 : is_platform_app(false) { 41 : is_platform_app(false) {
36 } 42 }
37 43
38 ShellIntegration::ShortcutInfo::~ShortcutInfo() {} 44 ShellIntegration::ShortcutInfo::~ShortcutInfo() {}
39 45
40 ShellIntegration::ShortcutLocations::ShortcutLocations() 46 ShellIntegration::ShortcutLocations::ShortcutLocations()
41 : on_desktop(false), 47 : on_desktop(false),
42 in_applications_menu(false), 48 applications_menu_location(APP_MENU_LOCATION_NONE),
43 in_quick_launch_bar(false), 49 in_quick_launch_bar(false),
44 hidden(false) { 50 hidden(false) {
45 } 51 }
46 52
47 static const struct ShellIntegration::AppModeInfo* gAppModeInfo = NULL; 53 static const struct ShellIntegration::AppModeInfo* gAppModeInfo = NULL;
48 54
49 // static 55 // static
50 void ShellIntegration::SetAppModeInfo(const struct AppModeInfo* info) { 56 void ShellIntegration::SetAppModeInfo(const struct AppModeInfo* info) {
51 gAppModeInfo = info; 57 gAppModeInfo = info;
52 } 58 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } else { 108 } else {
103 // Use '--app=url' instead of just 'url' to launch the browser with minimal 109 // Use '--app=url' instead of just 'url' to launch the browser with minimal
104 // chrome. 110 // chrome.
105 // Note: Do not change this flag! Old Gears shortcuts will break if you do! 111 // Note: Do not change this flag! Old Gears shortcuts will break if you do!
106 new_cmd_line.AppendSwitchASCII(switches::kApp, url.spec()); 112 new_cmd_line.AppendSwitchASCII(switches::kApp, url.spec());
107 } 113 }
108 return new_cmd_line; 114 return new_cmd_line;
109 } 115 }
110 116
111 #if !defined(OS_WIN) 117 #if !defined(OS_WIN)
118
119 base::string16 ShellIntegration::GetAppShortcutsSubdirName() {
120 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
gab 2013/10/17 15:13:31 I think this can be inlined below and still fit on
calamity 2013/11/20 05:43:30 Done.
121 if (channel == chrome::VersionInfo::CHANNEL_CANARY)
122 return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY);
123 return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME);
124 }
125
112 // static 126 // static
113 bool ShellIntegration::SetAsDefaultBrowserInteractive() { 127 bool ShellIntegration::SetAsDefaultBrowserInteractive() {
114 return false; 128 return false;
115 } 129 }
116 130
117 // static 131 // static
118 bool ShellIntegration::SetAsDefaultProtocolClientInteractive( 132 bool ShellIntegration::SetAsDefaultProtocolClientInteractive(
119 const std::string& protocol) { 133 const std::string& protocol) {
120 return false; 134 return false;
121 } 135 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 case ShellIntegration::SET_DEFAULT_INTERACTIVE: 311 case ShellIntegration::SET_DEFAULT_INTERACTIVE:
298 if (interactive_permitted) { 312 if (interactive_permitted) {
299 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( 313 result = ShellIntegration::SetAsDefaultProtocolClientInteractive(
300 protocol_); 314 protocol_);
301 } 315 }
302 break; 316 break;
303 } 317 }
304 318
305 return result; 319 return result;
306 } 320 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698