| 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 #include "chrome/installer/setup/chrome_frame_quick_enable.h" | 5 #include "chrome/installer/setup/chrome_frame_quick_enable.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 machine_state.GetProductState(installer_state.system_install(), | 35 machine_state.GetProductState(installer_state.system_install(), |
| 36 BrowserDistribution::CHROME_BROWSER); | 36 BrowserDistribution::CHROME_BROWSER); |
| 37 if (chrome_state == NULL) { | 37 if (chrome_state == NULL) { |
| 38 LOG(ERROR) << "Chrome Frame quick enable requires Chrome to be installed."; | 38 LOG(ERROR) << "Chrome Frame quick enable requires Chrome to be installed."; |
| 39 return CHROME_NOT_INSTALLED; | 39 return CHROME_NOT_INSTALLED; |
| 40 } else if (!chrome_state->is_multi_install()) { | 40 } else if (!chrome_state->is_multi_install()) { |
| 41 LOG(ERROR) << "Chrome Frame quick enable requires multi-install of Chrome."; | 41 LOG(ERROR) << "Chrome Frame quick enable requires multi-install of Chrome."; |
| 42 return NON_MULTI_INSTALLATION_EXISTS; | 42 return NON_MULTI_INSTALLATION_EXISTS; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // Chrome Frame must not be installed. | 45 // Chrome Frame must not be installed (ready-mode doesn't count). |
| 46 const ProductState* cf_state = | 46 const ProductState* cf_state = |
| 47 machine_state.GetProductState(installer_state.system_install(), | 47 machine_state.GetProductState(installer_state.system_install(), |
| 48 BrowserDistribution::CHROME_FRAME); | 48 BrowserDistribution::CHROME_FRAME); |
| 49 // Make sure we check both user and system installations. | 49 // Make sure we check both user and system installations. |
| 50 if (!cf_state) { | 50 if (!cf_state) { |
| 51 cf_state = machine_state.GetProductState(!installer_state.system_install(), | 51 cf_state = machine_state.GetProductState(!installer_state.system_install(), |
| 52 BrowserDistribution::CHROME_FRAME); | 52 BrowserDistribution::CHROME_FRAME); |
| 53 } | 53 } |
| 54 | 54 |
| 55 if (cf_state != NULL) { | 55 if (cf_state != NULL && |
| 56 !cf_state->uninstall_command().HasSwitch( |
| 57 switches::kChromeFrameReadyMode)) { |
| 56 LOG(ERROR) << "Chrome Frame already installed."; | 58 LOG(ERROR) << "Chrome Frame already installed."; |
| 57 return installer_state.system_install() ? | 59 return installer_state.system_install() ? |
| 58 SYSTEM_LEVEL_INSTALL_EXISTS : USER_LEVEL_INSTALL_EXISTS; | 60 SYSTEM_LEVEL_INSTALL_EXISTS : USER_LEVEL_INSTALL_EXISTS; |
| 59 } | 61 } |
| 60 | 62 |
| 61 return FIRST_INSTALL_SUCCESS; | 63 return FIRST_INSTALL_SUCCESS; |
| 62 } | 64 } |
| 63 | 65 |
| 64 } // end namespace | 66 } // end namespace |
| 65 | 67 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 const Version* opv = chrome_state->old_version(); | 115 const Version* opv = chrome_state->old_version(); |
| 114 AppendPostInstallTasks(*installer_state, setup_path, new_chrome_exe, opv, | 116 AppendPostInstallTasks(*installer_state, setup_path, new_chrome_exe, opv, |
| 115 new_version, temp_path.path(), item_list.get()); | 117 new_version, temp_path.path(), item_list.get()); |
| 116 | 118 |
| 117 // Before updating the channel values, add Chrome back to the mix so that | 119 // Before updating the channel values, add Chrome back to the mix so that |
| 118 // all multi-installed products' channel values get updated. | 120 // all multi-installed products' channel values get updated. |
| 119 installer_state->AddProductFromState(BrowserDistribution::CHROME_BROWSER, | 121 installer_state->AddProductFromState(BrowserDistribution::CHROME_BROWSER, |
| 120 *chrome_state); | 122 *chrome_state); |
| 121 AddGoogleUpdateWorkItems(*installer_state, item_list.get()); | 123 AddGoogleUpdateWorkItems(*installer_state, item_list.get()); |
| 122 | 124 |
| 125 // Add the items to remove the quick-enable-cf command from the registry. |
| 126 AddQuickEnableWorkItems(*installer_state, machine_state, |
| 127 &chrome_state->uninstall_command().GetProgram(), |
| 128 &chrome_state->version(), |
| 129 item_list.get()); |
| 130 |
| 123 if (!item_list->Do()) { | 131 if (!item_list->Do()) { |
| 124 item_list->Rollback(); | 132 item_list->Rollback(); |
| 125 status = INSTALL_FAILED; | 133 status = INSTALL_FAILED; |
| 126 } else { | 134 } else { |
| 127 DCHECK_EQ(FIRST_INSTALL_SUCCESS, status); | 135 DCHECK_EQ(FIRST_INSTALL_SUCCESS, status); |
| 128 VLOG(1) << "Chrome Frame successfully activated."; | 136 VLOG(1) << "Chrome Frame successfully activated."; |
| 129 } | 137 } |
| 130 } | 138 } |
| 131 } | 139 } |
| 132 | 140 |
| 133 return status; | 141 return status; |
| 134 } | 142 } |
| 135 | 143 |
| 136 } // namespace installer | 144 } // namespace installer |
| OLD | NEW |