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

Unified Diff: chrome_frame/chrome_tab.cc

Issue 6355001: Unregister previous ChromeFrame UA strings registered under the PostPlatform ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/chrome_tab.cc
===================================================================
--- chrome_frame/chrome_tab.cc (revision 71338)
+++ chrome_frame/chrome_tab.cc (working copy)
@@ -434,13 +434,35 @@
HKEY parent_hive = is_system ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
RegKey ua_key;
- if (ua_key.Create(parent_hive, kPostPlatformUAKey, KEY_WRITE)) {
+ if (ua_key.Create(parent_hive, kPostPlatformUAKey, KEY_READ | KEY_WRITE)) {
+ // Make sure that we unregister ChromeFrame UA strings registered previously
+ wchar_t name[MAX_PATH + 1] = {};
+ wchar_t value[MAX_PATH + 1] = {};
+
+ DWORD value_index = 0;
+ while (value_index < ua_key.ValueCount()) {
+ DWORD name_size = arraysize(name);
+ DWORD value_size = arraysize(value);
+ DWORD type = 0;
+ LRESULT ret = ::RegEnumValue(ua_key.Handle(), value_index, name,
+ &name_size, NULL, &type,
+ reinterpret_cast<BYTE*>(value),
+ &value_size);
+ if (ret == ERROR_SUCCESS) {
+ if (StartsWith(name, kChromeFramePrefix, false)) {
+ ua_key.DeleteValue(name);
+ } else {
+ ++value_index;
+ }
+ } else {
+ break;
+ }
+ }
+
std::wstring chrome_frame_ua_value_name = kChromeFramePrefix;
chrome_frame_ua_value_name += GetCurrentModuleVersion();
if (value) {
ua_key.WriteValue(chrome_frame_ua_value_name.c_str(), value);
- } else {
- ua_key.DeleteValue(chrome_frame_ua_value_name.c_str());
}
hr = S_OK;
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698