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

Unified 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, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/auto_launch_util.cc
===================================================================
--- chrome/installer/util/auto_launch_util.cc (revision 0)
+++ chrome/installer/util/auto_launch_util.cc (revision 0)
@@ -0,0 +1,47 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/installer/util/auto_launch_util.h"
+
+#include "base/file_path.h"
+#include "base/logging.h"
+#include "base/string16.h"
+#include "base/utf_string_conversions.h"
+#include "base/win/registry.h"
+#include "base/win/win_util.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/installer/util/util_constants.h"
+
+namespace auto_launch_util {
+
+bool WillLaunchAtLogin() {
+ 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
+
+ string16 autolaunch;
+ if (ERROR_SUCCESS != key.ReadValue(base::win::kAutolaunchKeyValue,
+ &autolaunch))
+ return false;
+
+ return autolaunch.find(
+ 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
+}
+
+void SetWillLaunchAtLogin(bool auto_launch, const FilePath& application_path) {
+ // When |auto_launch| is true, a FilePath must be given.
+ DCHECK(!application_path.empty() || !auto_launch);
+ base::win::RegKey key(HKEY_CURRENT_USER, base::win::kRunKey, KEY_SET_VALUE);
+ if (auto_launch) {
+ string16 cmd_line = L"\"";
grt (UTC plus 2) 2011/12/01 04:45:02 i know this works on windows, but is combining wch
+ cmd_line += application_path.value();
+ cmd_line += L"\\";
+ cmd_line += installer::kChromeExe;
+ cmd_line += L"\" --";
+ cmd_line += ASCIIToUTF16(switches::kAutoLaunchAtStartup);
+ key.WriteValue(base::win::kAutolaunchKeyValue, cmd_line.c_str());
grt (UTC plus 2) 2011/12/01 04:45:02 use base::win:: AddCommandToAutoRun
+ } else {
+ key.DeleteValue(base::win::kAutolaunchKeyValue);
grt (UTC plus 2) 2011/12/01 04:45:02 use base::win::RemoveCommandFromAutoRun
+ }
+}
+
+} // namespace auto_launch_util
Property changes on: chrome\installer\util\auto_launch_util.cc
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698