summaryrefslogtreecommitdiffstats
path: root/chrome_frame/utils.cc
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 15:05:02 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 15:05:02 +0000
commite67a73f47398a8d89a98abde04f3d4c7695a6d30 (patch)
treeae5652a01e709405ab8fc3c2887b0b96b38ca490 /chrome_frame/utils.cc
parent22e1168491f768ae6ff20ded07b3063ac5fe34db (diff)
downloadchromium_src-e67a73f47398a8d89a98abde04f3d4c7695a6d30.zip
chromium_src-e67a73f47398a8d89a98abde04f3d4c7695a6d30.tar.gz
chromium_src-e67a73f47398a8d89a98abde04f3d4c7695a6d30.tar.bz2
When GCF is the default renderer, use Chrome's User-agent header instead of IE's.
TEST=Set IsDefaultRenderer to 1 (REG_DWORD) under the ChromeFrame registry key. Check if the User agent header in requests is the Chrome user agent. Then set the value to 0 and make sure the regular user-agent header is there. BUG=50788 Review URL: http://codereview.chromium.org/3130016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/utils.cc')
-rw-r--r--chrome_frame/utils.cc42
1 files changed, 20 insertions, 22 deletions
diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc
index 33d004f..c2c2d48 100644
--- a/chrome_frame/utils.cc
+++ b/chrome_frame/utils.cc
@@ -21,6 +21,7 @@
#include "base/string_util.h"
#include "base/thread_local.h"
#include "base/utf_string_conversions.h"
+#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/url_constants.h"
#include "chrome/installer/util/chrome_frame_distribution.h"
#include "chrome_frame/extra_system_apis.h"
@@ -45,13 +46,14 @@ const char kGCFProtocol[] = "gcf";
const wchar_t kChromeProtocolPrefix[] = L"gcf:";
const wchar_t kChromeMimeType[] = L"application/chromepage";
const wchar_t kPatchProtocols[] = L"PatchProtocols";
+const wchar_t kChromeFrameConfigKey[] = L"Software\\Google\\ChromeFrame";
+const wchar_t kRenderInGCFUrlList[] = L"RenderInGcfUrls";
+const wchar_t kRenderInHostUrlList[] = L"RenderInHostUrls";
+const wchar_t kEnableGCFRendererByDefault[] = L"IsDefaultRenderer";
+const wchar_t kIexploreProfileName[] = L"iexplore";
+const wchar_t kRundllProfileName[] = L"rundll32";
-static const wchar_t kChromeFrameConfigKey[] =
- L"Software\\Google\\ChromeFrame";
-static const wchar_t kRenderInGCFUrlList[] = L"RenderInGcfUrls";
-static const wchar_t kRenderInHostUrlList[] = L"RenderInHostUrls";
static const wchar_t kAllowUnsafeURLs[] = L"AllowUnsafeURLs";
-static const wchar_t kEnableGCFRendererByDefault[] = L"IsDefaultRenderer";
static const wchar_t kEnableBuggyBhoIntercept[] = L"EnableBuggyBhoIntercept";
static const wchar_t kChromeFrameNPAPIKey[] =
@@ -539,23 +541,6 @@ bool GetModuleVersion(HMODULE module, uint32* high, uint32* low) {
return ok;
}
-bool ParseVersion(const std::wstring& version, uint32* high, uint32* low) {
- DCHECK(high);
- if (!isdigit(version[0]))
- return false;
-
- *high = _wtoi(version.c_str());
- if (low) {
- *low = 0;
- size_t i = version.find(L'.');
- if (i != std::wstring::npos) {
- *low = _wtoi(version.c_str() + i + 1);
- }
- }
-
- return true;
-}
-
HMODULE GetModuleFromAddress(void* address) {
MEMORY_BASIC_INFORMATION info = {0};
::VirtualQuery(address, &info, sizeof(info));
@@ -697,6 +682,18 @@ bool DeleteConfigValue(const wchar_t* value_name) {
return false;
}
+bool IsGcfDefaultRenderer() {
+ // TODO(tommi): Implement caching for this config value as it gets
+ // checked frequently.
+ DWORD is_default = 0; // NOLINT
+ RegKey config_key;
+ if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, KEY_READ)) {
+ config_key.ReadValueDW(kEnableGCFRendererByDefault, &is_default);
+ }
+
+ return is_default != 0;
+}
+
bool IsOptInUrl(const wchar_t* url) {
// TODO(tommi): Unit test.
RegKey config_key;
@@ -1392,3 +1389,4 @@ bool CanNavigate(const GURL& url, IInternetSecurityManager* security_manager,
return true;
}
+