summaryrefslogtreecommitdiffstats
path: root/chrome_frame/utils.h
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-17 04:48:37 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-17 04:48:37 +0000
commit3f55e8712f88d8477d9e58f68958e83c92664389 (patch)
tree21f9eeeda041fd570c31d8b0f266f780b767418f /chrome_frame/utils.h
parentcd1c89e833b7e67b7a7ca8799122e07b65999771 (diff)
downloadchromium_src-3f55e8712f88d8477d9e58f68958e83c92664389.zip
chromium_src-3f55e8712f88d8477d9e58f68958e83c92664389.tar.gz
chromium_src-3f55e8712f88d8477d9e58f68958e83c92664389.tar.bz2
Add the chromeframe tag to the user agent header at runtime instead of statically in the registry.TEST=Try disabling GCF and see if the chromeframe tag in the user agent is still set. It should not be. Also make sure you don't have an older version installed... the chromeframe tag should not be in the registry - if it is, you've got an older version still registered. This should fix the issue with going to wave.google.com after disabling chrome frame and seeing the white page of death.R=amitBUG=22760
Review URL: http://codereview.chromium.org/259025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29370 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/utils.h')
-rw-r--r--chrome_frame/utils.h62
1 files changed, 60 insertions, 2 deletions
diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h
index baece31..7b56621 100644
--- a/chrome_frame/utils.h
+++ b/chrome_frame/utils.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/logging.h"
// utils.h : Various utility functions and classes
@@ -202,7 +203,8 @@ bool IsOptInUrl(const wchar_t* url);
// A shortcut for QueryService
template <typename T>
-HRESULT DoQueryService(const CLSID& class_id, IUnknown* unk, T** service) {
+HRESULT DoQueryService(const IID& service_id, IUnknown* unk, T** service) {
+ DCHECK(service);
if (!unk)
return E_INVALIDARG;
ScopedComPtr<IServiceProvider> service_provider;
@@ -210,7 +212,7 @@ HRESULT DoQueryService(const CLSID& class_id, IUnknown* unk, T** service) {
if (!service_provider)
return hr;
- return service_provider->QueryService(class_id, service);
+ return service_provider->QueryService(service_id, service);
}
// Get url (display name) from a moniker, |bind_context| is optional
@@ -225,4 +227,60 @@ bool IsValidUrlScheme(const std::wstring& url, bool is_privileged);
// This returns the base directory in which to store user profiles.
bool GetUserProfileBaseDirectory(std::wstring* path);
+// See COM_INTERFACE_BLIND_DELEGATE below for details.
+template <class T>
+STDMETHODIMP CheckOutgoingInterface(void* obj, REFIID iid, void** ret,
+ DWORD cookie) {
+ T* instance = reinterpret_cast<T*>(obj);
+ HRESULT hr = E_NOINTERFACE;
+ IUnknown* delegate = instance ? instance->delegate() : NULL;
+ if (delegate) {
+ hr = delegate->QueryInterface(iid, ret);
+#if !defined(NDEBUG)
+ if (SUCCEEDED(hr)) {
+ wchar_t iid_string[64] = {0};
+ StringFromGUID2(iid, iid_string, arraysize(iid_string));
+ DLOG(INFO) << __FUNCTION__ << " Giving out wrapped interface: "
+ << iid_string;
+ }
+#endif
+ }
+
+ return hr;
+}
+
+// See COM_INTERFACE_ENTRY_IF_DELEGATE_SUPPORTS below for details.
+template <class T>
+STDMETHODIMP QueryInterfaceIfDelegateSupports(void* obj, REFIID iid,
+ void** ret, DWORD cookie) {
+ HRESULT hr = E_NOINTERFACE;
+ T* instance = reinterpret_cast<T*>(obj);
+ IUnknown* delegate = instance ? instance->delegate() : NULL;
+ if (delegate) {
+ ScopedComPtr<IUnknown> original;
+ hr = delegate->QueryInterface(iid,
+ reinterpret_cast<void**>(original.Receive()));
+ if (original) {
+ IUnknown* supported_interface = reinterpret_cast<IUnknown*>(
+ reinterpret_cast<DWORD_PTR>(obj) + cookie);
+ supported_interface->AddRef();
+ *ret = supported_interface;
+ hr = S_OK;
+ }
+ }
+
+ return hr;
+}
+
+// Same as COM_INTERFACE_ENTRY but relies on the class to implement a
+// delegate() method that returns a pointer to the delegated COM object.
+#define COM_INTERFACE_ENTRY_IF_DELEGATE_SUPPORTS(x) \
+ COM_INTERFACE_ENTRY_FUNC(_ATL_IIDOF(x), \
+ offsetofclass(x, _ComMapClass), \
+ QueryInterfaceIfDelegateSupports<_ComMapClass>)
+
+// Queries the delegated COM object for an interface, bypassing the wrapper.
+#define COM_INTERFACE_BLIND_DELEGATE() \
+ COM_INTERFACE_ENTRY_FUNC_BLIND(0, CheckOutgoingInterface<_ComMapClass>)
+
#endif // CHROME_FRAME_UTILS_H_