| 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/browser/google/google_update.h" | 5 #include "chrome/browser/google/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/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/stringprintf.h" |
| 14 #include "base/task.h" | 15 #include "base/task.h" |
| 15 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 16 #include "base/win/scoped_comptr.h" | 17 #include "base/win/scoped_comptr.h" |
| 17 #include "base/win/windows_version.h" | 18 #include "base/win/windows_version.h" |
| 18 #include "chrome/installer/util/browser_distribution.h" | 19 #include "chrome/installer/util/browser_distribution.h" |
| 19 #include "chrome/installer/util/google_update_settings.h" | 20 #include "chrome/installer/util/google_update_settings.h" |
| 20 #include "chrome/installer/util/helper.h" | 21 #include "chrome/installer/util/helper.h" |
| 21 #include "chrome/installer/util/install_util.h" | 22 #include "chrome/installer/util/install_util.h" |
| 22 #include "content/browser/browser_thread.h" | 23 #include "content/browser/browser_thread.h" |
| 23 #include "google_update_idl_i.c" | 24 #include "google_update_idl_i.c" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return E_POINTER; | 77 return E_POINTER; |
| 77 | 78 |
| 78 // For Vista we need to instantiate the COM server via the elevation | 79 // For Vista we need to instantiate the COM server via the elevation |
| 79 // moniker. This ensures that the UAC dialog shows up. | 80 // moniker. This ensures that the UAC dialog shows up. |
| 80 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { | 81 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
| 81 wchar_t class_id_as_string[MAX_PATH] = {0}; | 82 wchar_t class_id_as_string[MAX_PATH] = {0}; |
| 82 StringFromGUID2(class_id, class_id_as_string, | 83 StringFromGUID2(class_id, class_id_as_string, |
| 83 arraysize(class_id_as_string)); | 84 arraysize(class_id_as_string)); |
| 84 | 85 |
| 85 std::wstring elevation_moniker_name = | 86 std::wstring elevation_moniker_name = |
| 86 StringPrintf(L"Elevation:Administrator!new:%ls", class_id_as_string); | 87 base::StringPrintf(L"Elevation:Administrator!new:%ls", |
| 88 class_id_as_string); |
| 87 | 89 |
| 88 BIND_OPTS3 bind_opts; | 90 BIND_OPTS3 bind_opts; |
| 89 memset(&bind_opts, 0, sizeof(bind_opts)); | 91 memset(&bind_opts, 0, sizeof(bind_opts)); |
| 90 bind_opts.cbStruct = sizeof(bind_opts); | 92 bind_opts.cbStruct = sizeof(bind_opts); |
| 91 bind_opts.dwClassContext = CLSCTX_LOCAL_SERVER; | 93 bind_opts.dwClassContext = CLSCTX_LOCAL_SERVER; |
| 92 bind_opts.hwnd = hwnd; | 94 bind_opts.hwnd = hwnd; |
| 93 | 95 |
| 94 return CoGetObject(elevation_moniker_name.c_str(), &bind_opts, | 96 return CoGetObject(elevation_moniker_name.c_str(), &bind_opts, |
| 95 interface_id, reinterpret_cast<void**>(interface_ptr)); | 97 interface_id, reinterpret_cast<void**>(interface_ptr)); |
| 96 } | 98 } |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 } | 344 } |
| 343 | 345 |
| 344 bool GoogleUpdate::ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, | 346 bool GoogleUpdate::ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, |
| 345 MessageLoop* main_loop) { | 347 MessageLoop* main_loop) { |
| 346 NOTREACHED() << "Communication with Google Update failed: " << hr | 348 NOTREACHED() << "Communication with Google Update failed: " << hr |
| 347 << " error: " << error_code; | 349 << " error: " << error_code; |
| 348 main_loop->PostTask(FROM_HERE, NewRunnableMethod(this, | 350 main_loop->PostTask(FROM_HERE, NewRunnableMethod(this, |
| 349 &GoogleUpdate::ReportResults, UPGRADE_ERROR, error_code)); | 351 &GoogleUpdate::ReportResults, UPGRADE_ERROR, error_code)); |
| 350 return false; | 352 return false; |
| 351 } | 353 } |
| OLD | NEW |