Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chrome/installer/util/auto_launch_util.cc

Issue 8729009: Implement an AutoLaunch experiment for Chrome for certain brand codes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698