| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 if (!data_dir_paths.empty()) | 55 if (!data_dir_paths.empty()) |
| 56 path = data_dir_paths[0]; | 56 path = data_dir_paths[0]; |
| 57 } | 57 } |
| 58 path = path.Append(profile_directory); | 58 path = path.Append(profile_directory); |
| 59 | 59 |
| 60 std::string input(path.AsUTF8Unsafe()); | 60 std::string input(path.AsUTF8Unsafe()); |
| 61 uint8 hash[16]; | 61 uint8 hash[16]; |
| 62 crypto::SHA256HashString(input, hash, sizeof(hash)); | 62 crypto::SHA256HashString(input, hash, sizeof(hash)); |
| 63 std::string hash_string = base::HexEncode(hash, sizeof(hash)); | 63 std::string hash_string = base::HexEncode(hash, sizeof(hash)); |
| 64 return string16(kAutolaunchKeyValue) + | 64 return string16(kAutolaunchKeyValue) + |
| 65 ASCIIToWide("_") + ASCIIToWide(hash_string); | 65 base::ASCIIToWide("_") + base::ASCIIToWide(hash_string); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Returns whether the Chrome executable specified in |application_path| is set | 68 // Returns whether the Chrome executable specified in |application_path| is set |
| 69 // to auto-launch at computer startup with a given |command_line_switch|. | 69 // to auto-launch at computer startup with a given |command_line_switch|. |
| 70 // NOTE: |application_path| is optional and should be blank in most cases (as | 70 // NOTE: |application_path| is optional and should be blank in most cases (as |
| 71 // it will default to the application path of the current executable). | 71 // it will default to the application path of the current executable). |
| 72 // |profile_directory| is the name of the directory (leaf, not the full path) | 72 // |profile_directory| is the name of the directory (leaf, not the full path) |
| 73 // that contains the profile that should be opened at computer startup. | 73 // that contains the profile that should be opened at computer startup. |
| 74 // |command_line_switch| is the switch we are optionally interested in and, if | 74 // |command_line_switch| is the switch we are optionally interested in and, if |
| 75 // not blank, must be present for the function to return true. If blank, it acts | 75 // not blank, must be present for the function to return true. If blank, it acts |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 246 } |
| 247 | 247 |
| 248 void DisableBackgroundStartAtLogin() { | 248 void DisableBackgroundStartAtLogin() { |
| 249 SetWillLaunchAtLogin(base::FilePath(), | 249 SetWillLaunchAtLogin(base::FilePath(), |
| 250 ASCIIToUTF16(chrome::kInitialProfile), | 250 ASCIIToUTF16(chrome::kInitialProfile), |
| 251 FLAG_PRESERVE, | 251 FLAG_PRESERVE, |
| 252 FLAG_DISABLE); | 252 FLAG_DISABLE); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace auto_launch_util | 255 } // namespace auto_launch_util |
| OLD | NEW |