| 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_ACTIVEX_SHIM_WEB_ACTIVEX_CONTAINER_H__ | |
| 6 #define WEBKIT_ACTIVEX_SHIM_WEB_ACTIVEX_CONTAINER_H__ | |
| 7 | |
| 8 #include <atlbase.h> | |
| 9 #include <atlcom.h> | |
| 10 #include <string> | |
| 11 #include <vector> | |
| 12 #include "webkit/activex_shim/activex_util.h" | |
| 13 #include "webkit/activex_shim/ihtmldocument_impl.h" | |
| 14 #include "webkit/activex_shim/iwebbrowser_impl.h" | |
| 15 | |
| 16 namespace activex_shim { | |
| 17 | |
| 18 class ActiveXPlugin; | |
| 19 class WebActiveXSite; | |
| 20 | |
| 21 // WebActiveXContainer, as the container of the ActiveX control, | |
| 22 // implements the basic interfaces need to manage and interact with ActiveX | |
| 23 // controls. | |
| 24 // Theoretically this container can hold multiple sites/controls. However, | |
| 25 // in our case we only use 1 container per control for now. | |
| 26 // | |
| 27 // IOleContainer: | |
| 28 // Required interface. | |
| 29 // IOleInPlaceFrame | |
| 30 // Required interface. | |
| 31 // IHTMLDocument2: | |
| 32 // WMP will query this interface to get URL. | |
| 33 // IWebBrowser2: | |
| 34 // Flash will use IWebBrowser::Navigate to open a URL. | |
| 35 // IBindHost: | |
| 36 // Flash will use this interface to resolve URL. | |
| 37 class WebActiveXContainer : public IOleContainer, | |
| 38 public IOleInPlaceFrame, | |
| 39 public IHTMLDocument2Impl, | |
| 40 public IWebBrowser2Impl, | |
| 41 public IBindHost { | |
| 42 public: | |
| 43 WebActiveXContainer(); | |
| 44 virtual ~WebActiveXContainer(); | |
| 45 | |
| 46 // Initialize container with related ActiveXPlugin. | |
| 47 void Init(ActiveXPlugin* plugin); | |
| 48 // Deactivate and release contained controls. called by outer | |
| 49 // NoRefIUnknownImpl's destructor. | |
| 50 void FinalRelease(); | |
| 51 | |
| 52 // Create ActiveX control together with its site. Do not do any initialization | |
| 53 // now but we will query the interface that the control can support, | |
| 54 // to decide whether it is viewable, supports windowless etc. | |
| 55 HRESULT CreateControlWithSite(const wchar_t* clsid); | |
| 56 // Called by ActiveXPlugin when it gets browser window first time. | |
| 57 void set_container_wnd(HWND hwnd) { container_wnd_ = hwnd; } | |
| 58 HWND container_wnd() { return container_wnd_; } | |
| 59 // Returns the IUnknown of the first control. NULL if it doesn't have any. | |
| 60 IUnknown* GetFirstControl(); | |
| 61 // Returns the first site. NULL if it doesn't have any. | |
| 62 WebActiveXSite* GetFirstSite(); | |
| 63 ActiveXPlugin* plugin() { return plugin_; } | |
| 64 | |
| 65 // The containing Window should call this upon messages. Return true if we | |
| 66 // consumed the message | |
| 67 bool OnWindowMessage(UINT msg, WPARAM wparam, LPARAM lparam, | |
| 68 LRESULT* result); | |
| 69 | |
| 70 // IUnknown | |
| 71 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, | |
| 72 void** object); | |
| 73 | |
| 74 // IDispatch | |
| 75 virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT* ctinfo) { | |
| 76 TRACK_METHOD(); | |
| 77 *ctinfo = 0; | |
| 78 return S_OK; | |
| 79 } | |
| 80 virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT itinfo, LCID lcid, | |
| 81 ITypeInfo** tinfo) { | |
| 82 TRACK_METHOD(); | |
| 83 return E_NOTIMPL; | |
| 84 } | |
| 85 virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames( | |
| 86 REFIID riid, | |
| 87 LPOLESTR* names, | |
| 88 UINT cnames, | |
| 89 LCID lcid, | |
| 90 DISPID* dispids) { | |
| 91 TRACK_METHOD(); | |
| 92 return E_NOTIMPL; | |
| 93 } | |
| 94 virtual HRESULT STDMETHODCALLTYPE Invoke( | |
| 95 DISPID dispid, | |
| 96 REFIID riid, | |
| 97 LCID lcid, | |
| 98 WORD flags, | |
| 99 DISPPARAMS* params, | |
| 100 VARIANT* result, | |
| 101 EXCEPINFO* except_info, | |
| 102 UINT* arg_error) { | |
| 103 TRACK_METHOD(); | |
| 104 return E_NOTIMPL; | |
| 105 } | |
| 106 | |
| 107 // IParseDisplayName | |
| 108 virtual HRESULT STDMETHODCALLTYPE ParseDisplayName( | |
| 109 IBindCtx* bc, | |
| 110 LPOLESTR display_name, | |
| 111 ULONG* cheaten, | |
| 112 IMoniker** moniker); | |
| 113 | |
| 114 // IOleContainer | |
| 115 virtual HRESULT STDMETHODCALLTYPE EnumObjects(DWORD flags, | |
| 116 IEnumUnknown** ppenum); | |
| 117 virtual HRESULT STDMETHODCALLTYPE LockContainer(BOOL lock); | |
| 118 | |
| 119 // IOleWindow | |
| 120 virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND* wnd); | |
| 121 virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL enter_mode); | |
| 122 | |
| 123 // IOleInPlaceUIWindow | |
| 124 virtual HRESULT STDMETHODCALLTYPE GetBorder(LPRECT border); | |
| 125 virtual HRESULT STDMETHODCALLTYPE RequestBorderSpace( | |
| 126 LPCBORDERWIDTHS border_widths); | |
| 127 virtual HRESULT STDMETHODCALLTYPE SetBorderSpace( | |
| 128 LPCBORDERWIDTHS border_widths); | |
| 129 virtual HRESULT STDMETHODCALLTYPE SetActiveObject( | |
| 130 IOleInPlaceActiveObject* active_object, | |
| 131 LPCOLESTR obj_name); | |
| 132 | |
| 133 // IOleInPlaceFrame | |
| 134 virtual HRESULT STDMETHODCALLTYPE InsertMenus( | |
| 135 HMENU hmenu_shared, | |
| 136 LPOLEMENUGROUPWIDTHS menu_widths); | |
| 137 virtual HRESULT STDMETHODCALLTYPE SetMenu( | |
| 138 HMENU hmenu_shared, | |
| 139 HOLEMENU hole_menu, | |
| 140 HWND active_object); | |
| 141 virtual HRESULT STDMETHODCALLTYPE RemoveMenus(HMENU hmenu_shared); | |
| 142 virtual HRESULT STDMETHODCALLTYPE SetStatusText(LPCOLESTR status_text); | |
| 143 virtual HRESULT STDMETHODCALLTYPE EnableModeless(BOOL enable); | |
| 144 virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator( | |
| 145 LPMSG msg, | |
| 146 WORD id); | |
| 147 | |
| 148 // IHTMLDocument2 | |
| 149 virtual HRESULT STDMETHODCALLTYPE get_URL(BSTR* p); | |
| 150 virtual HRESULT STDMETHODCALLTYPE get_cookie(BSTR* p); | |
| 151 | |
| 152 // IWebBrowser | |
| 153 virtual HRESULT STDMETHODCALLTYPE Navigate(BSTR url, | |
| 154 VARIANT* flags, | |
| 155 VARIANT* target_frame_name, | |
| 156 VARIANT* post_data, | |
| 157 VARIANT* headers); | |
| 158 | |
| 159 // IWebBrowserApp | |
| 160 virtual HRESULT STDMETHODCALLTYPE get_LocationURL(BSTR* location_url); | |
| 161 | |
| 162 // IBindHost | |
| 163 virtual HRESULT STDMETHODCALLTYPE CreateMoniker( | |
| 164 LPOLESTR szName, | |
| 165 IBindCtx* bc, | |
| 166 IMoniker** mk, | |
| 167 DWORD reserved); | |
| 168 virtual HRESULT STDMETHODCALLTYPE MonikerBindToStorage( | |
| 169 IMoniker* mk, | |
| 170 IBindCtx* bc, | |
| 171 IBindStatusCallback* bsc, | |
| 172 REFIID riid, | |
| 173 void** obj); | |
| 174 virtual HRESULT STDMETHODCALLTYPE MonikerBindToObject( | |
| 175 IMoniker* mk, | |
| 176 IBindCtx* bc, | |
| 177 IBindStatusCallback* bsc, | |
| 178 REFIID riid, | |
| 179 void** obj); | |
| 180 | |
| 181 private: | |
| 182 ActiveXPlugin* plugin_; | |
| 183 HWND container_wnd_; | |
| 184 std::vector<WebActiveXSite*> sites_; | |
| 185 | |
| 186 DISALLOW_EVIL_CONSTRUCTORS(WebActiveXContainer); | |
| 187 }; | |
| 188 | |
| 189 } // namespace activex_shim | |
| 190 | |
| 191 #endif // #ifndef WEBKIT_ACTIVEX_SHIM_WEB_ACTIVEX_CONTAINER_H__ | |
| OLD | NEW |