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

Unified Diff: chrome/installer/util/product_command.cc

Issue 6588003: Add support for the quick-enable-cf command to the installer. This encompase... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months 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/product_command.cc
===================================================================
--- chrome/installer/util/product_command.cc (revision 0)
+++ chrome/installer/util/product_command.cc (revision 0)
@@ -0,0 +1,88 @@
+// 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/product_command.h"
+
+#include "base/logging.h"
+#include "base/win/registry.h"
+#include "chrome/installer/util/google_update_constants.h"
+#include "chrome/installer/util/work_item_list.h"
+
+namespace installer {
+
+ProductCommand::ProductCommand()
+ : sends_pings_(false),
+ is_web_accessible_(false) {
+}
+
+ProductCommand::ProductCommand(const std::wstring& command_line,
+ bool sends_pings,
+ bool is_web_accessible)
+ : command_line_(command_line),
+ sends_pings_(sends_pings),
+ is_web_accessible_(is_web_accessible) {
+}
+
+bool ProductCommand::Initialize(const base::win::RegKey& key) {
+ if (!key.Valid()) {
+ LOG(DFATAL) << "Cannot initialize a ProductCommand from an invalid key.";
+ return false;
+ }
+
+ LONG result = ERROR_SUCCESS;
+ std::wstring cmd_line;
+ DWORD sends_pings = 0;
+ DWORD is_web_acc = 0;
+
+ result = key.ReadValue(google_update::kRegCommandLineField, &cmd_line);
+ if (result != ERROR_SUCCESS) {
+ LOG(WARNING) << "Error reading " << google_update::kRegCommandLineField
+ << " value from registry: " << result;
+ return false;
+ }
+
+ result = key.ReadValueDW(google_update::kRegSendsPingsField, &sends_pings);
+ if (result != ERROR_SUCCESS) {
+ LOG(WARNING) << "Error reading " << google_update::kRegSendsPingsField
+ << " value from registry: " << result;
+ return false;
+ }
+
+ result = key.ReadValueDW(google_update::kRegWebAccessibleField, &is_web_acc);
+ if (result != ERROR_SUCCESS) {
+ LOG(WARNING) << "Error reading " << google_update::kRegWebAccessibleField
+ << " value from registry: " << result;
+ return false;
+ }
+
+ command_line_.swap(cmd_line);
+ sends_pings_ = (sends_pings != 0);
+ is_web_accessible_ = (is_web_acc != 0);
+
+ return true;
+}
+
+void ProductCommand::AddWorkItems(HKEY predefined_root,
+ const std::wstring& command_path,
+ WorkItemList* item_list) const {
+ const DWORD sends_pings = sends_pings_ ? 1U : 0U;
+ const DWORD is_web_accessible = is_web_accessible_ ? 1U : 0U;
+
+ item_list->AddCreateRegKeyWorkItem(predefined_root, command_path)
+ ->set_log_message("creating quick-enable-cf command registry key");
+ item_list->AddSetRegValueWorkItem(predefined_root, command_path,
+ google_update::kRegCommandLineField,
+ command_line_, true)
+ ->set_log_message("setting quick-enable-cf CommandLine registry value");
+ item_list->AddSetRegValueWorkItem(predefined_root, command_path,
+ google_update::kRegSendsPingsField,
+ sends_pings, true)
+ ->set_log_message("setting quick-enable-cf SendsPings registry value");
+ item_list->AddSetRegValueWorkItem(predefined_root, command_path,
+ google_update::kRegWebAccessibleField,
+ is_web_accessible, true)
+ ->set_log_message("setting quick-enable-cf WebAccessible registry value");
+}
+
+} // namespace installer
Property changes on: chrome\installer\util\product_command.cc
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698