Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / tools / measure_page_load_time / ie_bho / MeasurePageLoadTimeBHO.h
blobcabb02401f53ab16f16f72b55b64a6630c636e2d
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // MeasurePageLoadTimeBHO.h : Declaration of the CMeasurePageLoadTimeBHO
7 #include "resource.h" // main symbols
9 #include <shlguid.h> // IID_IWebBrowser2, DIID_DWebBrowserEvents2, et
10 #include <exdispid.h> // DISPID_DOCUMENTCOMPLETE, etc.
12 #include <string>
14 #include "MeasurePageLoadTime.h"
17 #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
18 #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM objects and allow use of its single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
19 #endif
23 // CMeasurePageLoadTimeBHO
25 class ATL_NO_VTABLE CMeasurePageLoadTimeBHO :
26 public CComObjectRootEx<CComSingleThreadModel>,
27 public CComCoClass<CMeasurePageLoadTimeBHO, &CLSID_MeasurePageLoadTimeBHO>,
28 public IObjectWithSiteImpl<CMeasurePageLoadTimeBHO>,
29 public IDispatchImpl<IMeasurePageLoadTimeBHO, &IID_IMeasurePageLoadTimeBHO, &LIBID_MeasurePageLoadTimeLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
30 public IDispEventImpl<1, CMeasurePageLoadTimeBHO, &DIID_DWebBrowserEvents2, &LIBID_SHDocVw, 1, 1>
32 public:
33 CMeasurePageLoadTimeBHO()
37 DECLARE_REGISTRY_RESOURCEID(IDR_MEASUREPAGELOADTIMEBHO)
39 DECLARE_NOT_AGGREGATABLE(CMeasurePageLoadTimeBHO)
41 BEGIN_COM_MAP(CMeasurePageLoadTimeBHO)
42 COM_INTERFACE_ENTRY(IMeasurePageLoadTimeBHO)
43 COM_INTERFACE_ENTRY(IDispatch)
44 COM_INTERFACE_ENTRY(IObjectWithSite)
45 END_COM_MAP()
47 BEGIN_SINK_MAP(CMeasurePageLoadTimeBHO)
48 SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOCUMENTCOMPLETE, OnDocumentComplete)
49 END_SINK_MAP()
51 // DWebBrowserEvents2
52 void STDMETHODCALLTYPE OnDocumentComplete(IDispatch *pDisp, VARIANT *pvarURL);
53 STDMETHOD(SetSite)(IUnknown *pUnkSite);
55 DECLARE_PROTECT_FINAL_CONSTRUCT()
57 HRESULT FinalConstruct()
59 return S_OK;
62 void FinalRelease()
66 void ProcessPageTimeRequests(void);
67 void VisitNextURL(void);
68 void ErrorExit(void);
70 private:
71 CComPtr<IWebBrowser2> m_spWebBrowser;
72 BOOL m_fAdvised;
74 // Handle to global interface table
75 DWORD m_dwCookie;
77 // Handle to event to signal when navigation completes
78 HANDLE m_hEvent;
80 // Socket for accepting incoming connections
81 SOCKET m_sockListen;
83 // Socket for communicating with remote peers
84 SOCKET m_sockTransport;
87 OBJECT_ENTRY_AUTO(__uuidof(MeasurePageLoadTimeBHO), CMeasurePageLoadTimeBHO)