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/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/policy/policy_path_parser.h" |
14 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
18 | 19 |
19 using content::BrowserThread; | 20 using content::BrowserThread; |
20 | 21 |
21 ShellIntegration::DefaultWebClientSetPermission | 22 ShellIntegration::DefaultWebClientSetPermission |
22 ShellIntegration::CanSetAsDefaultProtocolClient() { | 23 ShellIntegration::CanSetAsDefaultProtocolClient() { |
23 // Allowed as long as the browser can become the operating system default | 24 // Allowed as long as the browser can become the operating system default |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 CommandLine ShellIntegration::CommandLineArgsForLauncher( | 56 CommandLine ShellIntegration::CommandLineArgsForLauncher( |
56 const GURL& url, | 57 const GURL& url, |
57 const std::string& extension_app_id, | 58 const std::string& extension_app_id, |
58 const base::FilePath& profile_path) { | 59 const base::FilePath& profile_path) { |
59 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); | 60 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); |
60 CommandLine new_cmd_line(CommandLine::NO_PROGRAM); | 61 CommandLine new_cmd_line(CommandLine::NO_PROGRAM); |
61 | 62 |
62 // Use the same UserDataDir for new launches that we currently have set. | 63 // Use the same UserDataDir for new launches that we currently have set. |
63 base::FilePath user_data_dir = | 64 base::FilePath user_data_dir = |
64 cmd_line.GetSwitchValuePath(switches::kUserDataDir); | 65 cmd_line.GetSwitchValuePath(switches::kUserDataDir); |
| 66 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 67 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); |
| 68 #endif |
65 if (!user_data_dir.empty()) { | 69 if (!user_data_dir.empty()) { |
66 // Make sure user_data_dir is an absolute path. | 70 // Make sure user_data_dir is an absolute path. |
67 if (file_util::AbsolutePath(&user_data_dir) && | 71 if (file_util::AbsolutePath(&user_data_dir) && |
68 file_util::PathExists(user_data_dir)) { | 72 file_util::PathExists(user_data_dir)) { |
69 new_cmd_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); | 73 new_cmd_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
70 } | 74 } |
71 } | 75 } |
72 | 76 |
73 #if defined(OS_CHROMEOS) | 77 #if defined(OS_CHROMEOS) |
74 base::FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile); | 78 base::FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( | 286 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( |
283 protocol_); | 287 protocol_); |
284 } | 288 } |
285 break; | 289 break; |
286 default: | 290 default: |
287 NOTREACHED(); | 291 NOTREACHED(); |
288 } | 292 } |
289 | 293 |
290 return result; | 294 return result; |
291 } | 295 } |
OLD | NEW |