Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4206)

Unified Diff: ceee/ie/common/ceee_module_util.cc

Issue 6295006: Merge 68951 - Added refreshing of elevation policy on first run of new versio... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/597/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ceee/ie/common/ceee_module_util.h ('k') | ceee/ie/plugin/bho/browser_helper_object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ceee/ie/common/ceee_module_util.cc
===================================================================
--- ceee/ie/common/ceee_module_util.cc (revision 71509)
+++ ceee/ie/common/ceee_module_util.cc (working copy)
@@ -6,13 +6,17 @@
#include "ceee/ie/common/ceee_module_util.h"
+#include <iepmapi.h>
+
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/stringize_macros.h"
#include "base/win/registry.h"
+#include "ceee/common/com_utils.h"
#include "ceee/common/process_utils_win.h"
+#include "ceee/ie/common/ie_util.h"
#include "chrome/installer/util/google_update_constants.h"
#include "version.h" // NOLINT
@@ -306,4 +310,35 @@
return (1 == value);
}
+bool RefreshElevationPolicyIfNeeded() {
+ if (ie_util::GetIeVersion() < ie_util::IEVERSION_IE7)
+ return false;
+
+ // This may access InternetRegistry instead of real one. However this is
+ // acceptable, we just refresh policy twice.
+ base::win::RegKey hkcu(HKEY_CURRENT_USER, kRegistryPath,
+ KEY_WRITE | KEY_QUERY_VALUE);
+ LOG_IF(ERROR, !hkcu.Valid()) << "Failed to open reg key: " << kRegistryPath;
+ if (!hkcu.Valid())
+ return false;
+
+ std::wstring expected_version = TO_L_STRING(CHROME_VERSION_STRING);
+
+ static const wchar_t kValueName[] = L"last_elevation_refresh";
+ std::wstring last_elevation_refresh_version;
+ bool result = hkcu.ReadValue(kValueName, &last_elevation_refresh_version);
+ if (last_elevation_refresh_version == expected_version)
+ return false;
+
+ HRESULT hr = ::IERefreshElevationPolicy();
+ VLOG(1) << "Elevation policy refresh result: " << com::LogHr(hr);
+
+ // Write after refreshing because it's better to refresh twice, than to miss
+ // once.
+ result = hkcu.WriteValue(kValueName, expected_version.c_str());
+ LOG_IF(ERROR, !result) << "Failed to write a registry value: " << kValueName;
+
+ return true;
+}
+
} // namespace ceee_module_util
« no previous file with comments | « ceee/ie/common/ceee_module_util.h ('k') | ceee/ie/plugin/bho/browser_helper_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698