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

Side by Side Diff: chrome/installer/setup/install_worker.cc

Issue 8555010: Write the install language to the registry for user-level installs. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/installer/setup/install_worker.h ('k') | chrome/installer/util/l10n_string_util.h » ('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) 2011 The Chromium Authors. All rights reserved. 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 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 <shlobj.h> 10 #include <shlobj.h>
(...skipping 12 matching lines...) Expand all
23 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
24 #include "chrome/installer/setup/install.h" 24 #include "chrome/installer/setup/install.h"
25 #include "chrome/installer/setup/setup_constants.h" 25 #include "chrome/installer/setup/setup_constants.h"
26 #include "chrome/installer/util/conditional_work_item_list.h" 26 #include "chrome/installer/util/conditional_work_item_list.h"
27 #include "chrome/installer/util/create_reg_key_work_item.h" 27 #include "chrome/installer/util/create_reg_key_work_item.h"
28 #include "chrome/installer/util/google_update_constants.h" 28 #include "chrome/installer/util/google_update_constants.h"
29 #include "chrome/installer/util/helper.h" 29 #include "chrome/installer/util/helper.h"
30 #include "chrome/installer/util/installation_state.h" 30 #include "chrome/installer/util/installation_state.h"
31 #include "chrome/installer/util/installer_state.h" 31 #include "chrome/installer/util/installer_state.h"
32 #include "chrome/installer/util/install_util.h" 32 #include "chrome/installer/util/install_util.h"
33 #include "chrome/installer/util/l10n_string_util.h"
33 #include "chrome/installer/util/product.h" 34 #include "chrome/installer/util/product.h"
34 #include "chrome/installer/util/set_reg_value_work_item.h" 35 #include "chrome/installer/util/set_reg_value_work_item.h"
35 #include "chrome/installer/util/shell_util.h" 36 #include "chrome/installer/util/shell_util.h"
36 #include "chrome/installer/util/util_constants.h" 37 #include "chrome/installer/util/util_constants.h"
37 #include "chrome/installer/util/work_item_list.h" 38 #include "chrome/installer/util/work_item_list.h"
38 #include "chrome_frame/chrome_tab.h" 39 #include "chrome_frame/chrome_tab.h"
39 40
40 using base::win::RegKey; 41 using base::win::RegKey;
41 42
42 namespace installer { 43 namespace installer {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 install_list->AddCreateRegKeyWorkItem(reg_root, binaries_state_key); 233 install_list->AddCreateRegKeyWorkItem(reg_root, binaries_state_key);
233 install_list->AddSetRegValueWorkItem(reg_root, binaries_state_key, 234 install_list->AddSetRegValueWorkItem(reg_root, binaries_state_key,
234 installer::kUninstallStringField, installer_path.value(), true); 235 installer::kUninstallStringField, installer_path.value(), true);
235 } 236 }
236 237
237 // Create Version key for a product (if not already present) and sets the new 238 // Create Version key for a product (if not already present) and sets the new
238 // product version as the last step. 239 // product version as the last step.
239 void AddVersionKeyWorkItems(HKEY root, 240 void AddVersionKeyWorkItems(HKEY root,
240 BrowserDistribution* dist, 241 BrowserDistribution* dist,
241 const Version& new_version, 242 const Version& new_version,
243 bool add_language_identifier,
242 WorkItemList* list) { 244 WorkItemList* list) {
243 // Create Version key for each distribution (if not already present) and set 245 // Create Version key for each distribution (if not already present) and set
244 // the new product version as the last step. 246 // the new product version as the last step.
245 std::wstring version_key(dist->GetVersionKey()); 247 std::wstring version_key(dist->GetVersionKey());
246 list->AddCreateRegKeyWorkItem(root, version_key); 248 list->AddCreateRegKeyWorkItem(root, version_key);
247 249
248 std::wstring product_name(dist->GetAppShortCutName()); 250 std::wstring product_name(dist->GetAppShortCutName());
249 list->AddSetRegValueWorkItem(root, version_key, google_update::kRegNameField, 251 list->AddSetRegValueWorkItem(root, version_key, google_update::kRegNameField,
250 product_name, true); // overwrite name also 252 product_name, true); // overwrite name also
251 list->AddSetRegValueWorkItem(root, version_key, 253 list->AddSetRegValueWorkItem(root, version_key,
252 google_update::kRegOopcrashesField, 254 google_update::kRegOopcrashesField,
253 static_cast<DWORD>(1), 255 static_cast<DWORD>(1),
254 false); // set during first install 256 false); // set during first install
257 if (add_language_identifier) {
258 // Write the language identifier of the current translation. Omaha's set of
259 // languages is a superset of Chrome's set of translations with this one
260 // exception: what Chrome calls "en-us", Omaha calls "en". sigh.
261 std::wstring language(GetCurrentTranslation());
262 if (LowerCaseEqualsASCII(language, "en-us"))
263 language.resize(2);
264 list->AddSetRegValueWorkItem(root, version_key,
265 google_update::kRegLangField, language,
266 false); // do not overwrite language
267 }
255 list->AddSetRegValueWorkItem(root, version_key, 268 list->AddSetRegValueWorkItem(root, version_key,
256 google_update::kRegVersionField, 269 google_update::kRegVersionField,
257 ASCIIToWide(new_version.GetString()), 270 ASCIIToWide(new_version.GetString()),
258 true); // overwrite version 271 true); // overwrite version
259 } 272 }
260 273
261 void AddProductSpecificWorkItems(const InstallationState& original_state, 274 void AddProductSpecificWorkItems(const InstallationState& original_state,
262 const InstallerState& installer_state, 275 const InstallerState& installer_state,
263 const FilePath& setup_path, 276 const FilePath& setup_path,
264 const Version& new_version, 277 const Version& new_version,
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 install_list->AddDeleteTreeWorkItem( 788 install_list->AddDeleteTreeWorkItem(
776 target_path.Append(installer::kChromeOldExe), temp_path) 789 target_path.Append(installer::kChromeOldExe), temp_path)
777 ->set_ignore_failure(true); 790 ->set_ignore_failure(true);
778 791
779 // Copy installer in install directory and 792 // Copy installer in install directory and
780 // add shortcut in Control Panel->Add/Remove Programs. 793 // add shortcut in Control Panel->Add/Remove Programs.
781 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path, 794 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path,
782 new_version, install_list); 795 new_version, install_list);
783 796
784 const HKEY root = installer_state.root_key(); 797 const HKEY root = installer_state.root_key();
798 // Only set "lang" for user-level installs since for system-level, the install
799 // language may not be related to a given user's runtime language.
800 const bool add_language_identifier = !installer_state.system_install();
785 801
786 const Products& products = installer_state.products(); 802 const Products& products = installer_state.products();
787 for (size_t i = 0; i < products.size(); ++i) { 803 for (size_t i = 0; i < products.size(); ++i) {
788 const Product* product = products[i]; 804 const Product* product = products[i];
789 805
790 AddUninstallShortcutWorkItems(installer_state, setup_path, new_version, 806 AddUninstallShortcutWorkItems(installer_state, setup_path, new_version,
791 install_list, *product); 807 install_list, *product);
792 808
793 AddVersionKeyWorkItems(root, product->distribution(), new_version, 809 AddVersionKeyWorkItems(root, product->distribution(), new_version,
794 install_list); 810 add_language_identifier, install_list);
795 } 811 }
796 812
797 if (installer_state.is_multi_install()) { 813 if (installer_state.is_multi_install()) {
798 AddMultiUninstallWorkItems(installer_state, setup_path, new_version, 814 AddMultiUninstallWorkItems(installer_state, setup_path, new_version,
799 install_list); 815 install_list);
800 816
801 AddVersionKeyWorkItems(root, 817 AddVersionKeyWorkItems(root,
802 installer_state.multi_package_binaries_distribution(), new_version, 818 installer_state.multi_package_binaries_distribution(), new_version,
803 install_list); 819 add_language_identifier, install_list);
804 } 820 }
805 821
806 // Add any remaining work items that involve special settings for 822 // Add any remaining work items that involve special settings for
807 // each product. 823 // each product.
808 AddProductSpecificWorkItems(original_state, installer_state, setup_path, 824 AddProductSpecificWorkItems(original_state, installer_state, setup_path,
809 new_version, install_list); 825 new_version, install_list);
810 826
811 // Copy over brand, usagestats, and other values. 827 // Copy over brand, usagestats, and other values.
812 AddGoogleUpdateWorkItems(original_state, installer_state, install_list); 828 AddGoogleUpdateWorkItems(original_state, installer_state, install_list);
813 829
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 } else { 1253 } else {
1238 DCHECK(operation == REMOVE_COMMAND); 1254 DCHECK(operation == REMOVE_COMMAND);
1239 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), 1255 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(),
1240 cmd_key)->set_log_message( 1256 cmd_key)->set_log_message(
1241 "removing quick-enable-cf command"); 1257 "removing quick-enable-cf command");
1242 } 1258 }
1243 } 1259 }
1244 } 1260 }
1245 1261
1246 } // namespace installer 1262 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_worker.h ('k') | chrome/installer/util/l10n_string_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698