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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 return TRUE; | 244 return TRUE; |
245 } | 245 } |
246 | 246 |
247 gfx::AcceleratedWidget VersionUpdaterWin::GetElevationParent() { | 247 gfx::AcceleratedWidget VersionUpdaterWin::GetElevationParent() { |
248 // Look for a visible window belonging to the UI thread. | 248 // Look for a visible window belonging to the UI thread. |
249 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 249 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
250 HWND window = NULL; | 250 HWND window = NULL; |
251 EnumThreadWindows(GetCurrentThreadId(), | 251 EnumThreadWindows(GetCurrentThreadId(), |
252 WindowEnumeration, | 252 WindowEnumeration, |
253 reinterpret_cast<LPARAM>(&window)); | 253 reinterpret_cast<LPARAM>(&window)); |
254 #if !defined(USE_AURA) | |
255 // If using Aura, we might not have a Visible window in this process. In | |
256 // theory Google update can cope with that. | |
257 DCHECK(window != NULL) << "Failed to find a valid window handle on thread: " | |
258 << GetCurrentThreadId(); | |
259 #endif | |
260 return window; | 254 return window; |
261 } | 255 } |
262 | 256 |
263 void VersionUpdaterWin::BeginUpdateCheckOnFileThread(bool install_if_newer) { | 257 void VersionUpdaterWin::BeginUpdateCheckOnFileThread(bool install_if_newer) { |
264 scoped_refptr<base::TaskRunner> task_runner( | 258 scoped_refptr<base::TaskRunner> task_runner( |
265 content::BrowserThread::GetMessageLoopProxyForThread( | 259 content::BrowserThread::GetMessageLoopProxyForThread( |
266 content::BrowserThread::FILE)); | 260 content::BrowserThread::FILE)); |
267 BeginUpdateCheck(task_runner, install_if_newer, GetElevationParent(), | 261 BeginUpdateCheck(task_runner, install_if_newer, GetElevationParent(), |
268 base::Bind(&VersionUpdaterWin::OnUpdateCheckResults, | 262 base::Bind(&VersionUpdaterWin::OnUpdateCheckResults, |
269 weak_factory_.GetWeakPtr())); | 263 weak_factory_.GetWeakPtr())); |
270 } | 264 } |
271 | 265 |
272 } // namespace | 266 } // namespace |
273 | 267 |
274 VersionUpdater* VersionUpdater::Create(content::BrowserContext* /* context */) { | 268 VersionUpdater* VersionUpdater::Create(content::BrowserContext* /* context */) { |
275 return new VersionUpdaterWin; | 269 return new VersionUpdaterWin; |
276 } | 270 } |
OLD | NEW |