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

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/path_service.h"
10 #include "base/string16.h"
11 #include "base/utf_string_conversions.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 // The name of the Chrome Auto-launch key under the Run key.
19 const wchar_t kAutolaunchKeyValue[] = L"GoogleChromeAutoLaunch";
20
21 bool WillLaunchAtLogin() {
22 string16 autolaunch;
23 if (!base::win::ReadCommandFromAutoRun(
24 HKEY_CURRENT_USER, kAutolaunchKeyValue, &autolaunch)) {
25 return false;
26 }
27
28 FilePath chrome_exe;
29 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
30 NOTREACHED();
31 return false;
32 }
33
34 return autolaunch.find(chrome_exe.value()) != string16::npos;
35 }
36
37 void SetWillLaunchAtLogin(bool auto_launch, FilePath application_path) {
grt (UTC plus 2) 2011/12/03 04:43:38 const FilePath&
Finnur 2011/12/13 15:53:24 Done.
38 if (auto_launch) {
39 if (application_path.empty()) {
40 if (!PathService::Get(base::DIR_EXE, &application_path)) {
41 NOTREACHED();
42 return;
43 }
44 }
45 string16 cmd_line = ASCIIToUTF16("\"");
46 cmd_line += application_path.value();
47 cmd_line += ASCIIToUTF16("\\");
48 cmd_line += installer::kChromeExe;
49 cmd_line += ASCIIToUTF16("\" --");
50 cmd_line += ASCIIToUTF16(switches::kAutoLaunchAtStartup);
51
52 base::win::AddCommandToAutoRun(
53 HKEY_CURRENT_USER, kAutolaunchKeyValue, cmd_line);
54 } else {
55 base::win::RemoveCommandFromAutoRun(HKEY_CURRENT_USER, kAutolaunchKeyValue);
56 }
57 }
58
59 } // namespace auto_launch_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698