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 "chrome/browser/google/google_update_win.h" | 5 #include "chrome/browser/google/google_update_win.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlcom.h> | 8 #include <atlcom.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 << L". The standard location is: " | 53 << L". The standard location is: " |
54 << user_exe_path.value().c_str() | 54 << user_exe_path.value().c_str() |
55 << L" or " << machine_exe_path.value().c_str() << L"."; | 55 << L" or " << machine_exe_path.value().c_str() << L"."; |
56 return CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY; | 56 return CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY; |
57 } | 57 } |
58 | 58 |
59 string16 app_guid = installer::GetAppGuidForUpdates( | 59 string16 app_guid = installer::GetAppGuidForUpdates( |
60 !InstallUtil::IsPerUserInstall(chrome_exe_path.value().c_str())); | 60 !InstallUtil::IsPerUserInstall(chrome_exe_path.value().c_str())); |
61 DCHECK(!app_guid.empty()); | 61 DCHECK(!app_guid.empty()); |
62 | 62 |
63 if (GoogleUpdateSettings::GetAppUpdatePolicy(app_guid, NULL) == | 63 GoogleUpdateSettings::UpdatePolicy update_policy = |
64 GoogleUpdateSettings::UPDATES_DISABLED) | 64 GoogleUpdateSettings::GetAppUpdatePolicy(app_guid, NULL); |
| 65 |
| 66 if (update_policy == GoogleUpdateSettings::UPDATES_DISABLED) |
65 return GOOGLE_UPDATE_DISABLED_BY_POLICY; | 67 return GOOGLE_UPDATE_DISABLED_BY_POLICY; |
66 | 68 |
| 69 if (update_policy == GoogleUpdateSettings::AUTO_UPDATES_ONLY) |
| 70 return GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY; |
| 71 |
67 return GOOGLE_UPDATE_NO_ERROR; | 72 return GOOGLE_UPDATE_NO_ERROR; |
68 #endif | 73 #endif |
69 } | 74 } |
70 | 75 |
71 // Creates an instance of a COM Local Server class using either plain vanilla | 76 // Creates an instance of a COM Local Server class using either plain vanilla |
72 // CoCreateInstance, or using the Elevation moniker if running on Vista. | 77 // CoCreateInstance, or using the Elevation moniker if running on Vista. |
73 // hwnd must refer to a foregound window in order to get the UAC prompt | 78 // hwnd must refer to a foregound window in order to get the UAC prompt |
74 // showing up in the foreground if running on Vista. It can also be NULL if | 79 // showing up in the foreground if running on Vista. It can also be NULL if |
75 // background UAC prompts are desired. | 80 // background UAC prompts are desired. |
76 HRESULT CoCreateInstanceAsAdmin(REFCLSID class_id, REFIID interface_id, | 81 HRESULT CoCreateInstanceAsAdmin(REFCLSID class_id, REFIID interface_id, |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 base::MessageLoop* main_loop) { | 403 base::MessageLoop* main_loop) { |
399 NOTREACHED() << "Communication with Google Update failed: " << hr | 404 NOTREACHED() << "Communication with Google Update failed: " << hr |
400 << " error: " << error_code | 405 << " error: " << error_code |
401 << ", message: " << error_message.c_str(); | 406 << ", message: " << error_message.c_str(); |
402 main_loop->PostTask( | 407 main_loop->PostTask( |
403 FROM_HERE, | 408 FROM_HERE, |
404 base::Bind(&GoogleUpdate::ReportResults, this, | 409 base::Bind(&GoogleUpdate::ReportResults, this, |
405 UPGRADE_ERROR, error_code, error_message)); | 410 UPGRADE_ERROR, error_code, error_message)); |
406 return false; | 411 return false; |
407 } | 412 } |
OLD | NEW |