Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
|
Peter Kasting
2010/10/14 20:30:45
Nit: 2010
| |
| 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/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/windows_version.h" |
| 17 #include "chrome/browser/browser_thread.h" | 17 #include "chrome/browser/browser_thread.h" |
| 18 #include "chrome/installer/util/browser_distribution.h" | 18 #include "chrome/installer/util/browser_distribution.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 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 56 // hwnd must refer to a foregound window in order to get the UAC prompt | 56 // hwnd must refer to a foregound window in order to get the UAC prompt |
| 57 // showing up in the foreground if running on Vista. It can also be NULL if | 57 // showing up in the foreground if running on Vista. It can also be NULL if |
| 58 // background UAC prompts are desired. | 58 // background UAC prompts are desired. |
| 59 HRESULT CoCreateInstanceAsAdmin(REFCLSID class_id, REFIID interface_id, | 59 HRESULT CoCreateInstanceAsAdmin(REFCLSID class_id, REFIID interface_id, |
| 60 HWND hwnd, void** interface_ptr) { | 60 HWND hwnd, void** interface_ptr) { |
| 61 if (!interface_ptr) | 61 if (!interface_ptr) |
| 62 return E_POINTER; | 62 return E_POINTER; |
| 63 | 63 |
| 64 // For Vista we need to instantiate the COM server via the elevation | 64 // For Vista we need to instantiate the COM server via the elevation |
| 65 // moniker. This ensures that the UAC dialog shows up. | 65 // moniker. This ensures that the UAC dialog shows up. |
| 66 if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) { | 66 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
| 67 wchar_t class_id_as_string[MAX_PATH] = {0}; | 67 wchar_t class_id_as_string[MAX_PATH] = {0}; |
| 68 StringFromGUID2(class_id, class_id_as_string, | 68 StringFromGUID2(class_id, class_id_as_string, |
| 69 arraysize(class_id_as_string)); | 69 arraysize(class_id_as_string)); |
| 70 | 70 |
| 71 std::wstring elevation_moniker_name = | 71 std::wstring elevation_moniker_name = |
| 72 StringPrintf(L"Elevation:Administrator!new:%ls", class_id_as_string); | 72 StringPrintf(L"Elevation:Administrator!new:%ls", class_id_as_string); |
| 73 | 73 |
| 74 BIND_OPTS3 bind_opts; | 74 BIND_OPTS3 bind_opts; |
| 75 memset(&bind_opts, 0, sizeof(bind_opts)); | 75 memset(&bind_opts, 0, sizeof(bind_opts)); |
| 76 bind_opts.cbStruct = sizeof(bind_opts); | 76 bind_opts.cbStruct = sizeof(bind_opts); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 } | 322 } |
| 323 | 323 |
| 324 bool GoogleUpdate::ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, | 324 bool GoogleUpdate::ReportFailure(HRESULT hr, GoogleUpdateErrorCode error_code, |
| 325 MessageLoop* main_loop) { | 325 MessageLoop* main_loop) { |
| 326 NOTREACHED() << "Communication with Google Update failed: " << hr | 326 NOTREACHED() << "Communication with Google Update failed: " << hr |
| 327 << " error: " << error_code; | 327 << " error: " << error_code; |
| 328 main_loop->PostTask(FROM_HERE, NewRunnableMethod(this, | 328 main_loop->PostTask(FROM_HERE, NewRunnableMethod(this, |
| 329 &GoogleUpdate::ReportResults, UPGRADE_ERROR, error_code)); | 329 &GoogleUpdate::ReportResults, UPGRADE_ERROR, error_code)); |
| 330 return false; | 330 return false; |
| 331 } | 331 } |
| OLD | NEW |