| 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" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // Creates an instance of a COM Local Server class using either plain vanilla | 51 // Creates an instance of a COM Local Server class using either plain vanilla |
| 52 // CoCreateInstance, or using the Elevation moniker if running on Vista. | 52 // CoCreateInstance, or using the Elevation moniker if running on Vista. |
| 53 HRESULT CoCreateInstanceAsAdmin(REFCLSID class_id, REFIID interface_id, | 53 HRESULT CoCreateInstanceAsAdmin(REFCLSID class_id, REFIID interface_id, |
| 54 void** interface_ptr) { | 54 void** interface_ptr) { |
| 55 if (!interface_ptr) | 55 if (!interface_ptr) |
| 56 return E_POINTER; | 56 return E_POINTER; |
| 57 | 57 |
| 58 // For Vista we need to instantiate the COM server via the elevation | 58 // For Vista we need to instantiate the COM server via the elevation |
| 59 // moniker. This ensures that the UAC dialog shows up. | 59 // moniker. This ensures that the UAC dialog shows up. |
| 60 if (win_util::GetWinVersion() == win_util::WINVERSION_VISTA) { | 60 if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) { |
| 61 wchar_t class_id_as_string[MAX_PATH] = {0}; | 61 wchar_t class_id_as_string[MAX_PATH] = {0}; |
| 62 StringFromGUID2(class_id, class_id_as_string, | 62 StringFromGUID2(class_id, class_id_as_string, |
| 63 arraysize(class_id_as_string)); | 63 arraysize(class_id_as_string)); |
| 64 | 64 |
| 65 std::wstring elevation_moniker_name = | 65 std::wstring elevation_moniker_name = |
| 66 StringPrintf(L"Elevation:Administrator!new:%s", class_id_as_string); | 66 StringPrintf(L"Elevation:Administrator!new:%s", class_id_as_string); |
| 67 | 67 |
| 68 BIND_OPTS3 bind_opts; | 68 BIND_OPTS3 bind_opts; |
| 69 memset(&bind_opts, 0, sizeof(bind_opts)); | 69 memset(&bind_opts, 0, sizeof(bind_opts)); |
| 70 | 70 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } | 316 } |
| 317 | 317 |
| 318 bool GoogleUpdate::ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, | 318 bool GoogleUpdate::ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, |
| 319 MessageLoop* main_loop) { | 319 MessageLoop* main_loop) { |
| 320 NOTREACHED() << "Communication with Google Update failed: " << hr | 320 NOTREACHED() << "Communication with Google Update failed: " << hr |
| 321 << " error: " << error_code; | 321 << " error: " << error_code; |
| 322 main_loop->PostTask(FROM_HERE, NewRunnableMethod(this, | 322 main_loop->PostTask(FROM_HERE, NewRunnableMethod(this, |
| 323 &GoogleUpdate::ReportResults, UPGRADE_ERROR, error_code)); | 323 &GoogleUpdate::ReportResults, UPGRADE_ERROR, error_code)); |
| 324 return false; | 324 return false; |
| 325 } | 325 } |
| OLD | NEW |