OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CHROME_FRAME_ACTIVEX_BASE_H_ | 5 #ifndef CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ |
6 #define CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ | 6 #define CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlcom.h> | 9 #include <atlcom.h> |
10 #include <atlctl.h> | 10 #include <atlctl.h> |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // that's what DISPPARAMS requires. | 110 // that's what DISPPARAMS requires. |
111 VARIANT args[2] = { { VT_BSTR, }, {VT_DISPATCH, } }; | 111 VARIANT args[2] = { { VT_BSTR, }, {VT_DISPATCH, } }; |
112 args[0].bstrVal = target; | 112 args[0].bstrVal = target; |
113 args[1].pdispVal = event; | 113 args[1].pdispVal = event; |
114 | 114 |
115 FireMethodWithParams(CF_EVENT_DISPID_ONPRIVATEMESSAGE, | 115 FireMethodWithParams(CF_EVENT_DISPID_ONPRIVATEMESSAGE, |
116 args, | 116 args, |
117 arraysize(args)); | 117 arraysize(args)); |
118 } | 118 } |
119 | 119 |
120 void Fire_onextensionready(BSTR path, long response) { // NOLINT | |
121 // Arguments in reverse order to the function declaration, because | |
122 // that's what DISPPARAMS requires. | |
123 VARIANT args[2] = { { VT_I4, }, { VT_BSTR, } }; | |
124 args[0].lVal = response; | |
125 args[1].bstrVal = path; | |
126 | |
127 FireMethodWithParams(CF_EVENT_DISPID_ONEXTENSIONREADY, | |
128 args, | |
129 arraysize(args)); | |
130 } | |
131 | |
132 void Fire_ongetenabledextensionscomplete(SAFEARRAY* extension_dirs) { | |
133 VARIANT args[1] = { { VT_ARRAY | VT_BSTR } }; | |
134 args[0].parray = extension_dirs; | |
135 | |
136 FireMethodWithParams(CF_EVENT_DISPID_ONGETENABLEDEXTENSIONSCOMPLETE, | |
137 args, arraysize(args)); | |
138 } | |
139 | |
140 void Fire_onchannelerror() { // NOLINT | 120 void Fire_onchannelerror() { // NOLINT |
141 FireMethodWithParams(CF_EVENT_DISPID_ONCHANNELERROR, NULL, 0); | 121 FireMethodWithParams(CF_EVENT_DISPID_ONCHANNELERROR, NULL, 0); |
142 } | 122 } |
143 | 123 |
144 void Fire_onclose() { // NOLINT | 124 void Fire_onclose() { // NOLINT |
145 FireMethodWithParams(CF_EVENT_DISPID_ONCLOSE, NULL, 0); | 125 FireMethodWithParams(CF_EVENT_DISPID_ONCLOSE, NULL, 0); |
146 } | 126 } |
147 }; | 127 }; |
148 | 128 |
149 extern bool g_first_launch_by_process_; | 129 extern bool g_first_launch_by_process_; |
(...skipping 17 matching lines...) Expand all Loading... |
167 public IOleControlImpl<T>, | 147 public IOleControlImpl<T>, |
168 public IOleObjectImpl<T>, | 148 public IOleObjectImpl<T>, |
169 public IOleInPlaceActiveObjectImpl<T>, | 149 public IOleInPlaceActiveObjectImpl<T>, |
170 public IViewObjectExImpl<T>, | 150 public IViewObjectExImpl<T>, |
171 public IOleInPlaceObjectWindowlessImpl<T>, | 151 public IOleInPlaceObjectWindowlessImpl<T>, |
172 public ISupportErrorInfo, | 152 public ISupportErrorInfo, |
173 public IQuickActivateImpl<T>, | 153 public IQuickActivateImpl<T>, |
174 public com_util::IProvideClassInfo2Impl<class_id, | 154 public com_util::IProvideClassInfo2Impl<class_id, |
175 DIID_DIChromeFrameEvents>, | 155 DIID_DIChromeFrameEvents>, |
176 public com_util::IDispatchImpl<IChromeFrame>, | 156 public com_util::IDispatchImpl<IChromeFrame>, |
177 public IChromeFrameInternal, | |
178 public IConnectionPointContainerImpl<T>, | 157 public IConnectionPointContainerImpl<T>, |
179 public ProxyDIChromeFrameEvents<T>, | 158 public ProxyDIChromeFrameEvents<T>, |
180 public IPropertyNotifySinkCP<T>, | 159 public IPropertyNotifySinkCP<T>, |
181 public CComCoClass<T, &class_id>, | 160 public CComCoClass<T, &class_id>, |
182 public CComControl<T>, | 161 public CComControl<T>, |
183 public ChromeFramePlugin<T> { | 162 public ChromeFramePlugin<T> { |
184 protected: | 163 protected: |
185 typedef std::set<base::win::ScopedComPtr<IDispatch> > EventHandlers; | 164 typedef std::set<base::win::ScopedComPtr<IDispatch> > EventHandlers; |
186 typedef ChromeFrameActivexBase<T, class_id> BasePlugin; | 165 typedef ChromeFrameActivexBase<T, class_id> BasePlugin; |
187 | 166 |
(...skipping 13 matching lines...) Expand all Loading... |
201 | 180 |
202 DECLARE_OLEMISC_STATUS(OLEMISC_RECOMPOSEONRESIZE | OLEMISC_CANTLINKINSIDE | | 181 DECLARE_OLEMISC_STATUS(OLEMISC_RECOMPOSEONRESIZE | OLEMISC_CANTLINKINSIDE | |
203 OLEMISC_INSIDEOUT | OLEMISC_ACTIVATEWHENVISIBLE | | 182 OLEMISC_INSIDEOUT | OLEMISC_ACTIVATEWHENVISIBLE | |
204 OLEMISC_SETCLIENTSITEFIRST) | 183 OLEMISC_SETCLIENTSITEFIRST) |
205 | 184 |
206 DECLARE_NOT_AGGREGATABLE(T) | 185 DECLARE_NOT_AGGREGATABLE(T) |
207 | 186 |
208 BEGIN_COM_MAP(ChromeFrameActivexBase) | 187 BEGIN_COM_MAP(ChromeFrameActivexBase) |
209 COM_INTERFACE_ENTRY(IChromeFrame) | 188 COM_INTERFACE_ENTRY(IChromeFrame) |
210 COM_INTERFACE_ENTRY(IDispatch) | 189 COM_INTERFACE_ENTRY(IDispatch) |
211 COM_INTERFACE_ENTRY(IChromeFrameInternal) | |
212 COM_INTERFACE_ENTRY(IViewObjectEx) | 190 COM_INTERFACE_ENTRY(IViewObjectEx) |
213 COM_INTERFACE_ENTRY(IViewObject2) | 191 COM_INTERFACE_ENTRY(IViewObject2) |
214 COM_INTERFACE_ENTRY(IViewObject) | 192 COM_INTERFACE_ENTRY(IViewObject) |
215 COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) | 193 COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) |
216 COM_INTERFACE_ENTRY(IOleInPlaceObject) | 194 COM_INTERFACE_ENTRY(IOleInPlaceObject) |
217 COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless) | 195 COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless) |
218 COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) | 196 COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) |
219 COM_INTERFACE_ENTRY(IOleControl) | 197 COM_INTERFACE_ENTRY(IOleControl) |
220 COM_INTERFACE_ENTRY(IOleObject) | 198 COM_INTERFACE_ENTRY(IOleObject) |
221 COM_INTERFACE_ENTRY(ISupportErrorInfo) | 199 COM_INTERFACE_ENTRY(ISupportErrorInfo) |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 utf8_origin, | 797 utf8_origin, |
820 utf8_target)) { | 798 utf8_target)) { |
821 Error(L"Failed to post message to chrome frame"); | 799 Error(L"Failed to post message to chrome frame"); |
822 return E_FAIL; | 800 return E_FAIL; |
823 } | 801 } |
824 | 802 |
825 return S_OK; | 803 return S_OK; |
826 } | 804 } |
827 | 805 |
828 STDMETHOD(installExtension)(BSTR crx_path) { | 806 STDMETHOD(installExtension)(BSTR crx_path) { |
829 DCHECK(automation_client_.get()); | 807 NOTREACHED(); // Deprecated. |
830 | 808 return E_NOTIMPL; |
831 if (NULL == crx_path) { | |
832 NOTREACHED(); | |
833 return E_INVALIDARG; | |
834 } | |
835 | |
836 if (!is_privileged()) { | |
837 DLOG(ERROR) << "Attempt to installExtension in non-privileged mode"; | |
838 return E_ACCESSDENIED; | |
839 } | |
840 | |
841 FilePath::StringType crx_path_str(crx_path); | |
842 FilePath crx_file_path(crx_path_str); | |
843 | |
844 automation_client_->InstallExtension(crx_file_path, NULL); | |
845 return S_OK; | |
846 } | 809 } |
847 | 810 |
848 STDMETHOD(loadExtension)(BSTR path) { | 811 STDMETHOD(loadExtension)(BSTR path) { |
849 DCHECK(automation_client_.get()); | 812 NOTREACHED(); // Deprecated. |
850 | 813 return E_NOTIMPL; |
851 if (NULL == path) { | |
852 NOTREACHED(); | |
853 return E_INVALIDARG; | |
854 } | |
855 | |
856 if (!is_privileged()) { | |
857 DLOG(ERROR) << "Attempt to loadExtension in non-privileged mode"; | |
858 return E_ACCESSDENIED; | |
859 } | |
860 | |
861 FilePath::StringType path_str(path); | |
862 FilePath file_path(path_str); | |
863 | |
864 automation_client_->LoadExpandedExtension(file_path, NULL); | |
865 return S_OK; | |
866 } | 814 } |
867 | 815 |
868 STDMETHOD(getEnabledExtensions)() { | 816 STDMETHOD(getEnabledExtensions)() { |
869 DCHECK(automation_client_.get()); | 817 NOTREACHED(); // Deprecated. |
870 | 818 return E_NOTIMPL; |
871 if (!is_privileged()) { | |
872 DLOG(ERROR) << "Attempt to getEnabledExtensions in non-privileged mode"; | |
873 return E_ACCESSDENIED; | |
874 } | |
875 | |
876 automation_client_->GetEnabledExtensions(NULL); | |
877 return S_OK; | |
878 } | |
879 | |
880 STDMETHOD(getSessionId)(int* session_id) { | |
881 DCHECK(automation_client_.get()); | |
882 DCHECK(session_id); | |
883 | |
884 if (!is_privileged()) { | |
885 DLOG(ERROR) << "Attempt to getSessionId in non-privileged mode"; | |
886 return E_ACCESSDENIED; | |
887 } | |
888 | |
889 *session_id = automation_client_->GetSessionId(); | |
890 return (*session_id) == -1 ? S_FALSE : S_OK; | |
891 } | 819 } |
892 | 820 |
893 STDMETHOD(registerBhoIfNeeded)() { | 821 STDMETHOD(registerBhoIfNeeded)() { |
894 return E_NOTIMPL; | 822 return E_NOTIMPL; |
895 } | 823 } |
896 | 824 |
897 // Returns the vector of event handlers for a given event (e.g. "load"). | 825 // Returns the vector of event handlers for a given event (e.g. "load"). |
898 // If the event type isn't recognized, the function fills in a descriptive | 826 // If the event type isn't recognized, the function fills in a descriptive |
899 // error (IErrorInfo) and returns E_INVALIDARG. | 827 // error (IErrorInfo) and returns E_INVALIDARG. |
900 HRESULT GetHandlersForEvent(BSTR event_type, EventHandlers** handlers) { | 828 HRESULT GetHandlersForEvent(BSTR event_type, EventHandlers** handlers) { |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 EventHandlers onreadystatechanged_; | 1201 EventHandlers onreadystatechanged_; |
1274 EventHandlers onprivatemessage_; | 1202 EventHandlers onprivatemessage_; |
1275 EventHandlers onextensionready_; | 1203 EventHandlers onextensionready_; |
1276 | 1204 |
1277 // Handle network requests when host network stack is used. Passed to the | 1205 // Handle network requests when host network stack is used. Passed to the |
1278 // automation client on initialization. | 1206 // automation client on initialization. |
1279 scoped_ptr<UrlmonUrlRequestManager> url_fetcher_; | 1207 scoped_ptr<UrlmonUrlRequestManager> url_fetcher_; |
1280 }; | 1208 }; |
1281 | 1209 |
1282 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ | 1210 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ |
OLD | NEW |