| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_FRAME_TEST_IE_EVENT_SINK_H_ | 5 #ifndef CHROME_FRAME_TEST_IE_EVENT_SINK_H_ |
| 6 #define CHROME_FRAME_TEST_IE_EVENT_SINK_H_ | 6 #define CHROME_FRAME_TEST_IE_EVENT_SINK_H_ |
| 7 | 7 |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include <atlwin.h> | 9 #include <atlwin.h> |
| 10 #include <exdispid.h> | 10 #include <exdispid.h> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 virtual void OnQuit() {} | 50 virtual void OnQuit() {} |
| 51 | 51 |
| 52 // CF callbacks | 52 // CF callbacks |
| 53 virtual void OnLoad(const wchar_t* url) {} | 53 virtual void OnLoad(const wchar_t* url) {} |
| 54 virtual void OnLoadError(const wchar_t* url) {} | 54 virtual void OnLoadError(const wchar_t* url) {} |
| 55 virtual void OnMessage(const wchar_t* message, const wchar_t* origin, | 55 virtual void OnMessage(const wchar_t* message, const wchar_t* origin, |
| 56 const wchar_t* source) {} | 56 const wchar_t* source) {} |
| 57 virtual void OnNewBrowserWindow(IDispatch* new_window, const wchar_t* url) {} | 57 virtual void OnNewBrowserWindow(IDispatch* new_window, const wchar_t* url) {} |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 // Listener for IPropertyNotifySink. |
| 61 class PropertyNotifySinkListener { |
| 62 public: |
| 63 virtual ~PropertyNotifySinkListener() {} |
| 64 virtual void OnChanged(DISPID dispid) {} |
| 65 virtual void OnRequestEdit(DISPID dispid) {} |
| 66 }; |
| 67 |
| 60 // This class sets up event sinks to the IWebBrowser interface. It forwards | 68 // This class sets up event sinks to the IWebBrowser interface. It forwards |
| 61 // all events to its listener. | 69 // all events to its listener. |
| 62 // TODO(kkania): Delete WebBrowserEventSink and use this class instead for | 70 // TODO(kkania): Delete WebBrowserEventSink and use this class instead for |
| 63 // the reliability tests. | 71 // the reliability tests. |
| 64 class IEEventSink | 72 class IEEventSink |
| 65 : public CComObjectRootEx<CComSingleThreadModel>, | 73 : public CComObjectRootEx<CComSingleThreadModel>, |
| 66 public IDispEventSimpleImpl<0, IEEventSink, | 74 public IDispEventSimpleImpl<0, IEEventSink, |
| 67 &DIID_DWebBrowserEvents2>, | 75 &DIID_DWebBrowserEvents2>, |
| 68 public IUnknown { | 76 public IUnknown { |
| 69 public: | 77 public: |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 static _ATL_FUNC_INFO kBeforeNavigate2Info; | 230 static _ATL_FUNC_INFO kBeforeNavigate2Info; |
| 223 static _ATL_FUNC_INFO kNavigateComplete2Info; | 231 static _ATL_FUNC_INFO kNavigateComplete2Info; |
| 224 static _ATL_FUNC_INFO kNavigateErrorInfo; | 232 static _ATL_FUNC_INFO kNavigateErrorInfo; |
| 225 static _ATL_FUNC_INFO kNewWindow2Info; | 233 static _ATL_FUNC_INFO kNewWindow2Info; |
| 226 static _ATL_FUNC_INFO kNewWindow3Info; | 234 static _ATL_FUNC_INFO kNewWindow3Info; |
| 227 static _ATL_FUNC_INFO kVoidMethodInfo; | 235 static _ATL_FUNC_INFO kVoidMethodInfo; |
| 228 static _ATL_FUNC_INFO kDocumentCompleteInfo; | 236 static _ATL_FUNC_INFO kDocumentCompleteInfo; |
| 229 static _ATL_FUNC_INFO kFileDownloadInfo; | 237 static _ATL_FUNC_INFO kFileDownloadInfo; |
| 230 }; | 238 }; |
| 231 | 239 |
| 240 class PropertyNotifySinkImpl |
| 241 : public CComObjectRootEx<CComSingleThreadModel>, |
| 242 public IPropertyNotifySink { |
| 243 public: |
| 244 PropertyNotifySinkImpl() : listener_(NULL) { |
| 245 } |
| 246 |
| 247 BEGIN_COM_MAP(PropertyNotifySinkImpl) |
| 248 COM_INTERFACE_ENTRY(IPropertyNotifySink) |
| 249 END_COM_MAP() |
| 250 |
| 251 STDMETHOD(OnChanged)(DISPID dispid) { |
| 252 if (listener_) |
| 253 listener_->OnChanged(dispid); |
| 254 return S_OK; |
| 255 } |
| 256 |
| 257 STDMETHOD(OnRequestEdit)(DISPID dispid) { |
| 258 if (listener_) |
| 259 listener_->OnRequestEdit(dispid); |
| 260 return S_OK; |
| 261 } |
| 262 |
| 263 void set_listener(PropertyNotifySinkListener* listener) { |
| 264 DCHECK(listener_ == NULL || listener == NULL); |
| 265 listener_ = listener; |
| 266 } |
| 267 |
| 268 protected: |
| 269 PropertyNotifySinkListener* listener_; |
| 270 }; |
| 271 |
| 232 } // namespace chrome_frame_test | 272 } // namespace chrome_frame_test |
| 233 | 273 |
| 234 #endif // CHROME_FRAME_TEST_IE_EVENT_SINK_H_ | 274 #endif // CHROME_FRAME_TEST_IE_EVENT_SINK_H_ |
| 235 | 275 |
| OLD | NEW |