| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 a specific implementation of BrowserDistribution class for | 5 // This file defines a specific implementation of BrowserDistribution class for |
| 6 // Chrome Frame. It overrides the bare minimum of methods necessary to get a | 6 // Chrome Frame. It overrides the bare minimum of methods necessary to get a |
| 7 // Chrome Frame installer that does not interact with Google Chrome or | 7 // Chrome Frame installer that does not interact with Google Chrome or |
| 8 // Chromium installations. | 8 // Chromium installations. |
| 9 | 9 |
| 10 #include "chrome/installer/util/chrome_frame_distribution.h" | 10 #include "chrome/installer/util/chrome_frame_distribution.h" |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "chrome/installer/util/channel_info.h" | 15 #include "chrome/installer/util/channel_info.h" |
| 16 #include "chrome/installer/util/google_update_constants.h" | 16 #include "chrome/installer/util/google_update_constants.h" |
| 17 #include "chrome/installer/util/google_update_settings.h" | 17 #include "chrome/installer/util/google_update_settings.h" |
| 18 #include "chrome/installer/util/helper.h" | 18 #include "chrome/installer/util/helper.h" |
| 19 #include "chrome/installer/util/install_util.h" | 19 #include "chrome/installer/util/install_util.h" |
| 20 #include "chrome/installer/util/l10n_string_util.h" | 20 #include "chrome/installer/util/l10n_string_util.h" |
| 21 #include "chrome/installer/util/master_preferences.h" | |
| 22 #include "chrome/installer/util/master_preferences_constants.h" | |
| 23 | 21 |
| 24 #include "installer_util_strings.h" // NOLINT | 22 #include "installer_util_strings.h" // NOLINT |
| 25 | 23 |
| 26 namespace { | 24 namespace { |
| 27 const wchar_t kChromeFrameGuid[] = L"{8BA986DA-5100-405E-AA35-86F34A02ACBF}"; | 25 const wchar_t kChromeFrameGuid[] = L"{8BA986DA-5100-405E-AA35-86F34A02ACBF}"; |
| 28 } | 26 } |
| 29 | 27 |
| 30 ChromeFrameDistribution::ChromeFrameDistribution( | 28 ChromeFrameDistribution::ChromeFrameDistribution() |
| 31 const installer::MasterPreferences& prefs) | 29 : BrowserDistribution(CHROME_FRAME) { |
| 32 : BrowserDistribution(prefs), ceee_(prefs.install_ceee()), | |
| 33 ready_mode_(false) { | |
| 34 type_ = BrowserDistribution::CHROME_FRAME; | |
| 35 prefs.GetBool(installer::master_preferences::kChromeFrameReadyMode, | |
| 36 &ready_mode_); | |
| 37 | |
| 38 bool system_install = false; | |
| 39 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); | |
| 40 | |
| 41 // See if Chrome Frame is already installed. If so, we must make sure that | |
| 42 // the ceee and ready mode flags match. | |
| 43 CommandLine uninstall(CommandLine::NO_PROGRAM); | |
| 44 if (installer::GetUninstallSwitches(system_install, this, &uninstall)) { | |
| 45 if (!ceee_ && uninstall.HasSwitch(installer::switches::kCeee)) { | |
| 46 LOG(INFO) << "CEEE is not specified on the command line but CEEE is " | |
| 47 "already installed. Implicitly enabling CEEE."; | |
| 48 ceee_ = true; | |
| 49 } | |
| 50 | |
| 51 // If the user has already opted in to CF, we shouldn't set the ready-mode | |
| 52 // flag. If we don't do this, we might have two entries in the Add/Remove | |
| 53 // Programs list that can uninstall GCF. | |
| 54 if (ready_mode_) { | |
| 55 if (!uninstall.HasSwitch(installer::switches::kChromeFrameReadyMode)) { | |
| 56 LOG(INFO) << "Ready mode was specified on the command line but GCF " | |
| 57 "is already fully installed. Ignoring command line."; | |
| 58 ready_mode_ = false; | |
| 59 } | |
| 60 } | |
| 61 } | |
| 62 } | 30 } |
| 63 | 31 |
| 64 std::wstring ChromeFrameDistribution::GetAppGuid() { | 32 std::wstring ChromeFrameDistribution::GetAppGuid() { |
| 65 return kChromeFrameGuid; | 33 return kChromeFrameGuid; |
| 66 } | 34 } |
| 67 | 35 |
| 68 std::wstring ChromeFrameDistribution::GetApplicationName() { | 36 std::wstring ChromeFrameDistribution::GetApplicationName() { |
| 69 const std::wstring& product_name = | 37 const std::wstring& product_name = |
| 70 installer::GetLocalizedString(IDS_PRODUCT_FRAME_NAME_BASE); | 38 installer::GetLocalizedString(IDS_PRODUCT_FRAME_NAME_BASE); |
| 71 return product_name; | 39 return product_name; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 107 |
| 140 void ChromeFrameDistribution::UpdateInstallStatus(bool system_install, | 108 void ChromeFrameDistribution::UpdateInstallStatus(bool system_install, |
| 141 bool incremental_install, bool multi_install, | 109 bool incremental_install, bool multi_install, |
| 142 installer::InstallStatus install_status) { | 110 installer::InstallStatus install_status) { |
| 143 #if defined(GOOGLE_CHROME_BUILD) | 111 #if defined(GOOGLE_CHROME_BUILD) |
| 144 GoogleUpdateSettings::UpdateInstallStatus(system_install, | 112 GoogleUpdateSettings::UpdateInstallStatus(system_install, |
| 145 incremental_install, multi_install, | 113 incremental_install, multi_install, |
| 146 InstallUtil::GetInstallReturnCode(install_status), kChromeFrameGuid); | 114 InstallUtil::GetInstallReturnCode(install_status), kChromeFrameGuid); |
| 147 #endif | 115 #endif |
| 148 } | 116 } |
| 149 | |
| 150 std::vector<FilePath> ChromeFrameDistribution::GetKeyFiles() { | |
| 151 std::vector<FilePath> key_files; | |
| 152 key_files.push_back(FilePath(installer::kChromeFrameDll)); | |
| 153 if (ceee_) { | |
| 154 key_files.push_back(FilePath(installer::kCeeeIeDll)); | |
| 155 key_files.push_back(FilePath(installer::kCeeeBrokerExe)); | |
| 156 } | |
| 157 return key_files; | |
| 158 } | |
| 159 | |
| 160 std::vector<FilePath> ChromeFrameDistribution::GetComDllList() { | |
| 161 std::vector<FilePath> dll_list; | |
| 162 dll_list.push_back(FilePath(installer::kChromeFrameDll)); | |
| 163 if (ceee_) { | |
| 164 dll_list.push_back(FilePath(installer::kCeeeInstallHelperDll)); | |
| 165 dll_list.push_back(FilePath(installer::kCeeeIeDll)); | |
| 166 } | |
| 167 return dll_list; | |
| 168 } | |
| 169 | |
| 170 void ChromeFrameDistribution::AppendUninstallCommandLineFlags( | |
| 171 CommandLine* cmd_line) { | |
| 172 DCHECK(cmd_line); | |
| 173 cmd_line->AppendSwitch(installer::switches::kChromeFrame); | |
| 174 | |
| 175 if (ceee_) | |
| 176 cmd_line->AppendSwitch(installer::switches::kCeee); | |
| 177 | |
| 178 if (ready_mode_) | |
| 179 cmd_line->AppendSwitch(installer::switches::kChromeFrameReadyMode); | |
| 180 } | |
| 181 | |
| 182 bool ChromeFrameDistribution::ShouldCreateUninstallEntry() { | |
| 183 // If Chrome Frame is being installed in ready mode, then we will not | |
| 184 // add an entry to the add/remove dialog. | |
| 185 return !ready_mode_; | |
| 186 } | |
| 187 | |
| 188 bool ChromeFrameDistribution::SetChannelFlags( | |
| 189 bool set, | |
| 190 installer::ChannelInfo* channel_info) { | |
| 191 #if defined(GOOGLE_CHROME_BUILD) | |
| 192 DCHECK(channel_info); | |
| 193 bool modified = channel_info->SetChromeFrame(set); | |
| 194 | |
| 195 // Always remove the options if we're called to remove flags. | |
| 196 if (!set || ceee_) | |
| 197 modified |= channel_info->SetCeee(set); | |
| 198 | |
| 199 if (!set || ready_mode_) | |
| 200 modified |= channel_info->SetReadyMode(set); | |
| 201 | |
| 202 return modified; | |
| 203 #else | |
| 204 return false; | |
| 205 #endif | |
| 206 } | |
| OLD | NEW |