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