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" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 CommandLine new_cmd_line(CommandLine::NO_PROGRAM); | 71 CommandLine new_cmd_line(CommandLine::NO_PROGRAM); |
72 | 72 |
73 // Use the same UserDataDir for new launches that we currently have set. | 73 // Use the same UserDataDir for new launches that we currently have set. |
74 base::FilePath user_data_dir = | 74 base::FilePath user_data_dir = |
75 cmd_line.GetSwitchValuePath(switches::kUserDataDir); | 75 cmd_line.GetSwitchValuePath(switches::kUserDataDir); |
76 #if defined(OS_MACOSX) || defined(OS_WIN) | 76 #if defined(OS_MACOSX) || defined(OS_WIN) |
77 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); | 77 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); |
78 #endif | 78 #endif |
79 if (!user_data_dir.empty()) { | 79 if (!user_data_dir.empty()) { |
80 // Make sure user_data_dir is an absolute path. | 80 // Make sure user_data_dir is an absolute path. |
81 if (file_util::AbsolutePath(&user_data_dir) && | 81 user_data_dir = base::MakeAbsoluteFilePath(user_data_dir); |
82 file_util::PathExists(user_data_dir)) { | 82 if (!user_data_dir.empty() && file_util::PathExists(user_data_dir)) |
83 new_cmd_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); | 83 new_cmd_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
84 } | |
85 } | 84 } |
86 | 85 |
87 #if defined(OS_CHROMEOS) | 86 #if defined(OS_CHROMEOS) |
88 base::FilePath profile = cmd_line.GetSwitchValuePath( | 87 base::FilePath profile = cmd_line.GetSwitchValuePath( |
89 chromeos::switches::kLoginProfile); | 88 chromeos::switches::kLoginProfile); |
90 if (!profile.empty()) | 89 if (!profile.empty()) |
91 new_cmd_line.AppendSwitchPath(chromeos::switches::kLoginProfile, profile); | 90 new_cmd_line.AppendSwitchPath(chromeos::switches::kLoginProfile, profile); |
92 #else | 91 #else |
93 if (!profile_path.empty() && !extension_app_id.empty()) | 92 if (!profile_path.empty() && !extension_app_id.empty()) |
94 new_cmd_line.AppendSwitchPath(switches::kProfileDirectory, | 93 new_cmd_line.AppendSwitchPath(switches::kProfileDirectory, |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( | 296 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( |
298 protocol_); | 297 protocol_); |
299 } | 298 } |
300 break; | 299 break; |
301 default: | 300 default: |
302 NOTREACHED(); | 301 NOTREACHED(); |
303 } | 302 } |
304 | 303 |
305 return result; | 304 return result; |
306 } | 305 } |
OLD | NEW |