OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef WEBKIT_DEFAULT_PLUGIN_ACTIVEX_INSTALLER_H__ | |
6 #define WEBKIT_DEFAULT_PLUGIN_ACTIVEX_INSTALLER_H__ | |
7 | |
8 #include <atlbase.h> | |
9 #include <atlcom.h> | |
10 #include <windows.h> | |
11 #include <string> | |
12 | |
13 #include "base/scoped_comptr_win.h" | |
14 | |
15 // ActiveXInstaller is to help install an ActiveX control from a URL, usually | |
16 // given by codebase. | |
17 class ActiveXInstaller : public CComObjectRootEx<CComMultiThreadModel>, | |
18 public IBindStatusCallback, | |
19 public IWindowForBindingUI { | |
20 public: | |
21 ActiveXInstaller(); | |
22 | |
23 // Start download and installation for an ActiveX control. After download | |
24 // installation, the installer will send notification_msg to wnd, where | |
25 // WPARAM of the message denotes the HRESULT. | |
26 HRESULT StartDownload(const std::string& clsid, const std::string& codebase, | |
27 HWND wnd, UINT notification_msg); | |
28 // Revoke binding and release it if it's created. | |
29 void Cleanup(); | |
30 | |
31 // IBindStatusCallback | |
32 virtual HRESULT STDMETHODCALLTYPE OnStartBinding(DWORD dw_reserved, | |
33 IBinding* pib); | |
34 virtual HRESULT STDMETHODCALLTYPE GetPriority(LONG* pn_priority); | |
35 virtual HRESULT STDMETHODCALLTYPE OnLowResource(DWORD reserved); | |
36 virtual HRESULT STDMETHODCALLTYPE OnProgress(ULONG ul_progress, | |
37 ULONG ul_progress_max, | |
38 ULONG ul_status_code, | |
39 LPCWSTR sz_status_text); | |
40 virtual HRESULT STDMETHODCALLTYPE OnStopBinding(HRESULT hresult, | |
41 LPCWSTR sz_error); | |
42 virtual HRESULT STDMETHODCALLTYPE GetBindInfo(DWORD* grf_bindf, | |
43 BINDINFO* pbindinfo); | |
44 virtual HRESULT STDMETHODCALLTYPE OnDataAvailable(DWORD grf_bscf, | |
45 DWORD dw_size, | |
46 FORMATETC* pformatetc, | |
47 STGMEDIUM* pstgmed); | |
48 virtual HRESULT STDMETHODCALLTYPE OnObjectAvailable(REFIID riid, | |
49 IUnknown* punk); | |
50 | |
51 // IWindowForBindingUI | |
52 virtual HRESULT STDMETHODCALLTYPE GetWindow(REFGUID rguid_reason, | |
53 HWND* phwnd); | |
54 | |
55 BEGIN_COM_MAP(ActiveXInstaller) | |
56 COM_INTERFACE_ENTRY(IBindStatusCallback) | |
57 COM_INTERFACE_ENTRY(IWindowForBindingUI) | |
58 END_COM_MAP() | |
59 | |
60 private: | |
61 HWND wnd_; | |
62 UINT notification_msg_; | |
63 ScopedComPtr<IBindCtx> bind_ctx_; | |
64 }; | |
65 | |
66 #endif // #ifndef WEBKIT_DEFAULT_PLUGIN_ACTIVEX_INSTALLER_H__ | |
OLD | NEW |