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

Side by Side Diff: chrome_frame/chrome_tab.cc

Issue 6303005: Hopefully the last of the changes to fix the ChromeFrame InstallFlowTest fail... (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // chrome_tab.cc : Implementation of DLL Exports. 5 // chrome_tab.cc : Implementation of DLL Exports.
6 6
7 // Include without path to make GYP build see it. 7 // Include without path to make GYP build see it.
8 #include "chrome_tab.h" // NOLINT 8 #include "chrome_tab.h" // NOLINT
9 9
10 #include <atlsecurity.h> 10 #include <atlsecurity.h>
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 // To delete the user agent, set value to NULL. 429 // To delete the user agent, set value to NULL.
430 // The is_system parameter indicates whether this is a per machine or a per 430 // The is_system parameter indicates whether this is a per machine or a per
431 // user installation. 431 // user installation.
432 HRESULT SetChromeFrameUA(bool is_system, const wchar_t* value) { 432 HRESULT SetChromeFrameUA(bool is_system, const wchar_t* value) {
433 HRESULT hr = E_FAIL; 433 HRESULT hr = E_FAIL;
434 HKEY parent_hive = is_system ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 434 HKEY parent_hive = is_system ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
435 435
436 RegKey ua_key; 436 RegKey ua_key;
437 if (ua_key.Create(parent_hive, kPostPlatformUAKey, KEY_READ | KEY_WRITE)) { 437 if (ua_key.Create(parent_hive, kPostPlatformUAKey, KEY_READ | KEY_WRITE)) {
438 // Make sure that we unregister ChromeFrame UA strings registered previously 438 // Make sure that we unregister ChromeFrame UA strings registered previously
439 wchar_t name[MAX_PATH + 1] = {}; 439 wchar_t value_name[MAX_PATH + 1] = {};
440 wchar_t value[MAX_PATH + 1] = {}; 440 wchar_t value_data[MAX_PATH + 1] = {};
441 441
442 DWORD value_index = 0; 442 DWORD value_index = 0;
443 while (value_index < ua_key.ValueCount()) { 443 while (value_index < ua_key.ValueCount()) {
444 DWORD name_size = arraysize(name); 444 DWORD name_size = arraysize(value_name);
445 DWORD value_size = arraysize(value); 445 DWORD value_size = arraysize(value_data);
446 DWORD type = 0; 446 DWORD type = 0;
447 LRESULT ret = ::RegEnumValue(ua_key.Handle(), value_index, name, 447 LRESULT ret = ::RegEnumValue(ua_key.Handle(), value_index, value_name,
448 &name_size, NULL, &type, 448 &name_size, NULL, &type,
449 reinterpret_cast<BYTE*>(value), 449 reinterpret_cast<BYTE*>(value_data),
450 &value_size); 450 &value_size);
451 if (ret == ERROR_SUCCESS) { 451 if (ret == ERROR_SUCCESS) {
452 if (StartsWith(name, kChromeFramePrefix, false)) { 452 if (StartsWith(value_name, kChromeFramePrefix, false)) {
453 ua_key.DeleteValue(name); 453 ua_key.DeleteValue(value_name);
454 } else { 454 } else {
455 ++value_index; 455 ++value_index;
456 } 456 }
457 } else { 457 } else {
458 break; 458 break;
459 } 459 }
460 } 460 }
461 461
462 std::wstring chrome_frame_ua_value_name = kChromeFramePrefix; 462 std::wstring chrome_frame_ua_value_name = kChromeFramePrefix;
463 chrome_frame_ua_value_name += GetCurrentModuleVersion(); 463 chrome_frame_ua_value_name += GetCurrentModuleVersion();
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 sd.GetDacl(&new_dacl); 810 sd.GetDacl(&new_dacl);
811 new_dacl.AddAllowedAce(token_.GetUser(), GENERIC_WRITE | GENERIC_READ); 811 new_dacl.AddAllowedAce(token_.GetUser(), GENERIC_WRITE | GENERIC_READ);
812 if (AtlSetDacl(object_name.c_str(), SE_REGISTRY_KEY, new_dacl)) { 812 if (AtlSetDacl(object_name.c_str(), SE_REGISTRY_KEY, new_dacl)) {
813 result = SetOrDeleteMimeHandlerKey(enable, HKEY_LOCAL_MACHINE); 813 result = SetOrDeleteMimeHandlerKey(enable, HKEY_LOCAL_MACHINE);
814 } 814 }
815 } 815 }
816 816
817 backup.RestoreSecurity(object_name.c_str()); 817 backup.RestoreSecurity(object_name.c_str());
818 return result; 818 return result;
819 } 819 }
OLDNEW
« 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