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

Unified Diff: chrome/installer/util/installer_state.cc

Issue 14031025: Implementing unified Chrome / App Launcher flow, and migrating old stand-alone App Launcher. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing Start Menu root stuff; cleanups. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/installer_state.cc
diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc
index 00906292c31514cf2d4333150d52fb9b5383555d..93d69622cb10f57e952e5a6a62763cf4c3084353 100644
--- a/chrome/installer/util/installer_state.cc
+++ b/chrome/installer/util/installer_state.cc
@@ -24,6 +24,7 @@
#include "chrome/installer/util/master_preferences.h"
#include "chrome/installer/util/master_preferences_constants.h"
#include "chrome/installer/util/product.h"
+#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/work_item.h"
#include "chrome/installer/util/work_item_list.h"
@@ -78,7 +79,9 @@ InstallerState::InstallerState()
root_key_(NULL),
msi_(false),
verbose_logging_(false),
- ensure_google_update_present_(false) {
+ ensure_google_update_present_(false),
+ need_to_migrate_legacy_app_launcher_(false),
+ create_app_launcher_shortcuts_(false) {
}
InstallerState::InstallerState(Level level)
@@ -90,7 +93,9 @@ InstallerState::InstallerState(Level level)
root_key_(NULL),
msi_(false),
verbose_logging_(false),
- ensure_google_update_present_(false) {
+ ensure_google_update_present_(false),
+ need_to_migrate_legacy_app_launcher_(false),
+ create_app_launcher_shortcuts_(false) {
// Use set_level() so that root_key_ is updated properly.
set_level(level);
}
@@ -118,12 +123,37 @@ void InstallerState::Initialize(const CommandLine& command_line,
const bool is_uninstall = command_line.HasSwitch(switches::kUninstall);
- if (prefs.install_chrome()) {
- Product* p = AddProductFromPreferences(
+ // TODO(huangs): Remove by M30.
+ if (!is_uninstall && !system_install() && prefs.is_multi_install()) {
+ // Check the version of App Launcher ClientState to determine if legacy.
+ const ProductState* app_launcher_state = machine_state.GetProductState(
+ false, BrowserDistribution::CHROME_APP_HOST);
+ if (app_launcher_state) {
+ need_to_migrate_legacy_app_launcher_ =
+ app_launcher_state->version().IsOlderThan("29.0.1508.0");
+ }
+ }
+
+ // App Launcher and Chrome are unified.
+ if (prefs.install_chrome() || prefs.install_chrome_app_launcher() ||
+ need_to_migrate_legacy_app_launcher_) {
+ Product* p1 = AddProductFromPreferences(
BrowserDistribution::CHROME_BROWSER, prefs, machine_state);
VLOG(1) << (is_uninstall ? "Uninstall" : "Install")
- << " distribution: " << p->distribution()->GetAppShortCutName();
+ << " distribution: " << p1->distribution()->GetAppShortCutName();
+
+ if (is_multi_install()) {
+ Product* p2 = AddProductFromPreferences(
+ BrowserDistribution::CHROME_APP_HOST, prefs, machine_state);
+ VLOG(1) << (is_uninstall ? "Uninstall" : "Install")
+ << " distribution: " << p2->distribution()->GetAppShortCutName();
+ }
}
+ // TODO(huangs): Remove by M30.
+ // Create App Launcher shortcuts if --app-launcher is specified.
+ create_app_launcher_shortcuts_ = need_to_migrate_legacy_app_launcher_ ||
+ prefs.install_chrome_app_launcher();
+
if (prefs.install_chrome_frame()) {
Product* p = AddProductFromPreferences(
BrowserDistribution::CHROME_FRAME, prefs, machine_state);
@@ -131,45 +161,16 @@ void InstallerState::Initialize(const CommandLine& command_line,
<< " distribution: " << p->distribution()->GetAppShortCutName();
}
- if (prefs.install_chrome_app_launcher()) {
+ if (!is_uninstall && is_multi_install() &&
+ !FindProduct(BrowserDistribution::CHROME_BINARIES) &&
+ (FindProduct(BrowserDistribution::CHROME_BROWSER) ||
+ FindProduct(BrowserDistribution::CHROME_FRAME) ||
+ FindProduct(BrowserDistribution::CHROME_APP_HOST))) {
+ // Force binaries to be installed/updated.
Product* p = AddProductFromPreferences(
- BrowserDistribution::CHROME_APP_HOST, prefs, machine_state);
- VLOG(1) << (is_uninstall ? "Uninstall" : "Install")
- << " distribution: " << p->distribution()->GetAppShortCutName();
- }
-
- if (!is_uninstall && is_multi_install()) {
- bool need_binaries = false;
- if (FindProduct(BrowserDistribution::CHROME_APP_HOST)) {
- // App Host will happily use Chrome at system level, or binaries at system
- // level, even if app host is user level.
- const ProductState* chrome_state = machine_state.GetProductState(
- true, // system level
- BrowserDistribution::CHROME_BROWSER);
- // If Chrome is at system-level, multi- or otherwise. We'll use it.
- if (!chrome_state) {
- const ProductState* binaries_state = machine_state.GetProductState(
- true, // system level
- BrowserDistribution::CHROME_BINARIES);
- if (!binaries_state)
- need_binaries = true;
- }
- }
-
- // Chrome/Chrome Frame multi need Binaries at their own level.
- if (FindProduct(BrowserDistribution::CHROME_BROWSER))
- need_binaries = true;
-
- if (FindProduct(BrowserDistribution::CHROME_FRAME))
- need_binaries = true;
-
- if (need_binaries && !FindProduct(BrowserDistribution::CHROME_BINARIES)) {
- // Force binaries to be installed/updated.
- Product* p = AddProductFromPreferences(
- BrowserDistribution::CHROME_BINARIES, prefs, machine_state);
- VLOG(1) << "Install distribution: "
- << p->distribution()->GetAppShortCutName();
- }
+ BrowserDistribution::CHROME_BINARIES, prefs, machine_state);
+ VLOG(1) << "Install distribution: "
+ << p->distribution()->GetAppShortCutName();
}
if (is_uninstall && prefs.is_multi_install()) {

Powered by Google App Engine
This is Rietveld 408576698