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/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 #if defined(OS_POSIX) |
| 51 , hidden(false) |
| 52 #endif |
| 53 { |
45 } | 54 } |
46 | 55 |
47 static const struct ShellIntegration::AppModeInfo* gAppModeInfo = NULL; | 56 static const struct ShellIntegration::AppModeInfo* gAppModeInfo = NULL; |
48 | 57 |
49 // static | 58 // static |
50 void ShellIntegration::SetAppModeInfo(const struct AppModeInfo* info) { | 59 void ShellIntegration::SetAppModeInfo(const struct AppModeInfo* info) { |
51 gAppModeInfo = info; | 60 gAppModeInfo = info; |
52 } | 61 } |
53 | 62 |
54 // static | 63 // static |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } else { | 111 } else { |
103 // Use '--app=url' instead of just 'url' to launch the browser with minimal | 112 // Use '--app=url' instead of just 'url' to launch the browser with minimal |
104 // chrome. | 113 // chrome. |
105 // Note: Do not change this flag! Old Gears shortcuts will break if you do! | 114 // Note: Do not change this flag! Old Gears shortcuts will break if you do! |
106 new_cmd_line.AppendSwitchASCII(switches::kApp, url.spec()); | 115 new_cmd_line.AppendSwitchASCII(switches::kApp, url.spec()); |
107 } | 116 } |
108 return new_cmd_line; | 117 return new_cmd_line; |
109 } | 118 } |
110 | 119 |
111 #if !defined(OS_WIN) | 120 #if !defined(OS_WIN) |
| 121 |
| 122 base::string16 ShellIntegration::GetAppShortcutsSubdirName() { |
| 123 if (chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_CANARY) |
| 124 return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY); |
| 125 return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME); |
| 126 } |
| 127 |
112 // static | 128 // static |
113 bool ShellIntegration::SetAsDefaultBrowserInteractive() { | 129 bool ShellIntegration::SetAsDefaultBrowserInteractive() { |
114 return false; | 130 return false; |
115 } | 131 } |
116 | 132 |
117 // static | 133 // static |
118 bool ShellIntegration::SetAsDefaultProtocolClientInteractive( | 134 bool ShellIntegration::SetAsDefaultProtocolClientInteractive( |
119 const std::string& protocol) { | 135 const std::string& protocol) { |
120 return false; | 136 return false; |
121 } | 137 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 case ShellIntegration::SET_DEFAULT_INTERACTIVE: | 313 case ShellIntegration::SET_DEFAULT_INTERACTIVE: |
298 if (interactive_permitted) { | 314 if (interactive_permitted) { |
299 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( | 315 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( |
300 protocol_); | 316 protocol_); |
301 } | 317 } |
302 break; | 318 break; |
303 } | 319 } |
304 | 320 |
305 return result; | 321 return result; |
306 } | 322 } |
OLD | NEW |