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/installer/util/auto_launch_util.h" | 5 #include "chrome/installer/util/auto_launch_util.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 43 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
44 if (command_line.HasSwitch(switches::kUserDataDir)) { | 44 if (command_line.HasSwitch(switches::kUserDataDir)) { |
45 path = command_line.GetSwitchValuePath(switches::kUserDataDir); | 45 path = command_line.GetSwitchValuePath(switches::kUserDataDir); |
46 } else { | 46 } else { |
47 // Get the path from the same source as the installer, to make sure there | 47 // Get the path from the same source as the installer, to make sure there |
48 // are no differences. | 48 // are no differences. |
49 BrowserDistribution* distribution = | 49 BrowserDistribution* distribution = |
50 BrowserDistribution::GetSpecificDistribution( | 50 BrowserDistribution::GetSpecificDistribution( |
51 BrowserDistribution::CHROME_BROWSER); | 51 BrowserDistribution::CHROME_BROWSER); |
52 installer::Product product(distribution); | 52 installer::Product product(distribution); |
53 path = product.GetUserDataPath(); | 53 std::vector<FilePath> data_dir_paths; |
| 54 product.GetUserDataPaths(&data_dir_paths); |
| 55 if (!data_dir_paths.empty()) |
| 56 path = data_dir_paths[0]; |
54 } | 57 } |
55 path = path.Append(profile_directory); | 58 path = path.Append(profile_directory); |
56 | 59 |
57 std::string input(path.AsUTF8Unsafe()); | 60 std::string input(path.AsUTF8Unsafe()); |
58 uint8 hash[16]; | 61 uint8 hash[16]; |
59 crypto::SHA256HashString(input, hash, sizeof(hash)); | 62 crypto::SHA256HashString(input, hash, sizeof(hash)); |
60 std::string hash_string = base::HexEncode(hash, sizeof(hash)); | 63 std::string hash_string = base::HexEncode(hash, sizeof(hash)); |
61 return string16(kAutolaunchKeyValue) + | 64 return string16(kAutolaunchKeyValue) + |
62 ASCIIToWide("_") + ASCIIToWide(hash_string); | 65 ASCIIToWide("_") + ASCIIToWide(hash_string); |
63 } | 66 } |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 246 } |
244 | 247 |
245 void DisableBackgroundStartAtLogin() { | 248 void DisableBackgroundStartAtLogin() { |
246 SetWillLaunchAtLogin(FilePath(), | 249 SetWillLaunchAtLogin(FilePath(), |
247 ASCIIToUTF16(chrome::kInitialProfile), | 250 ASCIIToUTF16(chrome::kInitialProfile), |
248 FLAG_PRESERVE, | 251 FLAG_PRESERVE, |
249 FLAG_DISABLE); | 252 FLAG_DISABLE); |
250 } | 253 } |
251 | 254 |
252 } // namespace auto_launch_util | 255 } // namespace auto_launch_util |
OLD | NEW |