| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 } | 642 } |
| 643 | 643 |
| 644 return ret; | 644 return ret; |
| 645 } | 645 } |
| 646 | 646 |
| 647 int GetConfigInt(int default_value, const wchar_t* value_name) { | 647 int GetConfigInt(int default_value, const wchar_t* value_name) { |
| 648 int ret = default_value; | 648 int ret = default_value; |
| 649 RegKey config_key; | 649 RegKey config_key; |
| 650 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, | 650 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, |
| 651 KEY_QUERY_VALUE) == ERROR_SUCCESS) { | 651 KEY_QUERY_VALUE) == ERROR_SUCCESS) { |
| 652 config_key.ReadValueDW(value_name, reinterpret_cast<DWORD*>(&ret)); | 652 config_key.ReadValue(value_name, reinterpret_cast<DWORD*>(&ret)); |
| 653 } | 653 } |
| 654 | 654 |
| 655 return ret; | 655 return ret; |
| 656 } | 656 } |
| 657 | 657 |
| 658 bool GetConfigBool(bool default_value, const wchar_t* value_name) { | 658 bool GetConfigBool(bool default_value, const wchar_t* value_name) { |
| 659 DWORD value = GetConfigInt(default_value, value_name); | 659 DWORD value = GetConfigInt(default_value, value_name); |
| 660 return (value != FALSE); | 660 return (value != FALSE); |
| 661 } | 661 } |
| 662 | 662 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 PolicySettings::RendererForUrl renderer = | 694 PolicySettings::RendererForUrl renderer = |
| 695 PolicySettings::GetInstance()->default_renderer(); | 695 PolicySettings::GetInstance()->default_renderer(); |
| 696 if (renderer != PolicySettings::RENDERER_NOT_SPECIFIED) { | 696 if (renderer != PolicySettings::RENDERER_NOT_SPECIFIED) { |
| 697 is_default = (renderer == PolicySettings::RENDER_IN_CHROME_FRAME); | 697 is_default = (renderer == PolicySettings::RENDER_IN_CHROME_FRAME); |
| 698 } else { | 698 } else { |
| 699 // TODO(tommi): Implement caching for this config value as it gets | 699 // TODO(tommi): Implement caching for this config value as it gets |
| 700 // checked frequently. | 700 // checked frequently. |
| 701 RegKey config_key; | 701 RegKey config_key; |
| 702 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, | 702 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, |
| 703 KEY_READ) == ERROR_SUCCESS) { | 703 KEY_READ) == ERROR_SUCCESS) { |
| 704 config_key.ReadValueDW(kEnableGCFRendererByDefault, &is_default); | 704 config_key.ReadValue(kEnableGCFRendererByDefault, &is_default); |
| 705 } | 705 } |
| 706 } | 706 } |
| 707 | 707 |
| 708 return is_default != 0; | 708 return is_default != 0; |
| 709 } | 709 } |
| 710 | 710 |
| 711 RendererType RendererTypeForUrl(const std::wstring& url) { | 711 RendererType RendererTypeForUrl(const std::wstring& url) { |
| 712 // First check if the default renderer settings are specified by policy. | 712 // First check if the default renderer settings are specified by policy. |
| 713 // If so, then that overrides the user settings. | 713 // If so, then that overrides the user settings. |
| 714 PolicySettings::RendererForUrl renderer = | 714 PolicySettings::RendererForUrl renderer = |
| (...skipping 10 matching lines...) Expand all Loading... |
| 725 RegKey config_key; | 725 RegKey config_key; |
| 726 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, | 726 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, |
| 727 KEY_READ) != ERROR_SUCCESS) { | 727 KEY_READ) != ERROR_SUCCESS) { |
| 728 return RENDERER_TYPE_UNDETERMINED; | 728 return RENDERER_TYPE_UNDETERMINED; |
| 729 } | 729 } |
| 730 | 730 |
| 731 RendererType renderer_type = RENDERER_TYPE_UNDETERMINED; | 731 RendererType renderer_type = RENDERER_TYPE_UNDETERMINED; |
| 732 | 732 |
| 733 const wchar_t* url_list_name = NULL; | 733 const wchar_t* url_list_name = NULL; |
| 734 int render_in_cf_by_default = FALSE; | 734 int render_in_cf_by_default = FALSE; |
| 735 config_key.ReadValueDW(kEnableGCFRendererByDefault, | 735 config_key.ReadValue(kEnableGCFRendererByDefault, |
| 736 reinterpret_cast<DWORD*>(&render_in_cf_by_default)); | 736 reinterpret_cast<DWORD*>(&render_in_cf_by_default)); |
| 737 if (render_in_cf_by_default) { | 737 if (render_in_cf_by_default) { |
| 738 url_list_name = kRenderInHostUrlList; | 738 url_list_name = kRenderInHostUrlList; |
| 739 renderer_type = RENDERER_TYPE_CHROME_DEFAULT_RENDERER; | 739 renderer_type = RENDERER_TYPE_CHROME_DEFAULT_RENDERER; |
| 740 } else { | 740 } else { |
| 741 url_list_name = kRenderInGCFUrlList; | 741 url_list_name = kRenderInGCFUrlList; |
| 742 } | 742 } |
| 743 | 743 |
| 744 bool match_found = false; | 744 bool match_found = false; |
| 745 base::win::RegistryValueIterator url_list(config_key.Handle(), url_list_name); | 745 base::win::RegistryValueIterator url_list(config_key.Handle(), url_list_name); |
| 746 while (!match_found && url_list.Valid()) { | 746 while (!match_found && url_list.Valid()) { |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1634 ret = InternetSetOption(NULL, connection_options[option_index], | 1634 ret = InternetSetOption(NULL, connection_options[option_index], |
| 1635 &connections, connection_value_size); | 1635 &connections, connection_value_size); |
| 1636 if (!ret) { | 1636 if (!ret) { |
| 1637 return false; | 1637 return false; |
| 1638 } | 1638 } |
| 1639 } | 1639 } |
| 1640 wininet_connection_count_updated = true; | 1640 wininet_connection_count_updated = true; |
| 1641 return true; | 1641 return true; |
| 1642 } | 1642 } |
| 1643 | 1643 |
| OLD | NEW |