|
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/installer/util/auto_launch_util.h" | |
6 | |
7 #include "base/file_path.h" | |
8 #include "base/logging.h" | |
9 #include "base/string16.h" | |
10 #include "base/utf_string_conversions.h" | |
11 #include "base/win/registry.h" | |
12 #include "base/win/win_util.h" | |
13 #include "chrome/common/chrome_switches.h" | |
14 #include "chrome/installer/util/util_constants.h" | |
15 | |
16 namespace auto_launch_util { | |
17 | |
18 bool WillLaunchAtLogin() { | |
19 base::win::RegKey key(HKEY_CURRENT_USER, base::win::kRunKey, KEY_QUERY_VALUE); | |
grt (UTC plus 2)
2011/12/01 04:45:02
replace lines 19-23 with:
string16 autolaunch;
if
| |
20 | |
21 string16 autolaunch; | |
22 if (ERROR_SUCCESS != key.ReadValue(base::win::kAutolaunchKeyValue, | |
23 &autolaunch)) | |
24 return false; | |
25 | |
26 return autolaunch.find( | |
27 ASCIIToUTF16(switches::kAutoLaunchAtStartup)) != string16::npos; | |
grt (UTC plus 2)
2011/12/01 04:45:02
why this extra check? isn't using our own name fo
| |
28 } | |
29 | |
30 void SetWillLaunchAtLogin(bool auto_launch, const FilePath& application_path) { | |
31 // When |auto_launch| is true, a FilePath must be given. | |
32 DCHECK(!application_path.empty() || !auto_launch); | |
33 base::win::RegKey key(HKEY_CURRENT_USER, base::win::kRunKey, KEY_SET_VALUE); | |
34 if (auto_launch) { | |
35 string16 cmd_line = L"\""; | |
grt (UTC plus 2)
2011/12/01 04:45:02
i know this works on windows, but is combining wch
| |
36 cmd_line += application_path.value(); | |
37 cmd_line += L"\\"; | |
38 cmd_line += installer::kChromeExe; | |
39 cmd_line += L"\" --"; | |
40 cmd_line += ASCIIToUTF16(switches::kAutoLaunchAtStartup); | |
41 key.WriteValue(base::win::kAutolaunchKeyValue, cmd_line.c_str()); | |
grt (UTC plus 2)
2011/12/01 04:45:02
use base::win:: AddCommandToAutoRun
| |
42 } else { | |
43 key.DeleteValue(base::win::kAutolaunchKeyValue); | |
grt (UTC plus 2)
2011/12/01 04:45:02
use base::win::RemoveCommandFromAutoRun
| |
44 } | |
45 } | |
46 | |
47 } // namespace auto_launch_util | |
OLD | NEW |