summaryrefslogtreecommitdiffstats
path: root/chrome_frame/test_utils.h
diff options
context:
space:
mode:
authoramit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 00:53:23 +0000
committeramit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 00:53:23 +0000
commita1800e8c451736dea5663ae461454ab663d05bc4 (patch)
tree87ff9157562b9616139bb6154a06902e5ede5287 /chrome_frame/test_utils.h
parent4f03cbccc4c09db3f053b74393961e8728bceeec (diff)
downloadchromium_src-a1800e8c451736dea5663ae461454ab663d05bc4.zip
chromium_src-a1800e8c451736dea5663ae461454ab663d05bc4.tar.gz
chromium_src-a1800e8c451736dea5663ae461454ab663d05bc4.tar.bz2
Back/Forward support for url fragments
Added support for anchor (url fragments). this involves mainly implementing IPersistHistory. The rest of the stuff is a song and dance to get called in IPersistHistory in the first place and then behave correctly when we do. BUG=23981 TEst=unit tests added and back forward with '#' URLs, sub frames etc. Review URL: http://codereview.chromium.org/371004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32454 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test_utils.h')
-rw-r--r--chrome_frame/test_utils.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/chrome_frame/test_utils.h b/chrome_frame/test_utils.h
index 85f5cc5..260b4b5 100644
--- a/chrome_frame/test_utils.h
+++ b/chrome_frame/test_utils.h
@@ -7,6 +7,9 @@
#include <string>
+#include <atlbase.h>
+#include <atlcom.h>
+
#include "base/file_path.h"
// Helper class used to register different chrome frame DLLs while running
@@ -38,4 +41,40 @@ class ScopedChromeFrameRegistrar {
std::wstring original_dll_path_;
};
+// Callback description for onload, onloaderror, onmessage
+static _ATL_FUNC_INFO g_single_param = {CC_STDCALL, VT_EMPTY, 1, {VT_VARIANT}};
+// Simple class that forwards the callbacks.
+template <typename T>
+class DispCallback
+ : public IDispEventSimpleImpl<1, DispCallback<T>, &IID_IDispatch> {
+ public:
+ typedef HRESULT (T::*Method)(const VARIANT* param);
+
+ DispCallback(T* owner, Method method) : owner_(owner), method_(method) {
+ }
+
+ BEGIN_SINK_MAP(DispCallback)
+ SINK_ENTRY_INFO(1, IID_IDispatch, DISPID_VALUE, OnCallback, &g_single_param)
+ END_SINK_MAP()
+
+ virtual ULONG STDMETHODCALLTYPE AddRef() {
+ return owner_->AddRef();
+ }
+ virtual ULONG STDMETHODCALLTYPE Release() {
+ return owner_->Release();
+ }
+
+ STDMETHOD(OnCallback)(VARIANT param) {
+ return (owner_->*method_)(&param);
+ }
+
+ IDispatch* ToDispatch() {
+ return reinterpret_cast<IDispatch*>(this);
+ }
+
+ T* owner_;
+ Method method_;
+};
+
+
#endif // CHROME_FRAME_TEST_UTILS_H_