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

Unified Diff: chrome/installer/setup/install_worker.cc

Issue 10810021: Register Chrome in Active Setup to be called by Windows at user login. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/setup/install_worker.cc
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc
index f7067c5fbe47e00ff74ba1933ee10e3f866477ad..93c786c3370a1c8cad2e4989f72c067ae347f1a1 100644
--- a/chrome/installer/setup/install_worker.cc
+++ b/chrome/installer/setup/install_worker.cc
@@ -18,6 +18,7 @@
#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
+#include "base/string16.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/version.h"
@@ -26,13 +27,15 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/installer/setup/install.h"
#include "chrome/installer/setup/setup_constants.h"
+#include "chrome/installer/setup/setup_util.h"
+#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/conditional_work_item_list.h"
#include "chrome/installer/util/create_reg_key_work_item.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/helper.h"
+#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/installation_state.h"
#include "chrome/installer/util/installer_state.h"
-#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/l10n_string_util.h"
#include "chrome/installer/util/product.h"
#include "chrome/installer/util/set_reg_value_work_item.h"
@@ -857,6 +860,9 @@ void AddInstallWorkItems(const InstallationState& original_state,
AddDelegateExecuteWorkItems(installer_state, src_path, new_version,
*product, install_list);
+
+ AddActiveSetupWorkItems(installer_state, new_version, *product,
+ install_list);
}
if (installer_state.is_multi_install()) {
@@ -1185,6 +1191,50 @@ void AddDelegateExecuteWorkItems(const InstallerState& installer_state,
}
}
+void AddActiveSetupWorkItems(const InstallerState& installer_state,
+ const Version& new_version,
+ const Product& product,
+ WorkItemList* list) {
+ DCHECK(installer_state.operation() != InstallerState::UNINSTALL);
+ BrowserDistribution* distribution = product.distribution();
+
+ if (!product.is_chrome() || !installer_state.system_install()) {
+ const char* install_level =
+ installer_state.system_install() ? "system" : "user";
+ VLOG(1) << "No Active Setup processing to do for " << install_level
+ << "-level " << distribution->GetAppShortCutName();
+ return;
+ }
+
+ const HKEY root = HKEY_LOCAL_MACHINE;
+ const string16 active_setup_path(GetActiveSetupPath(distribution));
+
+ VLOG(1) << "Adding registration items for Active Setup.";
+ list->AddCreateRegKeyWorkItem(root, active_setup_path);
+ list->AddSetRegValueWorkItem(root, active_setup_path, L"",
+ distribution->GetAppShortCutName(), true);
+
+ CommandLine cmd(installer_state.GetInstallerDirectory(new_version).
+ Append(installer::kSetupExe));
+ cmd.AppendSwitch(installer::switches::kConfigureUserSettings);
+ cmd.AppendSwitch(installer::switches::kVerboseLogging);
+ list->AddSetRegValueWorkItem(root, active_setup_path, L"StubPath",
+ cmd.GetCommandLineString(), true);
+
+ // TODO(grt): http://crbug.com/75152 Write a reference to a localized
+ // resource.
+ list->AddSetRegValueWorkItem(root, active_setup_path, L"Localized Name",
+ distribution->GetAppShortCutName(), true);
+
+ list->AddSetRegValueWorkItem(root, active_setup_path, L"IsInstalled",
+ DWORD(1U), true);
tommi (sloooow) - chröme 2012/07/20 09:59:25 static_cast<DWORD>(1U). Is the cast actually nece
gab 2012/07/20 14:45:47 Done. Yes the cast is necessary otherwise I get:
+
+ string16 comma_separated_version(ASCIIToUTF16(new_version.GetString()));
+ ReplaceChars(comma_separated_version, L".", L",", &comma_separated_version);
+ list->AddSetRegValueWorkItem(root, active_setup_path, L"Version",
+ comma_separated_version, true);
+}
+
namespace {
enum ElevationPolicyId {

Powered by Google App Engine
This is Rietveld 408576698