OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/version.h" | 9 #include "base/version.h" |
10 #include "base/win/win_util.h" | 10 #include "base/win/win_util.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 // On-demand updates for Chrome don't work in Vista RTM when UAC is turned | 137 // On-demand updates for Chrome don't work in Vista RTM when UAC is turned |
138 // off. So, in this case, the version updater must not mention | 138 // off. So, in this case, the version updater must not mention |
139 // on-demand updates. Silent updates (in the background) should still | 139 // on-demand updates. Silent updates (in the background) should still |
140 // work as before - enabling UAC or installing the latest service pack | 140 // work as before - enabling UAC or installing the latest service pack |
141 // for Vista is another option. | 141 // for Vista is another option. |
142 if (!(base::win::GetVersion() == base::win::VERSION_VISTA && | 142 if (!(base::win::GetVersion() == base::win::VERSION_VISTA && |
143 (base::win::OSInfo::GetInstance()->service_pack().major == 0) && | 143 (base::win::OSInfo::GetInstance()->service_pack().major == 0) && |
144 !base::win::UserAccountControlIsEnabled())) { | 144 !base::win::UserAccountControlIsEnabled())) { |
145 // This could happen if the page got refreshed after results were returned. | 145 // This could happen if the page got refreshed after results were returned. |
146 if (!google_updater_) | 146 if (!google_updater_.get()) |
147 CreateGoogleUpdater(); | 147 CreateGoogleUpdater(); |
148 UpdateStatus(UPGRADE_CHECK_STARTED, GOOGLE_UPDATE_NO_ERROR, | 148 UpdateStatus(UPGRADE_CHECK_STARTED, GOOGLE_UPDATE_NO_ERROR, |
149 base::string16()); | 149 base::string16()); |
150 // Specify false to not upgrade yet. | 150 // Specify false to not upgrade yet. |
151 google_updater_->CheckForUpdate(false, GetElevationParent()); | 151 google_updater_->CheckForUpdate(false, GetElevationParent()); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 void VersionUpdaterWin::RelaunchBrowser() const { | 155 void VersionUpdaterWin::RelaunchBrowser() const { |
156 chrome::AttemptRestart(); | 156 chrome::AttemptRestart(); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 base::string16()); | 252 base::string16()); |
253 } | 253 } |
254 | 254 |
255 void VersionUpdaterWin::CreateGoogleUpdater() { | 255 void VersionUpdaterWin::CreateGoogleUpdater() { |
256 ClearGoogleUpdater(); | 256 ClearGoogleUpdater(); |
257 google_updater_ = new GoogleUpdate(); | 257 google_updater_ = new GoogleUpdate(); |
258 google_updater_->set_status_listener(this); | 258 google_updater_->set_status_listener(this); |
259 } | 259 } |
260 | 260 |
261 void VersionUpdaterWin::ClearGoogleUpdater() { | 261 void VersionUpdaterWin::ClearGoogleUpdater() { |
262 if (google_updater_) { | 262 if (google_updater_.get()) { |
263 google_updater_->set_status_listener(NULL); | 263 google_updater_->set_status_listener(NULL); |
264 google_updater_ = NULL; | 264 google_updater_ = NULL; |
265 } | 265 } |
266 } | 266 } |
267 | 267 |
268 BOOL CALLBACK WindowEnumeration(HWND window, LPARAM param) { | 268 BOOL CALLBACK WindowEnumeration(HWND window, LPARAM param) { |
269 if (IsWindowVisible(window)) { | 269 if (IsWindowVisible(window)) { |
270 HWND* returned_window = reinterpret_cast<HWND*>(param); | 270 HWND* returned_window = reinterpret_cast<HWND*>(param); |
271 *returned_window = window; | 271 *returned_window = window; |
272 return FALSE; | 272 return FALSE; |
(...skipping 15 matching lines...) Expand all Loading... |
288 << GetCurrentThreadId(); | 288 << GetCurrentThreadId(); |
289 #endif | 289 #endif |
290 return window; | 290 return window; |
291 } | 291 } |
292 | 292 |
293 } // namespace | 293 } // namespace |
294 | 294 |
295 VersionUpdater* VersionUpdater::Create() { | 295 VersionUpdater* VersionUpdater::Create() { |
296 return new VersionUpdaterWin; | 296 return new VersionUpdaterWin; |
297 } | 297 } |
OLD | NEW |