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