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

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,41 @@
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
+ std::wstring chrome_frame_ua_pattern = kChromeFramePrefix;
+ chrome_frame_ua_pattern += L"*";
+
+ wchar_t name[MAX_PATH + 1] = {};
+ wchar_t value[MAX_PATH + 1] = {};
+
+ for (DWORD value_index = 0; value_index < ua_key.ValueCount();
amit 2011/01/14 06:38:51 nit: while (value_index < ua_key.ValueCount()) and
ananta 2011/01/14 06:44:11 Done.
+ value_index++) {
+ DWORD name_size = arraysize(name);
+ DWORD value_size = arraysize(value);
+ DWORD type = 0;
+ LRESULT ret = ::RegEnumValue(ua_key.Handle(),
amit 2011/01/14 06:38:51 nit: fit more on one line to match rest of the sou
ananta 2011/01/14 06:44:11 Done.
+ value_index,
+ name,
+ &name_size,
+ NULL,
+ &type, reinterpret_cast<BYTE*>(value),
+ &value_size);
+ if (ret == ERROR_SUCCESS) {
+ if (MatchPattern(name, chrome_frame_ua_pattern)) {
amit 2011/01/14 06:38:51 A simple StartsWith is enough instead of MatchPatt
ananta 2011/01/14 06:44:11 Done.
+ ua_key.DeleteValue(name);
+ 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