| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/browser/google_update.h" | 5 #include "chrome/browser/google_update.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlcom.h> | 8 #include <atlcom.h> |
| 9 | 9 |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/scoped_comptr_win.h" | 12 #include "base/scoped_comptr_win.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/task.h" | 14 #include "base/task.h" |
| 15 #include "base/thread.h" | 15 #include "base/thread.h" |
| 16 #include "base/win_util.h" | 16 #include "base/win_util.h" |
| 17 #include "chrome/app/client_util.h" | 17 #include "chrome/app/client_util.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/chrome_thread.h" |
| 19 #include "chrome/installer/util/google_update_constants.h" | 19 #include "chrome/installer/util/google_update_constants.h" |
| 20 #include "chrome/installer/util/helper.h" | 20 #include "chrome/installer/util/helper.h" |
| 21 #include "chrome/installer/util/install_util.h" | 21 #include "chrome/installer/util/install_util.h" |
| 22 #include "views/window/window.h" | 22 #include "views/window/window.h" |
| 23 #include "google_update_idl_i.c" | 23 #include "google_update_idl_i.c" |
| 24 | 24 |
| 25 using views::Window; | 25 using views::Window; |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 // Check if the currently running instance can be updated by Google Update. | 28 // Check if the currently running instance can be updated by Google Update. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 GoogleUpdate::~GoogleUpdate() { | 206 GoogleUpdate::~GoogleUpdate() { |
| 207 } | 207 } |
| 208 | 208 |
| 209 //////////////////////////////////////////////////////////////////////////////// | 209 //////////////////////////////////////////////////////////////////////////////// |
| 210 // GoogleUpdate, views::DialogDelegate implementation: | 210 // GoogleUpdate, views::DialogDelegate implementation: |
| 211 | 211 |
| 212 void GoogleUpdate::CheckForUpdate(bool install_if_newer, Window* window) { | 212 void GoogleUpdate::CheckForUpdate(bool install_if_newer, Window* window) { |
| 213 // We need to shunt this request over to InitiateGoogleUpdateCheck and have | 213 // We need to shunt this request over to InitiateGoogleUpdateCheck and have |
| 214 // it run in the file thread. | 214 // it run in the file thread. |
| 215 MessageLoop* file_loop = g_browser_process->file_thread()->message_loop(); | 215 ChromeThread::PostTask( |
| 216 file_loop->PostTask(FROM_HERE, NewRunnableMethod(this, | 216 ChromeThread::FILE, FROM_HERE, |
| 217 &GoogleUpdate::InitiateGoogleUpdateCheck, | 217 NewRunnableMethod( |
| 218 install_if_newer, window, MessageLoop::current())); | 218 this, &GoogleUpdate::InitiateGoogleUpdateCheck, install_if_newer, |
| 219 window, MessageLoop::current())); |
| 219 } | 220 } |
| 220 | 221 |
| 221 // Adds/removes a listener. Only one listener is maintained at the moment. | 222 // Adds/removes a listener. Only one listener is maintained at the moment. |
| 222 void GoogleUpdate::AddStatusChangeListener( | 223 void GoogleUpdate::AddStatusChangeListener( |
| 223 GoogleUpdateStatusListener* listener) { | 224 GoogleUpdateStatusListener* listener) { |
| 224 DCHECK(!listener_); | 225 DCHECK(!listener_); |
| 225 listener_ = listener; | 226 listener_ = listener; |
| 226 } | 227 } |
| 227 | 228 |
| 228 void GoogleUpdate::RemoveStatusChangeListener() { | 229 void GoogleUpdate::RemoveStatusChangeListener() { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } | 332 } |
| 332 | 333 |
| 333 bool GoogleUpdate::ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, | 334 bool GoogleUpdate::ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, |
| 334 MessageLoop* main_loop) { | 335 MessageLoop* main_loop) { |
| 335 NOTREACHED() << "Communication with Google Update failed: " << hr | 336 NOTREACHED() << "Communication with Google Update failed: " << hr |
| 336 << " error: " << error_code; | 337 << " error: " << error_code; |
| 337 main_loop->PostTask(FROM_HERE, NewRunnableMethod(this, | 338 main_loop->PostTask(FROM_HERE, NewRunnableMethod(this, |
| 338 &GoogleUpdate::ReportResults, UPGRADE_ERROR, error_code)); | 339 &GoogleUpdate::ReportResults, UPGRADE_ERROR, error_code)); |
| 339 return false; | 340 return false; |
| 340 } | 341 } |
| OLD | NEW |