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

Side by Side 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: rebase onto 147656 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/installer/setup/install_worker.h ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file contains the definitions of the installer functions that build 5 // This file contains the definitions of the installer functions that build
6 // the WorkItemList used to install the application. 6 // the WorkItemList used to install the application.
7 7
8 #include "chrome/installer/setup/install_worker.h" 8 #include "chrome/installer/setup/install_worker.h"
9 9
10 #include <oaidl.h> 10 #include <oaidl.h>
11 #include <shlobj.h> 11 #include <shlobj.h>
12 #include <time.h> 12 #include <time.h>
13 13
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/file_path.h" 17 #include "base/file_path.h"
18 #include "base/file_util.h" 18 #include "base/file_util.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/string16.h"
21 #include "base/string_util.h" 22 #include "base/string_util.h"
22 #include "base/utf_string_conversions.h" 23 #include "base/utf_string_conversions.h"
23 #include "base/version.h" 24 #include "base/version.h"
24 #include "base/win/registry.h" 25 #include "base/win/registry.h"
25 #include "base/win/windows_version.h" 26 #include "base/win/windows_version.h"
26 #include "chrome/common/chrome_constants.h" 27 #include "chrome/common/chrome_constants.h"
27 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
28 #include "chrome/installer/setup/install.h" 29 #include "chrome/installer/setup/install.h"
29 #include "chrome/installer/setup/setup_constants.h" 30 #include "chrome/installer/setup/setup_constants.h"
31 #include "chrome/installer/setup/setup_util.h"
32 #include "chrome/installer/util/browser_distribution.h"
30 #include "chrome/installer/util/conditional_work_item_list.h" 33 #include "chrome/installer/util/conditional_work_item_list.h"
31 #include "chrome/installer/util/create_reg_key_work_item.h" 34 #include "chrome/installer/util/create_reg_key_work_item.h"
32 #include "chrome/installer/util/google_update_constants.h" 35 #include "chrome/installer/util/google_update_constants.h"
33 #include "chrome/installer/util/helper.h" 36 #include "chrome/installer/util/helper.h"
37 #include "chrome/installer/util/install_util.h"
34 #include "chrome/installer/util/installation_state.h" 38 #include "chrome/installer/util/installation_state.h"
35 #include "chrome/installer/util/installer_state.h" 39 #include "chrome/installer/util/installer_state.h"
36 #include "chrome/installer/util/install_util.h"
37 #include "chrome/installer/util/l10n_string_util.h" 40 #include "chrome/installer/util/l10n_string_util.h"
38 #include "chrome/installer/util/product.h" 41 #include "chrome/installer/util/product.h"
39 #include "chrome/installer/util/set_reg_value_work_item.h" 42 #include "chrome/installer/util/set_reg_value_work_item.h"
40 #include "chrome/installer/util/shell_util.h" 43 #include "chrome/installer/util/shell_util.h"
41 #include "chrome/installer/util/util_constants.h" 44 #include "chrome/installer/util/util_constants.h"
42 #include "chrome/installer/util/work_item_list.h" 45 #include "chrome/installer/util/work_item_list.h"
43 #include "chrome_frame/chrome_tab.h" 46 #include "chrome_frame/chrome_tab.h"
44 47
45 using base::win::RegKey; 48 using base::win::RegKey;
46 49
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 const Product* product = products[i]; 904 const Product* product = products[i];
902 905
903 AddUninstallShortcutWorkItems(installer_state, setup_path, new_version, 906 AddUninstallShortcutWorkItems(installer_state, setup_path, new_version,
904 install_list, *product); 907 install_list, *product);
905 908
906 AddVersionKeyWorkItems(root, product->distribution(), new_version, 909 AddVersionKeyWorkItems(root, product->distribution(), new_version,
907 add_language_identifier, install_list); 910 add_language_identifier, install_list);
908 911
909 AddDelegateExecuteWorkItems(installer_state, src_path, new_version, 912 AddDelegateExecuteWorkItems(installer_state, src_path, new_version,
910 *product, install_list); 913 *product, install_list);
914
915 AddActiveSetupWorkItems(installer_state, new_version, *product,
916 install_list);
911 } 917 }
912 918
913 // Add any remaining work items that involve special settings for 919 // Add any remaining work items that involve special settings for
914 // each product. 920 // each product.
915 AddProductSpecificWorkItems(original_state, installer_state, setup_path, 921 AddProductSpecificWorkItems(original_state, installer_state, setup_path,
916 new_version, install_list); 922 new_version, install_list);
917 923
918 // Copy over brand, usagestats, and other values. 924 // Copy over brand, usagestats, and other values.
919 AddGoogleUpdateWorkItems(original_state, installer_state, install_list); 925 AddGoogleUpdateWorkItems(original_state, installer_state, install_list);
920 926
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 1229
1224 } else { 1230 } else {
1225 VLOG(1) << "Adding unregistration items for DelegateExecute verb handler."; 1231 VLOG(1) << "Adding unregistration items for DelegateExecute verb handler.";
1226 1232
1227 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path); 1233 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path);
1228 list->AddDeleteRegKeyWorkItem(root, typelib_path); 1234 list->AddDeleteRegKeyWorkItem(root, typelib_path);
1229 list->AddDeleteRegKeyWorkItem(root, interface_path); 1235 list->AddDeleteRegKeyWorkItem(root, interface_path);
1230 } 1236 }
1231 } 1237 }
1232 1238
1239 void AddActiveSetupWorkItems(const InstallerState& installer_state,
1240 const Version& new_version,
1241 const Product& product,
1242 WorkItemList* list) {
1243 DCHECK(installer_state.operation() != InstallerState::UNINSTALL);
1244 BrowserDistribution* distribution = product.distribution();
1245
1246 if (!product.is_chrome() || !installer_state.system_install()) {
1247 const char* install_level =
1248 installer_state.system_install() ? "system" : "user";
1249 VLOG(1) << "No Active Setup processing to do for " << install_level
1250 << "-level " << distribution->GetAppShortCutName();
1251 return;
1252 }
1253
1254 const HKEY root = HKEY_LOCAL_MACHINE;
1255 const string16 active_setup_path(GetActiveSetupPath(distribution));
1256
1257 VLOG(1) << "Adding registration items for Active Setup.";
1258 list->AddCreateRegKeyWorkItem(root, active_setup_path);
1259 list->AddSetRegValueWorkItem(root, active_setup_path, L"",
1260 distribution->GetAppShortCutName(), true);
1261
1262 CommandLine cmd(installer_state.GetInstallerDirectory(new_version).
1263 Append(installer::kSetupExe));
1264 cmd.AppendSwitch(installer::switches::kConfigureUserSettings);
1265 cmd.AppendSwitch(installer::switches::kVerboseLogging);
1266 list->AddSetRegValueWorkItem(root, active_setup_path, L"StubPath",
1267 cmd.GetCommandLineString(), true);
1268
1269 // TODO(grt): http://crbug.com/75152 Write a reference to a localized
1270 // resource.
1271 list->AddSetRegValueWorkItem(root, active_setup_path, L"Localized Name",
1272 distribution->GetAppShortCutName(), true);
1273
1274 list->AddSetRegValueWorkItem(root, active_setup_path, L"IsInstalled",
1275 static_cast<DWORD>(1U), true);
1276
1277 string16 comma_separated_version(ASCIIToUTF16(new_version.GetString()));
1278 ReplaceChars(comma_separated_version, L".", L",", &comma_separated_version);
1279 list->AddSetRegValueWorkItem(root, active_setup_path, L"Version",
1280 comma_separated_version, true);
1281 }
1282
1233 namespace { 1283 namespace {
1234 1284
1235 enum ElevationPolicyId { 1285 enum ElevationPolicyId {
1236 CURRENT_ELEVATION_POLICY, 1286 CURRENT_ELEVATION_POLICY,
1237 OLD_ELEVATION_POLICY, 1287 OLD_ELEVATION_POLICY,
1238 }; 1288 };
1239 1289
1240 // Although the UUID of the ChromeFrame class is used for the "current" value, 1290 // Although the UUID of the ChromeFrame class is used for the "current" value,
1241 // this is done only as a convenience; there is no need for the GUID of the Low 1291 // this is done only as a convenience; there is no need for the GUID of the Low
1242 // Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to 1292 // Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 machine_state, 1587 machine_state,
1538 setup_path, 1588 setup_path,
1539 new_version, 1589 new_version,
1540 work_item_list, 1590 work_item_list,
1541 false, // have_child_product 1591 false, // have_child_product
1542 cmd_line, 1592 cmd_line,
1543 kCmdQuickEnableApplicationHost); 1593 kCmdQuickEnableApplicationHost);
1544 } 1594 }
1545 1595
1546 } // namespace installer 1596 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_worker.h ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698