summaryrefslogtreecommitdiffstats
path: root/chrome_frame/utils.cc
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-02 13:39:50 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-02 13:39:50 +0000
commitec18ca6778afde54d02f109b86694eabf8e3d6a5 (patch)
treeea5b10ab16b81e4d3d873962a8ee8c817a6d3a00 /chrome_frame/utils.cc
parent421fd2748b0648e54fe3b6ae8fd0d75faffe76f8 (diff)
downloadchromium_src-ec18ca6778afde54d02f109b86694eabf8e3d6a5.zip
chromium_src-ec18ca6778afde54d02f109b86694eabf8e3d6a5.tar.gz
chromium_src-ec18ca6778afde54d02f109b86694eabf8e3d6a5.tar.bz2
Pin the DLL if we make any patches instead of doing it from the Bho that does not apply the patches itself.
TEST=There should be no changes but we were seeing some potential problems in house with other proprietary browser extensions. BUG=none Review URL: http://codereview.chromium.org/3359001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/utils.cc')
-rw-r--r--chrome_frame/utils.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc
index c2c2d48..e8dfb4b 100644
--- a/chrome_frame/utils.cc
+++ b/chrome_frame/utils.cc
@@ -942,7 +942,9 @@ bool IsHeadlessMode() {
}
bool IsUnpinnedMode() {
- bool unpinned = GetConfigBool(false, kChromeFrameUnpinnedMode);
+ // We only check this value once and then cache it since changing the registry
+ // once we've pinned the DLL won't have any effect.
+ static bool unpinned = GetConfigBool(false, kChromeFrameUnpinnedMode);
return unpinned;
}
@@ -1390,3 +1392,22 @@ bool CanNavigate(const GURL& url, IInternetSecurityManager* security_manager,
return true;
}
+void PinModule() {
+ static bool s_pinned = false;
+ if (!s_pinned && !IsUnpinnedMode()) {
+ FilePath module_path;
+ if (PathService::Get(base::FILE_MODULE, &module_path)) {
+ HMODULE unused;
+ if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_PIN,
+ module_path.value().c_str(), &unused)) {
+ NOTREACHED() << "Failed to pin module " << module_path.value().c_str()
+ << " , last error: " << GetLastError();
+ } else {
+ s_pinned = true;
+ }
+ } else {
+ NOTREACHED() << "Could not get module path.";
+ }
+ }
+}
+