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_frame/utils.h" | 5 #include "chrome_frame/utils.h" |
6 | 6 |
7 #include <atlsafe.h> | 7 #include <atlsafe.h> |
8 #include <atlsecurity.h> | 8 #include <atlsecurity.h> |
9 #include <htiframe.h> | 9 #include <htiframe.h> |
10 #include <mshtml.h> | 10 #include <mshtml.h> |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 int ret = default_value; | 653 int ret = default_value; |
654 RegKey config_key; | 654 RegKey config_key; |
655 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, | 655 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, |
656 KEY_QUERY_VALUE) == ERROR_SUCCESS) { | 656 KEY_QUERY_VALUE) == ERROR_SUCCESS) { |
657 config_key.ReadValueDW(value_name, reinterpret_cast<DWORD*>(&ret)); | 657 config_key.ReadValueDW(value_name, reinterpret_cast<DWORD*>(&ret)); |
658 } | 658 } |
659 | 659 |
660 return ret; | 660 return ret; |
661 } | 661 } |
662 | 662 |
| 663 int64 GetConfigInt64(int64 default_value, const wchar_t* value_name) { |
| 664 int64 ret = default_value; |
| 665 RegKey config_key; |
| 666 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, |
| 667 KEY_QUERY_VALUE) == ERROR_SUCCESS) { |
| 668 config_key.ReadInt64(value_name, &ret); |
| 669 } |
| 670 |
| 671 return ret; |
| 672 } |
| 673 |
663 bool GetConfigBool(bool default_value, const wchar_t* value_name) { | 674 bool GetConfigBool(bool default_value, const wchar_t* value_name) { |
664 DWORD value = GetConfigInt(default_value, value_name); | 675 DWORD value = GetConfigInt(default_value, value_name); |
665 return (value != FALSE); | 676 return (value != FALSE); |
666 } | 677 } |
667 | 678 |
668 bool SetConfigInt(const wchar_t* value_name, int value) { | 679 bool SetConfigInt(const wchar_t* value_name, int value) { |
669 RegKey config_key; | 680 RegKey config_key; |
670 if (config_key.Create(HKEY_CURRENT_USER, kChromeFrameConfigKey, | 681 if (config_key.Create(HKEY_CURRENT_USER, kChromeFrameConfigKey, |
671 KEY_SET_VALUE) == ERROR_SUCCESS) { | 682 KEY_SET_VALUE) == ERROR_SUCCESS) { |
672 if (config_key.WriteValue(value_name, value) == ERROR_SUCCESS) { | 683 if (config_key.WriteValue(value_name, value) == ERROR_SUCCESS) { |
673 return true; | 684 return true; |
674 } | 685 } |
675 } | 686 } |
676 | 687 |
677 return false; | 688 return false; |
678 } | 689 } |
679 | 690 |
680 bool SetConfigBool(const wchar_t* value_name, bool value) { | 691 bool SetConfigBool(const wchar_t* value_name, bool value) { |
681 return SetConfigInt(value_name, value); | 692 return SetConfigInt(value_name, value); |
682 } | 693 } |
683 | 694 |
| 695 bool SetConfigInt64(const wchar_t* value_name, int64 value) { |
| 696 RegKey config_key; |
| 697 if (config_key.Create(HKEY_CURRENT_USER, kChromeFrameConfigKey, |
| 698 KEY_SET_VALUE) == ERROR_SUCCESS) { |
| 699 if (config_key.WriteValue(value_name, &value, sizeof(value), |
| 700 REG_QWORD) == ERROR_SUCCESS) { |
| 701 return true; |
| 702 } |
| 703 } |
| 704 |
| 705 return false; |
| 706 } |
| 707 |
684 bool DeleteConfigValue(const wchar_t* value_name) { | 708 bool DeleteConfigValue(const wchar_t* value_name) { |
685 RegKey config_key; | 709 RegKey config_key; |
686 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, | 710 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, |
687 KEY_WRITE) == ERROR_SUCCESS) { | 711 KEY_WRITE) == ERROR_SUCCESS) { |
688 if (config_key.DeleteValue(value_name) == ERROR_SUCCESS) { | 712 if (config_key.DeleteValue(value_name) == ERROR_SUCCESS) { |
689 return true; | 713 return true; |
690 } | 714 } |
691 } | 715 } |
692 return false; | 716 return false; |
693 } | 717 } |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 wininet_connection_count_updated = true; | 1674 wininet_connection_count_updated = true; |
1651 return true; | 1675 return true; |
1652 } | 1676 } |
1653 | 1677 |
1654 void GetChromeFrameProfilePath(const string16& profile_name, | 1678 void GetChromeFrameProfilePath(const string16& profile_name, |
1655 base::FilePath* profile_path) { | 1679 base::FilePath* profile_path) { |
1656 chrome::GetChromeFrameUserDataDirectory(profile_path); | 1680 chrome::GetChromeFrameUserDataDirectory(profile_path); |
1657 *profile_path = profile_path->Append(profile_name); | 1681 *profile_path = profile_path->Append(profile_name); |
1658 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value(); | 1682 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value(); |
1659 } | 1683 } |
OLD | NEW |