summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/chrome_browser_operations.cc
diff options
context:
space:
mode:
authorgrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-25 16:44:37 +0000
committergrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-25 16:44:37 +0000
commitf0260d27d34e40f2e619fb7a16dcd7f9d63fc683 (patch)
tree7e7c9e83bbd2f67b4bbbe11d076c7cc70abd8855 /chrome/installer/util/chrome_browser_operations.cc
parentce7937429f63f3d966346fcd973d720f268cd888 (diff)
downloadchromium_src-f0260d27d34e40f2e619fb7a16dcd7f9d63fc683.zip
chromium_src-f0260d27d34e40f2e619fb7a16dcd7f9d63fc683.tar.gz
chromium_src-f0260d27d34e40f2e619fb7a16dcd7f9d63fc683.tar.bz2
More installer refactoring in the interest of fixing some bugs and cleaning things up:
- Introduced ProductOperations: an interface implemented for each product that takes care of product-specific functions. Each Product owns an instance and delegates certain operations to it. - Removed the use of MasterPreferences by BrowserDistribution so that the former isn't needed outside of the installer. - Replaced PackageProperties with a new BrowserDistribution type (CHROME_BINARIES) - Plumbed the concept of InstallerState more thoroughly through installer - Removed ProductPackageMapping and Package - Moved more registry read ops into ProductState - Validation of products to be installed is now done in CheckPreInstallConditions - Ignore --chrome-frame --ready-mode if chrome is also being installed/updated and a SxS GCF is found (chrome is updated). - Migrates existing single-install Chrome to multi-install where appropriate. - Fixes update to Chrome's uninstallation arguments when Chrome Frame is uninstalled. - Removed dead code from install.cc. - Added code to update products' "ap" values when ready-mode is accepted. - Skip post-install things such as launching the browser when Chrome was implicitly added to the install/upgrade process by virtue of being part of a multi-install. BUG=61609 TEST=run the installer, see it work. existing tests in installer_util_unittests have been updated; new tests are included for ProductState, ChannelInfo, etc. Review URL: http://codereview.chromium.org/6288009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/chrome_browser_operations.cc')
-rw-r--r--chrome/installer/util/chrome_browser_operations.cc82
1 files changed, 82 insertions, 0 deletions
diff --git a/chrome/installer/util/chrome_browser_operations.cc b/chrome/installer/util/chrome_browser_operations.cc
new file mode 100644
index 0000000..c4acd5c
--- /dev/null
+++ b/chrome/installer/util/chrome_browser_operations.cc
@@ -0,0 +1,82 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/installer/util/chrome_browser_operations.h"
+
+#include "base/command_line.h"
+#include "base/file_path.h"
+#include "base/logging.h"
+#include "chrome/installer/util/browser_distribution.h"
+#include "chrome/installer/util/channel_info.h"
+#include "chrome/installer/util/helper.h"
+#include "chrome/installer/util/master_preferences.h"
+#include "chrome/installer/util/master_preferences_constants.h"
+#include "chrome/installer/util/util_constants.h"
+
+namespace installer {
+
+void ChromeBrowserOperations::ReadOptions(
+ const MasterPreferences& prefs,
+ std::set<std::wstring>* options) const {
+ DCHECK(options);
+
+ bool pref_value;
+
+ if (prefs.GetBool(master_preferences::kMultiInstall, &pref_value) &&
+ pref_value) {
+ options->insert(kOptionMultiInstall);
+ }
+}
+
+void ChromeBrowserOperations::ReadOptions(
+ const CommandLine& uninstall_command,
+ std::set<std::wstring>* options) const {
+ DCHECK(options);
+
+ if (uninstall_command.HasSwitch(switches::kMultiInstall))
+ options->insert(kOptionMultiInstall);
+}
+
+void ChromeBrowserOperations::AddKeyFiles(
+ const std::set<std::wstring>& options,
+ std::vector<FilePath>* key_files) const {
+ DCHECK(key_files);
+ key_files->push_back(FilePath(installer::kChromeDll));
+}
+
+void ChromeBrowserOperations::AddComDllList(
+ const std::set<std::wstring>& options,
+ std::vector<FilePath>* com_dll_list) const {
+}
+
+void ChromeBrowserOperations::AppendProductFlags(
+ const std::set<std::wstring>& options,
+ CommandLine* uninstall_command) const {
+ DCHECK(uninstall_command);
+
+ if (options.find(kOptionMultiInstall) != options.end()) {
+ if (!uninstall_command->HasSwitch(switches::kMultiInstall))
+ uninstall_command->AppendSwitch(switches::kMultiInstall);
+ uninstall_command->AppendSwitch(switches::kChrome);
+ }
+}
+
+bool ChromeBrowserOperations::SetChannelFlags(
+ const std::set<std::wstring>& options,
+ bool set,
+ ChannelInfo* channel_info) const {
+#if defined(GOOGLE_CHROME_BUILD)
+ DCHECK(channel_info);
+ return channel_info->SetChrome(set);
+#else
+ return false;
+#endif
+}
+
+bool ChromeBrowserOperations::ShouldCreateUninstallEntry(
+ const std::set<std::wstring>& options) const {
+ return true;
+}
+
+} // namespace installer