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

Side by Side Diff: chrome_frame/utils.cc

Issue 18770009: Added a new policy setting as well as corrisponding registry key to allow GCF users the option to d… (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 4 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
« chrome_frame/protocol_sink_wrap.cc ('K') | « chrome_frame/utils.h ('k') | 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) 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>
11 #include <shlobj.h> 11 #include <shlobj.h>
12 #include <limits>
12 13
13 #include "base/file_version_info.h" 14 #include "base/file_version_info.h"
14 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/path_service.h" 17 #include "base/path_service.h"
17 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_piece.h" 19 #include "base/strings/string_piece.h"
19 #include "base/strings/string_tokenizer.h" 20 #include "base/strings/string_tokenizer.h"
20 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
21 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 const wchar_t kIexploreProfileName[] = L"iexplore"; 59 const wchar_t kIexploreProfileName[] = L"iexplore";
59 const wchar_t kMetaTag[] = L"meta"; 60 const wchar_t kMetaTag[] = L"meta";
60 const wchar_t kRundllProfileName[] = L"rundll32"; 61 const wchar_t kRundllProfileName[] = L"rundll32";
61 const wchar_t kXUACompatValue[] = L"x-ua-compatible"; 62 const wchar_t kXUACompatValue[] = L"x-ua-compatible";
62 63
63 // Registry key and value names related to Chrome Frame configuration options. 64 // Registry key and value names related to Chrome Frame configuration options.
64 const wchar_t kAllowUnsafeURLs[] = L"AllowUnsafeURLs"; 65 const wchar_t kAllowUnsafeURLs[] = L"AllowUnsafeURLs";
65 const wchar_t kChromeFrameConfigKey[] = L"Software\\Google\\ChromeFrame"; 66 const wchar_t kChromeFrameConfigKey[] = L"Software\\Google\\ChromeFrame";
66 const wchar_t kEnableBuggyBhoIntercept[] = L"EnableBuggyBhoIntercept"; 67 const wchar_t kEnableBuggyBhoIntercept[] = L"EnableBuggyBhoIntercept";
67 const wchar_t kEnableGCFRendererByDefault[] = L"IsDefaultRenderer"; 68 const wchar_t kEnableGCFRendererByDefault[] = L"IsDefaultRenderer";
69 const wchar_t kSkipGCFMetaDataCheck[] = L"SkipGCFMetaDataCheck";
68 const wchar_t kExcludeUAFromDomainList[] = L"ExcludeUAFromDomain"; 70 const wchar_t kExcludeUAFromDomainList[] = L"ExcludeUAFromDomain";
69 const wchar_t kPatchProtocols[] = L"PatchProtocols"; 71 const wchar_t kPatchProtocols[] = L"PatchProtocols";
70 const wchar_t kRenderInGCFUrlList[] = L"RenderInGcfUrls"; 72 const wchar_t kRenderInGCFUrlList[] = L"RenderInGcfUrls";
71 const wchar_t kRenderInHostUrlList[] = L"RenderInHostUrls"; 73 const wchar_t kRenderInHostUrlList[] = L"RenderInHostUrls";
72 74
73 static const wchar_t kChromeFramePersistNPAPIReg[] = L"PersistNPAPIReg"; 75 static const wchar_t kChromeFramePersistNPAPIReg[] = L"PersistNPAPIReg";
74 76
75 const char kAttachExternalTabPrefix[] = "attach_external_tab"; 77 const char kAttachExternalTabPrefix[] = "attach_external_tab";
76 78
77 // Indicates that we are running in a test environment, where execptions, etc 79 // Indicates that we are running in a test environment, where execptions, etc
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 RegKey config_key; 732 RegKey config_key;
731 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, 733 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey,
732 KEY_READ) == ERROR_SUCCESS) { 734 KEY_READ) == ERROR_SUCCESS) {
733 config_key.ReadValueDW(kEnableGCFRendererByDefault, &is_default); 735 config_key.ReadValueDW(kEnableGCFRendererByDefault, &is_default);
734 } 736 }
735 } 737 }
736 738
737 return is_default != 0; 739 return is_default != 0;
738 } 740 }
739 741
742 // Check for the registry key 'SkipGCFMetaDataCheck' and if true, then
743 // ignore presence of <meta http-equiv="X-UA-Compatible" content="chrome=1">
744 bool SkipMetaDataCheck() {
745 // Check policy settings
746 PolicySettings::SkipMetadataCheck metadataCheck =
747 PolicySettings::GetInstance()->skip_metadata_check();
748 if (metadataCheck != PolicySettings::SKIP_METADATA_CHECK_NOT_SPECIFIED)
749 return (metadataCheck == PolicySettings::SKIP_METADATA_CHECK_YES);
750
751 DWORD skip = 0;
752 RegKey config_key;
753 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey,
754 KEY_READ) == ERROR_SUCCESS) {
755 config_key.ReadValueDW(kSkipGCFMetaDataCheck, &skip);
756 }
757 return skip != 0;
758 }
759
740 RendererType RendererTypeForUrl(const std::wstring& url) { 760 RendererType RendererTypeForUrl(const std::wstring& url) {
741 // First check if the default renderer settings are specified by policy. 761 // First check if the default renderer settings are specified by policy.
742 // If so, then that overrides the user settings. 762 // If so, then that overrides the user settings.
743 PolicySettings::RendererForUrl renderer = 763 PolicySettings::RendererForUrl renderer =
744 PolicySettings::GetInstance()->GetRendererForUrl(url.c_str()); 764 PolicySettings::GetInstance()->GetRendererForUrl(url.c_str());
745 if (renderer != PolicySettings::RENDERER_NOT_SPECIFIED) { 765 if (renderer != PolicySettings::RENDERER_NOT_SPECIFIED) {
746 // We may know at this point that policy says do NOT render in Chrome Frame. 766 // We may know at this point that policy says do NOT render in Chrome Frame.
747 // To maintain consistency, we return RENDERER_TYPE_UNDETERMINED so that 767 // To maintain consistency, we return RENDERER_TYPE_UNDETERMINED so that
748 // content sniffing, etc. still take place. 768 // content sniffing, etc. still take place.
749 // TODO(tommi): Clarify the intent here. 769 // TODO(tommi): Clarify the intent here.
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 wininet_connection_count_updated = true; 1694 wininet_connection_count_updated = true;
1675 return true; 1695 return true;
1676 } 1696 }
1677 1697
1678 void GetChromeFrameProfilePath(const string16& profile_name, 1698 void GetChromeFrameProfilePath(const string16& profile_name,
1679 base::FilePath* profile_path) { 1699 base::FilePath* profile_path) {
1680 chrome::GetChromeFrameUserDataDirectory(profile_path); 1700 chrome::GetChromeFrameUserDataDirectory(profile_path);
1681 *profile_path = profile_path->Append(profile_name); 1701 *profile_path = profile_path->Append(profile_name);
1682 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value(); 1702 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value();
1683 } 1703 }
OLDNEW
« chrome_frame/protocol_sink_wrap.cc ('K') | « chrome_frame/utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698