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

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

Issue 2839009: Include the Chrome Frame binary in Chrome installers. Note that it will only ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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/setup_constants.cc ('k') | chrome_frame/chrome_frame_reporting.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <string> 5 #include <string>
6 #include <windows.h> 6 #include <windows.h>
7 #include <msi.h> 7 #include <msi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 const std::wstring& temp_path, const std::wstring& path, 57 const std::wstring& temp_path, const std::wstring& path,
58 bool& incremental_install) { 58 bool& incremental_install) {
59 // First uncompress the payload. This could be a differential 59 // First uncompress the payload. This could be a differential
60 // update (patch.7z) or full archive (chrome.7z). If this uncompress fails 60 // update (patch.7z) or full archive (chrome.7z). If this uncompress fails
61 // return with error. 61 // return with error.
62 std::wstring unpacked_file; 62 std::wstring unpacked_file;
63 int32 ret = LzmaUtil::UnPackArchive(archive, temp_path, &unpacked_file); 63 int32 ret = LzmaUtil::UnPackArchive(archive, temp_path, &unpacked_file);
64 if (ret != NO_ERROR) 64 if (ret != NO_ERROR)
65 return ret; 65 return ret;
66 66
67 std::wstring archive_name;
68 if (InstallUtil::IsChromeFrameProcess()) {
69 archive_name = installer::kChromeFrameArchive;
70 } else {
71 archive_name = installer::kChromeArchive;
72 }
73
74 std::wstring uncompressed_archive(temp_path); 67 std::wstring uncompressed_archive(temp_path);
75 file_util::AppendToPath(&uncompressed_archive, archive_name); 68 file_util::AppendToPath(&uncompressed_archive, installer::kChromeArchive);
76 69
77 // Check if this is differential update and if it is, patch it to the 70 // Check if this is differential update and if it is, patch it to the
78 // installer archive that should already be on the machine. We assume 71 // installer archive that should already be on the machine. We assume
79 // it is a differential installer if chrome.7z is not found. 72 // it is a differential installer if chrome.7z is not found.
80 if (!file_util::PathExists(FilePath::FromWStringHack(uncompressed_archive))) { 73 if (!file_util::PathExists(FilePath::FromWStringHack(uncompressed_archive))) {
81 incremental_install = true; 74 incremental_install = true;
82 LOG(INFO) << "Differential patch found. Applying to existing archive."; 75 LOG(INFO) << "Differential patch found. Applying to existing archive.";
83 if (!installed_version) { 76 if (!installed_version) {
84 LOG(ERROR) << "Can not use differential update when Chrome is not " 77 LOG(ERROR) << "Can not use differential update when Chrome is not "
85 << "installed on the system."; 78 << "installed on the system.";
86 return installer_util::CHROME_NOT_INSTALLED; 79 return installer_util::CHROME_NOT_INSTALLED;
87 } 80 }
88 std::wstring existing_archive = 81 std::wstring existing_archive =
89 installer::GetChromeInstallPath(system_install); 82 installer::GetChromeInstallPath(system_install);
90 file_util::AppendToPath(&existing_archive, 83 file_util::AppendToPath(&existing_archive,
91 installed_version->GetString()); 84 installed_version->GetString());
92 file_util::AppendToPath(&existing_archive, installer_util::kInstallerDir); 85 file_util::AppendToPath(&existing_archive, installer_util::kInstallerDir);
93 file_util::AppendToPath(&existing_archive, archive_name); 86 file_util::AppendToPath(&existing_archive, installer::kChromeArchive);
94 if (int i = setup_util::ApplyDiffPatch(existing_archive, unpacked_file, 87 if (int i = setup_util::ApplyDiffPatch(existing_archive, unpacked_file,
95 uncompressed_archive)) { 88 uncompressed_archive)) {
96 LOG(ERROR) << "Binary patching failed with error " << i; 89 LOG(ERROR) << "Binary patching failed with error " << i;
97 return i; 90 return i;
98 } 91 }
99 } 92 }
100 93
101 // Unpack the uncompressed archive. 94 // Unpack the uncompressed archive.
102 return LzmaUtil::UnPackArchive(uncompressed_archive, path, &unpacked_file); 95 return LzmaUtil::UnPackArchive(uncompressed_archive, path, &unpacked_file);
103 } 96 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 installer_util::GetDistroBooleanPreference(prefs, 218 installer_util::GetDistroBooleanPreference(prefs,
226 installer_util::master_preferences::kSystemLevel, &system_level); 219 installer_util::master_preferences::kSystemLevel, &system_level);
227 installer_util::InstallStatus install_status = installer_util::UNKNOWN_STATUS; 220 installer_util::InstallStatus install_status = installer_util::UNKNOWN_STATUS;
228 if (!CheckPreInstallConditions(installed_version, 221 if (!CheckPreInstallConditions(installed_version,
229 system_level, install_status)) 222 system_level, install_status))
230 return install_status; 223 return install_status;
231 224
232 // For install the default location for chrome.packed.7z is in current 225 // For install the default location for chrome.packed.7z is in current
233 // folder, so get that value first. 226 // folder, so get that value first.
234 std::wstring archive = file_util::GetDirectoryFromPath(cmd_line.program()); 227 std::wstring archive = file_util::GetDirectoryFromPath(cmd_line.program());
235 if (InstallUtil::IsChromeFrameProcess()) { 228 file_util::AppendToPath(&archive,
236 file_util::AppendToPath(&archive, 229 std::wstring(installer::kChromeCompressedArchive));
237 std::wstring(installer::kChromeFrameCompressedArchive)); 230
238 } else {
239 file_util::AppendToPath(&archive,
240 std::wstring(installer::kChromeCompressedArchive));
241 }
242 // If --install-archive is given, get the user specified value 231 // If --install-archive is given, get the user specified value
243 if (cmd_line.HasSwitch(installer_util::switches::kInstallArchive)) { 232 if (cmd_line.HasSwitch(installer_util::switches::kInstallArchive)) {
244 archive = cmd_line.GetSwitchValue( 233 archive = cmd_line.GetSwitchValue(
245 installer_util::switches::kInstallArchive); 234 installer_util::switches::kInstallArchive);
246 } 235 }
247 LOG(INFO) << "Archive found to install Chrome " << archive; 236 LOG(INFO) << "Archive found to install Chrome " << archive;
248 237
249 // Create a temp folder where we will unpack Chrome archive. If it fails, 238 // Create a temp folder where we will unpack Chrome archive. If it fails,
250 // then we are doomed, so return immediately and no cleanup is required. 239 // then we are doomed, so return immediately and no cleanup is required.
251 FilePath temp_path; 240 FilePath temp_path;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 installed_version->IsHigherThan(installer_version.get())) { 278 installed_version->IsHigherThan(installer_version.get())) {
290 LOG(ERROR) << "Higher version is already installed."; 279 LOG(ERROR) << "Higher version is already installed.";
291 install_status = installer_util::HIGHER_VERSION_EXISTS; 280 install_status = installer_util::HIGHER_VERSION_EXISTS;
292 InstallUtil::WriteInstallerResult(system_level, install_status, 281 InstallUtil::WriteInstallerResult(system_level, install_status,
293 IDS_INSTALL_HIGHER_VERSION_BASE, 282 IDS_INSTALL_HIGHER_VERSION_BASE,
294 NULL); 283 NULL);
295 } else { 284 } else {
296 // We want to keep uncompressed archive (chrome.7z) that we get after 285 // We want to keep uncompressed archive (chrome.7z) that we get after
297 // uncompressing and binary patching. Get the location for this file. 286 // uncompressing and binary patching. Get the location for this file.
298 std::wstring archive_to_copy(temp_path.ToWStringHack()); 287 std::wstring archive_to_copy(temp_path.ToWStringHack());
299 std::wstring archive_name; 288 file_util::AppendToPath(&archive_to_copy, installer::kChromeArchive);
300 if (InstallUtil::IsChromeFrameProcess()) {
301 archive_name = installer::kChromeFrameArchive;
302 } else {
303 archive_name = installer::kChromeArchive;
304 }
305 file_util::AppendToPath(&archive_to_copy, archive_name);
306 std::wstring prefs_source_path = cmd_line.GetSwitchValue( 289 std::wstring prefs_source_path = cmd_line.GetSwitchValue(
307 installer_util::switches::kInstallerData); 290 installer_util::switches::kInstallerData);
308 install_status = installer::InstallOrUpdateChrome( 291 install_status = installer::InstallOrUpdateChrome(
309 cmd_line.program(), archive_to_copy, temp_path.ToWStringHack(), 292 cmd_line.program(), archive_to_copy, temp_path.ToWStringHack(),
310 prefs_source_path, prefs, *installer_version, installed_version); 293 prefs_source_path, prefs, *installer_version, installed_version);
311 294
312 int install_msg_base = IDS_INSTALL_FAILED_BASE; 295 int install_msg_base = IDS_INSTALL_FAILED_BASE;
313 std::wstring chrome_exe; 296 std::wstring chrome_exe;
314 if (install_status == installer_util::SAME_VERSION_REPAIR_FAILED) { 297 if (install_status == installer_util::SAME_VERSION_REPAIR_FAILED) {
315 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; 298 install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 bool initialized_; 592 bool initialized_;
610 }; 593 };
611 594
612 } // namespace 595 } // namespace
613 596
614 int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, 597 int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
615 wchar_t* command_line, int show_command) { 598 wchar_t* command_line, int show_command) {
616 // The exit manager is in charge of calling the dtors of singletons. 599 // The exit manager is in charge of calling the dtors of singletons.
617 base::AtExitManager exit_manager; 600 base::AtExitManager exit_manager;
618 CommandLine::Init(0, NULL); 601 CommandLine::Init(0, NULL);
602 CommandLine* mutable_command_line = CommandLine::ForCurrentProcess();
603
604 if (mutable_command_line->HasSwitch(installer_util::switches::kChromeFrame)) {
605 mutable_command_line->AppendSwitch(
606 WideToASCII(installer_util::switches::kDoNotCreateShortcuts));
607 mutable_command_line->AppendSwitch(
608 WideToASCII(installer_util::switches::kDoNotLaunchChrome));
609 mutable_command_line->AppendSwitch(
610 WideToASCII(installer_util::switches::kDoNotRegisterForUpdateLaunch));
611 }
612
619 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 613 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
614
620 installer::InitInstallerLogging(parsed_command_line); 615 installer::InitInstallerLogging(parsed_command_line);
621 scoped_ptr<DictionaryValue> prefs(installer_util::GetInstallPreferences( 616 scoped_ptr<DictionaryValue> prefs(installer_util::GetInstallPreferences(
622 parsed_command_line)); 617 parsed_command_line));
623 bool value = false; 618 bool value = false;
624 if (installer_util::GetDistroBooleanPreference(prefs.get(), 619 if (installer_util::GetDistroBooleanPreference(prefs.get(),
625 installer_util::master_preferences::kVerboseLogging, &value) && 620 installer_util::master_preferences::kVerboseLogging, &value) &&
626 value) 621 value)
627 logging::SetMinLogLevel(logging::LOG_INFO); 622 logging::SetMinLogLevel(logging::LOG_INFO);
628 623
629 LOG(INFO) << "Command Line: " << parsed_command_line.command_line_string(); 624 LOG(INFO) << "Command Line: " << parsed_command_line.command_line_string();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 parsed_command_line.HasSwitch(installer_util::switches::kUninstall))) { 736 parsed_command_line.HasSwitch(installer_util::switches::kUninstall))) {
742 // Note that we allow the status installer_util::UNINSTALL_REQUIRES_REBOOT 737 // Note that we allow the status installer_util::UNINSTALL_REQUIRES_REBOOT
743 // to pass through, since this is only returned on uninstall which is never 738 // to pass through, since this is only returned on uninstall which is never
744 // invoked directly by Google Update. 739 // invoked directly by Google Update.
745 return_code = dist->GetInstallReturnCode(install_status); 740 return_code = dist->GetInstallReturnCode(install_status);
746 } 741 }
747 742
748 LOG(INFO) << "Installation complete, returning: " << return_code; 743 LOG(INFO) << "Installation complete, returning: " << return_code;
749 return return_code; 744 return return_code;
750 } 745 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/setup_constants.cc ('k') | chrome_frame/chrome_frame_reporting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698