OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 }; | 62 }; |
63 | 63 |
64 // This class sets up event sinks to the IWebBrowser interface. It forwards | 64 // This class sets up event sinks to the IWebBrowser interface. It forwards |
65 // all events to its listener. | 65 // all events to its listener. |
66 class IEEventSink | 66 class IEEventSink |
67 : public CComObjectRootEx<CComSingleThreadModel>, | 67 : public CComObjectRootEx<CComSingleThreadModel>, |
68 public IDispEventSimpleImpl<0, IEEventSink, | 68 public IDispEventSimpleImpl<0, IEEventSink, |
69 &DIID_DWebBrowserEvents2>, | 69 &DIID_DWebBrowserEvents2>, |
70 public IUnknown { | 70 public IUnknown { |
71 public: | 71 public: |
72 // Needed to support PostTask. | |
73 static bool ImplementsThreadSafeReferenceCounting() { | |
74 return true; | |
75 } | |
76 | |
77 typedef IDispEventSimpleImpl<0, IEEventSink, | 72 typedef IDispEventSimpleImpl<0, IEEventSink, |
78 &DIID_DWebBrowserEvents2> DispEventsImpl; | 73 &DIID_DWebBrowserEvents2> DispEventsImpl; |
79 IEEventSink(); | 74 IEEventSink(); |
80 ~IEEventSink(); | 75 ~IEEventSink(); |
81 | 76 |
82 // Launches IE, sets up the sink to forward events to the listener, and | 77 // Launches IE, sets up the sink to forward events to the listener, and |
83 // navigates to the given page. | 78 // navigates to the given page. |
84 HRESULT LaunchIEAndNavigate(const std::wstring& navigate_url, | 79 HRESULT LaunchIEAndNavigate(const std::wstring& navigate_url, |
85 IEEventListener* listener); | 80 IEEventListener* listener); |
86 | 81 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 listener_ = listener; | 267 listener_ = listener; |
273 } | 268 } |
274 | 269 |
275 protected: | 270 protected: |
276 PropertyNotifySinkListener* listener_; | 271 PropertyNotifySinkListener* listener_; |
277 }; | 272 }; |
278 | 273 |
279 } // namespace chrome_frame_test | 274 } // namespace chrome_frame_test |
280 | 275 |
281 #endif // CHROME_FRAME_TEST_IE_EVENT_SINK_H_ | 276 #endif // CHROME_FRAME_TEST_IE_EVENT_SINK_H_ |
OLD | NEW |