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/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.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) |
| 22 #include "chromeos/chromeos_switches.h" |
| 23 #endif |
| 24 |
21 using content::BrowserThread; | 25 using content::BrowserThread; |
22 | 26 |
23 ShellIntegration::DefaultWebClientSetPermission | 27 ShellIntegration::DefaultWebClientSetPermission |
24 ShellIntegration::CanSetAsDefaultProtocolClient() { | 28 ShellIntegration::CanSetAsDefaultProtocolClient() { |
25 // Allowed as long as the browser can become the operating system default | 29 // Allowed as long as the browser can become the operating system default |
26 // browser. | 30 // browser. |
27 return CanSetAsDefaultBrowser(); | 31 return CanSetAsDefaultBrowser(); |
28 } | 32 } |
29 | 33 |
30 ShellIntegration::ShortcutInfo::ShortcutInfo() | 34 ShellIntegration::ShortcutInfo::ShortcutInfo() |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 #endif | 78 #endif |
75 if (!user_data_dir.empty()) { | 79 if (!user_data_dir.empty()) { |
76 // Make sure user_data_dir is an absolute path. | 80 // Make sure user_data_dir is an absolute path. |
77 if (file_util::AbsolutePath(&user_data_dir) && | 81 if (file_util::AbsolutePath(&user_data_dir) && |
78 file_util::PathExists(user_data_dir)) { | 82 file_util::PathExists(user_data_dir)) { |
79 new_cmd_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); | 83 new_cmd_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
80 } | 84 } |
81 } | 85 } |
82 | 86 |
83 #if defined(OS_CHROMEOS) | 87 #if defined(OS_CHROMEOS) |
84 base::FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile); | 88 base::FilePath profile = cmd_line.GetSwitchValuePath( |
| 89 chromeos::switches::kLoginProfile); |
85 if (!profile.empty()) | 90 if (!profile.empty()) |
86 new_cmd_line.AppendSwitchPath(switches::kLoginProfile, profile); | 91 new_cmd_line.AppendSwitchPath(chromeos::switches::kLoginProfile, profile); |
87 #else | 92 #else |
88 if (!profile_path.empty() && !extension_app_id.empty()) | 93 if (!profile_path.empty() && !extension_app_id.empty()) |
89 new_cmd_line.AppendSwitchPath(switches::kProfileDirectory, | 94 new_cmd_line.AppendSwitchPath(switches::kProfileDirectory, |
90 profile_path.BaseName()); | 95 profile_path.BaseName()); |
91 #endif | 96 #endif |
92 | 97 |
93 // If |extension_app_id| is present, we use the kAppId switch rather than | 98 // If |extension_app_id| is present, we use the kAppId switch rather than |
94 // the kApp switch (the launch url will be read from the extension app | 99 // the kApp switch (the launch url will be read from the extension app |
95 // during launch. | 100 // during launch. |
96 if (!extension_app_id.empty()) { | 101 if (!extension_app_id.empty()) { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( | 297 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( |
293 protocol_); | 298 protocol_); |
294 } | 299 } |
295 break; | 300 break; |
296 default: | 301 default: |
297 NOTREACHED(); | 302 NOTREACHED(); |
298 } | 303 } |
299 | 304 |
300 return result; | 305 return result; |
301 } | 306 } |
OLD | NEW |