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

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/string16.h"
9 #include "base/utf_string_conversions.h"
10 #include "base/win/registry.h"
11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/installer/util/util_constants.h"
13
14 namespace auto_launch_util {
15
16 static const wchar_t kRunKey[] =
grt (UTC plus 2) 2011/11/29 18:55:45 can you use base::win::*AutoRun methods instead of
grt (UTC plus 2) 2011/11/29 18:55:45 prefer the unnamed namespace over "static". for e
17 L"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
18
19 static const wchar_t kAutolaunchKeyValue[] = L"GoogleChromeAutoLaunch";
20
21 bool IsAutoLaunched() {
22 base::win::RegKey key(HKEY_CURRENT_USER, kRunKey, KEY_QUERY_VALUE);
23
24 string16 autolaunch;
25 if (ERROR_SUCCESS != key.ReadValue(kAutolaunchKeyValue, &autolaunch))
26 return false;
27
28 return autolaunch.find(
29 ASCIIToUTF16(switches::kAutoLaunchAtStartup)) != string16::npos;
30 }
31
32 void SetIsAutoLaunched(bool auto_launch, const FilePath& application_path) {
33 base::win::RegKey key(HKEY_CURRENT_USER, kRunKey, KEY_SET_VALUE);
34 if (auto_launch) {
35 string16 cmd_line = L"\"";
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(kAutolaunchKeyValue, cmd_line.c_str());
42 } else {
43 key.DeleteValue(kAutolaunchKeyValue);
44 }
45 }
46
47 } // namespace
grt (UTC plus 2) 2011/11/29 18:55:45 } // namespace auto_launch_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698