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

Side by Side Diff: chrome/installer/util/shell_util.cc

Issue 282363003: Add WOW64 support to the installer registry work items (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: nits. fix call to DeleteRegistryKey Created 6 years, 7 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
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 defines functions that integrate Chrome in Windows shell. These 5 // This file defines functions that integrate Chrome in Windows shell. These
6 // functions can be used by Chrome as well as Chrome installer. All of the 6 // functions can be used by Chrome as well as Chrome installer. All of the
7 // work is done by the local functions defined in anonymous namespace in 7 // work is done by the local functions defined in anonymous namespace in
8 // this class. 8 // this class.
9 9
10 #include "chrome/installer/util/shell_util.h" 10 #include "chrome/installer/util/shell_util.h"
(...skipping 30 matching lines...) Expand all
41 #include "base/win/win_util.h" 41 #include "base/win/win_util.h"
42 #include "base/win/windows_version.h" 42 #include "base/win/windows_version.h"
43 #include "chrome/common/chrome_constants.h" 43 #include "chrome/common/chrome_constants.h"
44 #include "chrome/common/chrome_switches.h" 44 #include "chrome/common/chrome_switches.h"
45 #include "chrome/installer/util/browser_distribution.h" 45 #include "chrome/installer/util/browser_distribution.h"
46 #include "chrome/installer/util/install_util.h" 46 #include "chrome/installer/util/install_util.h"
47 #include "chrome/installer/util/l10n_string_util.h" 47 #include "chrome/installer/util/l10n_string_util.h"
48 #include "chrome/installer/util/master_preferences.h" 48 #include "chrome/installer/util/master_preferences.h"
49 #include "chrome/installer/util/master_preferences_constants.h" 49 #include "chrome/installer/util/master_preferences_constants.h"
50 #include "chrome/installer/util/util_constants.h" 50 #include "chrome/installer/util/util_constants.h"
51 #include "chrome/installer/util/work_item.h"
51 52
52 #include "installer_util_strings.h" // NOLINT 53 #include "installer_util_strings.h" // NOLINT
53 54
54 using base::win::RegKey; 55 using base::win::RegKey;
55 56
56 namespace { 57 namespace {
57 58
58 // An enum used to tell QuickIsChromeRegistered() which level of registration 59 // An enum used to tell QuickIsChromeRegistered() which level of registration
59 // the caller wants to confirm. 60 // the caller wants to confirm.
60 enum RegistrationConfirmationLevel { 61 enum RegistrationConfirmationLevel {
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 525
525 // start->Internet shortcut. 526 // start->Internet shortcut.
526 base::string16 start_menu(ShellUtil::kRegStartMenuInternet); 527 base::string16 start_menu(ShellUtil::kRegStartMenuInternet);
527 base::string16 app_name = dist->GetBaseAppName() + suffix; 528 base::string16 app_name = dist->GetBaseAppName() + suffix;
528 entries->push_back(new RegistryEntry(start_menu, app_name)); 529 entries->push_back(new RegistryEntry(start_menu, app_name));
529 } 530 }
530 531
531 // Generate work_item tasks required to create current registry entry and 532 // Generate work_item tasks required to create current registry entry and
532 // add them to the given work item list. 533 // add them to the given work item list.
533 void AddToWorkItemList(HKEY root, WorkItemList *items) const { 534 void AddToWorkItemList(HKEY root, WorkItemList *items) const {
534 items->AddCreateRegKeyWorkItem(root, key_path_); 535 items->AddCreateRegKeyWorkItem(root, key_path_, WorkItem::kWow64Default);
535 if (is_string_) { 536 if (is_string_) {
536 items->AddSetRegValueWorkItem(root, key_path_, name_, value_, true); 537 items->AddSetRegValueWorkItem(
538 root, key_path_, WorkItem::kWow64Default, name_, value_, true);
537 } else { 539 } else {
538 items->AddSetRegValueWorkItem(root, key_path_, name_, int_value_, true); 540 items->AddSetRegValueWorkItem(
541 root, key_path_, WorkItem::kWow64Default, name_, int_value_, true);
539 } 542 }
540 } 543 }
541 544
542 // Checks if the current registry entry exists in HKCU\|key_path_|\|name_| 545 // Checks if the current registry entry exists in HKCU\|key_path_|\|name_|
543 // and value is |value_|. If the key does NOT exist in HKCU, checks for 546 // and value is |value_|. If the key does NOT exist in HKCU, checks for
544 // the correct name and value in HKLM. 547 // the correct name and value in HKLM.
545 // |look_for_in| specifies roots (HKCU and/or HKLM) in which to look for the 548 // |look_for_in| specifies roots (HKCU and/or HKLM) in which to look for the
546 // key, unspecified roots are not looked into (i.e. the the key is assumed not 549 // key, unspecified roots are not looked into (i.e. the the key is assumed not
547 // to exist in them). 550 // to exist in them).
548 // |look_for_in| must at least specify one root to look into. 551 // |look_for_in| must at least specify one root to look into.
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 // There's no need to rollback, so forgo the usual work item lists and just 1016 // There's no need to rollback, so forgo the usual work item lists and just
1014 // remove the key from the registry. 1017 // remove the key from the registry.
1015 base::string16 run_verb_key(ShellUtil::kRegClasses); 1018 base::string16 run_verb_key(ShellUtil::kRegClasses);
1016 run_verb_key.push_back(base::FilePath::kSeparators[0]); 1019 run_verb_key.push_back(base::FilePath::kSeparators[0]);
1017 run_verb_key.append(ShellUtil::GetBrowserModelId( 1020 run_verb_key.append(ShellUtil::GetBrowserModelId(
1018 dist, is_per_user_install)); 1021 dist, is_per_user_install));
1019 run_verb_key.append(ShellUtil::kRegExePath); 1022 run_verb_key.append(ShellUtil::kRegExePath);
1020 run_verb_key.append(ShellUtil::kRegShellPath); 1023 run_verb_key.append(ShellUtil::kRegShellPath);
1021 run_verb_key.push_back(base::FilePath::kSeparators[0]); 1024 run_verb_key.push_back(base::FilePath::kSeparators[0]);
1022 run_verb_key.append(ShellUtil::kRegVerbRun); 1025 run_verb_key.append(ShellUtil::kRegVerbRun);
1023 InstallUtil::DeleteRegistryKey(root_key, run_verb_key); 1026 InstallUtil::DeleteRegistryKey(root_key, run_verb_key,
1027 WorkItem::kWow64Default);
1024 } 1028 }
1025 } 1029 }
1026 1030
1027 // Gets the short (8.3) form of |path|, putting the result in |short_path| and 1031 // Gets the short (8.3) form of |path|, putting the result in |short_path| and
1028 // returning true on success. |short_path| is not modified on failure. 1032 // returning true on success. |short_path| is not modified on failure.
1029 bool ShortNameFromPath(const base::FilePath& path, base::string16* short_path) { 1033 bool ShortNameFromPath(const base::FilePath& path, base::string16* short_path) {
1030 DCHECK(short_path); 1034 DCHECK(short_path);
1031 base::string16 result(MAX_PATH, L'\0'); 1035 base::string16 result(MAX_PATH, L'\0');
1032 DWORD short_length = GetShortPathName(path.value().c_str(), &result[0], 1036 DWORD short_length = GetShortPathName(path.value().c_str(), &result[0],
1033 result.size()); 1037 result.size());
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 // are any left...). 2268 // are any left...).
2265 if (free_bits >= 8 && next_byte_index < size) { 2269 if (free_bits >= 8 && next_byte_index < size) {
2266 free_bits -= 8; 2270 free_bits -= 8;
2267 bit_stream += bytes[next_byte_index++] << free_bits; 2271 bit_stream += bytes[next_byte_index++] << free_bits;
2268 } 2272 }
2269 } 2273 }
2270 2274
2271 DCHECK_EQ(ret.length(), encoded_length); 2275 DCHECK_EQ(ret.length(), encoded_length);
2272 return ret; 2276 return ret;
2273 } 2277 }
OLDNEW
« no previous file with comments | « chrome/installer/util/set_reg_value_work_item_unittest.cc ('k') | chrome/installer/util/work_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698