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

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

Issue 6091008: Do machine inspection on install.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | « no previous file | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/installer/setup/install.h" 5 #include "chrome/installer/setup/install.h"
6 6
7 #include <shlobj.h> 7 #include <shlobj.h>
8 #include <time.h> 8 #include <time.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // 282 //
283 // If the shortcuts do not exist, the function does not recreate them during 283 // If the shortcuts do not exist, the function does not recreate them during
284 // update. 284 // update.
285 bool CreateOrUpdateChromeShortcuts(const FilePath& setup_path, 285 bool CreateOrUpdateChromeShortcuts(const FilePath& setup_path,
286 const Version& new_version, 286 const Version& new_version,
287 installer::InstallStatus install_status, 287 installer::InstallStatus install_status,
288 const Product& product, 288 const Product& product,
289 bool create_all_shortcut, 289 bool create_all_shortcut,
290 bool alt_shortcut) { 290 bool alt_shortcut) {
291 // TODO(tommi): Change this function to use WorkItemList. 291 // TODO(tommi): Change this function to use WorkItemList.
292 #ifndef NDEBUG 292 DCHECK(product.is_chrome());
293 const MasterPreferences& prefs = MasterPreferences::ForCurrentProcess();
294 DCHECK(prefs.install_chrome());
295 #endif
296 293
297 FilePath shortcut_path; 294 FilePath shortcut_path;
298 int dir_enum = product.system_level() ? 295 int dir_enum = product.system_level() ?
299 base::DIR_COMMON_START_MENU : base::DIR_START_MENU; 296 base::DIR_COMMON_START_MENU : base::DIR_START_MENU;
300 if (!PathService::Get(dir_enum, &shortcut_path)) { 297 if (!PathService::Get(dir_enum, &shortcut_path)) {
301 LOG(ERROR) << "Failed to get location for shortcut."; 298 LOG(ERROR) << "Failed to get location for shortcut.";
302 return false; 299 return false;
303 } 300 }
304 301
305 BrowserDistribution* browser_dist = product.distribution(); 302 BrowserDistribution* browser_dist = product.distribution();
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 const FilePath& setup_path, 928 const FilePath& setup_path,
932 const Version& new_version, 929 const Version& new_version,
933 const Product& product, 930 const Product& product,
934 WorkItemList* list) { 931 WorkItemList* list) {
935 DCHECK(product.is_chrome_frame()); 932 DCHECK(product.is_chrome_frame());
936 if (!product.package().multi_install()) { 933 if (!product.package().multi_install()) {
937 VLOG(1) << "Not adding GCF specific work items for single install."; 934 VLOG(1) << "Not adding GCF specific work items for single install.";
938 return; 935 return;
939 } 936 }
940 937
941 const MasterPreferences& prefs = MasterPreferences::ForCurrentProcess(); 938 // TODO(tommi): This assumes we know exactly how ShouldCreateUninstallEntry
942 bool ready_mode = false; 939 // is implemented. Since there is logic in ChromeFrameDistribution for how
943 prefs.GetBool(installer::master_preferences::kChromeFrameReadyMode, 940 // to determine when this is enabled, this is how we have to figure out if
944 &ready_mode); 941 // this feature is enabled right now, but it's a hack and we need a cleaner
942 // way to figure this out.
943 // Note that we cannot just check the master preferences for
944 // kChromeFrameReadyMode, since there are other things that need to be correct
945 // in the environment in order to enable this feature.
946 bool ready_mode = !product.distribution()->ShouldCreateUninstallEntry();
947
945 HKEY root = product.package().system_level() ? HKEY_LOCAL_MACHINE : 948 HKEY root = product.package().system_level() ? HKEY_LOCAL_MACHINE :
946 HKEY_CURRENT_USER; 949 HKEY_CURRENT_USER;
947 bool update_chrome_uninstall_command = false; 950 bool update_chrome_uninstall_command = false;
948 if (ready_mode) { 951 if (ready_mode) {
949 // If GCF is being installed in ready mode, we write an entry to the 952 // If GCF is being installed in ready mode, we write an entry to the
950 // multi-install state key. If the value already exists, we will not 953 // multi-install state key. If the value already exists, we will not
951 // overwrite it since the user might have opted out. 954 // overwrite it since the user might have opted out.
952 list->AddCreateRegKeyWorkItem(root, 955 list->AddCreateRegKeyWorkItem(root,
953 product.package().properties()->GetStateKey()); 956 product.package().properties()->GetStateKey());
954 list->AddSetRegValueWorkItem(root, 957 list->AddSetRegValueWorkItem(root,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 // check if Chrome is installed, and if so, update its uninstallation 992 // check if Chrome is installed, and if so, update its uninstallation
990 // command lines. 993 // command lines.
991 update_chrome_uninstall_command = true; 994 update_chrome_uninstall_command = true;
992 } 995 }
993 } 996 }
994 997
995 if (update_chrome_uninstall_command) { 998 if (update_chrome_uninstall_command) {
996 // Chrome is not a part of this installation run, so we have to explicitly 999 // Chrome is not a part of this installation run, so we have to explicitly
997 // check if Chrome is installed, and if so, update its uninstallation 1000 // check if Chrome is installed, and if so, update its uninstallation
998 // command lines. 1001 // command lines.
1002 const MasterPreferences& prefs = MasterPreferences::ForCurrentProcess();
999 BrowserDistribution* chrome_dist = 1003 BrowserDistribution* chrome_dist =
1000 BrowserDistribution::GetSpecificDistribution( 1004 BrowserDistribution::GetSpecificDistribution(
1001 BrowserDistribution::CHROME_BROWSER, prefs); 1005 BrowserDistribution::CHROME_BROWSER, prefs);
1002 const Package& pack = product.package(); 1006 const Package& pack = product.package();
1003 scoped_refptr<Package> package(new Package(pack.multi_install(), 1007 scoped_refptr<Package> package(new Package(pack.multi_install(),
1004 pack.system_level(), pack.path(), pack.properties())); 1008 pack.system_level(), pack.path(), pack.properties()));
1005 scoped_refptr<Product> chrome_product(new Product(chrome_dist, package)); 1009 scoped_refptr<Product> chrome_product(new Product(chrome_dist, package));
1006 AddUninstallShortcutWorkItems(setup_path, new_version, list, 1010 AddUninstallShortcutWorkItems(setup_path, new_version, list,
1007 *chrome_product.get()); 1011 *chrome_product.get());
1008 } 1012 }
1009 } 1013 }
1010 1014
1011 InstallStatus ChromeFrameReadyModeOptIn(const CommandLine& cmd_line) { 1015 InstallStatus ChromeFrameReadyModeOptIn(const CommandLine& cmd_line) {
1012 VLOG(1) << "Opting into Chrome Frame"; 1016 VLOG(1) << "Opting into Chrome Frame";
1013 InstallStatus status = INSTALL_REPAIRED; 1017 InstallStatus status = INSTALL_REPAIRED;
1014 1018
1015 const MasterPreferences& prefs = MasterPreferences::ForCurrentProcess(); 1019 const MasterPreferences& prefs = MasterPreferences::ForCurrentProcess();
1016 bool system_install = false; 1020 bool system_install = false;
1017 prefs.GetBool(master_preferences::kSystemLevel, &system_install); 1021 prefs.GetBool(master_preferences::kSystemLevel, &system_install);
1018 BrowserDistribution* cf = BrowserDistribution::GetSpecificDistribution( 1022 BrowserDistribution* cf = BrowserDistribution::GetSpecificDistribution(
1019 BrowserDistribution::CHROME_FRAME, prefs); 1023 BrowserDistribution::CHROME_FRAME, prefs);
1024 DCHECK(cf->ShouldCreateUninstallEntry())
1025 << "Opting into CF should create an uninstall entry";
1020 BrowserDistribution* chrome = BrowserDistribution::GetSpecificDistribution( 1026 BrowserDistribution* chrome = BrowserDistribution::GetSpecificDistribution(
1021 BrowserDistribution::CHROME_BROWSER, prefs); 1027 BrowserDistribution::CHROME_BROWSER, prefs);
1022 1028
1023 #if defined(GOOGLE_CHROME_BUILD) 1029 #if defined(GOOGLE_CHROME_BUILD)
1024 ChromePackageProperties package_properties; 1030 ChromePackageProperties package_properties;
1025 #else 1031 #else
1026 ChromiumPackageProperties package_properties; 1032 ChromiumPackageProperties package_properties;
1027 #endif 1033 #endif
1028 1034
1029 // Remove ChromeFrameReadyMode, update Chrome's uninstallation commands to 1035 // Remove ChromeFrameReadyMode, update Chrome's uninstallation commands to
(...skipping 30 matching lines...) Expand all
1060 LOG(ERROR) << "Failed to opt into GCF"; 1066 LOG(ERROR) << "Failed to opt into GCF";
1061 item_list->Rollback(); 1067 item_list->Rollback();
1062 status = READY_MODE_OPT_IN_FAILED; 1068 status = READY_MODE_OPT_IN_FAILED;
1063 } 1069 }
1064 } 1070 }
1065 1071
1066 return status; 1072 return status;
1067 } 1073 }
1068 1074
1069 } // namespace installer 1075 } // namespace installer
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698