Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: chrome/test/activex_test_control/chrome_test_control.h

Issue 200031: Take out the activex control. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 CHROME_TEST_ACTIVEX_TEST_CONTROL_CHROME_TEST_CONTROL_H__
6 #define CHROME_TEST_ACTIVEX_TEST_CONTROL_CHROME_TEST_CONTROL_H__
7
8 #include <atlbase.h>
9 #include <atlcom.h>
10 #include <atlctl.h>
11 #include <comutil.h>
12 #include "activex_test_control.h"
13 #include "chrome/test/activex_test_control/chrome_test_control_cp.h"
14 #include "chrome/test/activex_test_control/resource.h"
15
16 // ChromeTestControl
17 class ATL_NO_VTABLE ChromeTestControl
18 : public CComObjectRootEx<CComSingleThreadModel>,
19 public CStockPropImpl<ChromeTestControl, IChromeTestControl>,
20 public IPersistStreamInitImpl<ChromeTestControl>,
21 public IOleControlImpl<ChromeTestControl>,
22 public IOleObjectImpl<ChromeTestControl>,
23 public IOleInPlaceActiveObjectImpl<ChromeTestControl>,
24 public IViewObjectExImpl<ChromeTestControl>,
25 public IOleInPlaceObjectWindowlessImpl<ChromeTestControl>,
26 public ISupportErrorInfo,
27 public IConnectionPointContainerImpl<ChromeTestControl>,
28 public CProxy_IChromeTestControlEvents<ChromeTestControl>,
29 public IObjectWithSiteImpl<ChromeTestControl>,
30 public IServiceProviderImpl<ChromeTestControl>,
31 public IPersistStorageImpl<ChromeTestControl>,
32 public ISpecifyPropertyPagesImpl<ChromeTestControl>,
33 public IQuickActivateImpl<ChromeTestControl>,
34 public IDataObjectImpl<ChromeTestControl>,
35 public IProvideClassInfo2Impl<&CLSID_ChromeTestControl,
36 &__uuidof(_IChromeTestControlEvents), &LIBID_activex_test_controlLib>,
37 public IPropertyNotifySinkCP<ChromeTestControl>,
38 public IObjectSafetyImpl<ChromeTestControl,
39 INTERFACESAFE_FOR_UNTRUSTED_CALLER |
40 INTERFACESAFE_FOR_UNTRUSTED_DATA>,
41 public CComCoClass<ChromeTestControl, &CLSID_ChromeTestControl>,
42 public CComControl<ChromeTestControl> {
43 public:
44 ChromeTestControl() {
45 }
46
47 DECLARE_OLEMISC_STATUS(OLEMISC_RECOMPOSEONRESIZE |
48 OLEMISC_CANTLINKINSIDE |
49 OLEMISC_INSIDEOUT |
50 OLEMISC_ACTIVATEWHENVISIBLE |
51 OLEMISC_SETCLIENTSITEFIRST)
52
53 DECLARE_REGISTRY_RESOURCEID(IDR_CHROMETESTCONTROL)
54
55 BEGIN_COM_MAP(ChromeTestControl)
56 COM_INTERFACE_ENTRY(IChromeTestControl)
57 COM_INTERFACE_ENTRY(IDispatch)
58 COM_INTERFACE_ENTRY(IViewObjectEx)
59 COM_INTERFACE_ENTRY(IViewObject2)
60 COM_INTERFACE_ENTRY(IViewObject)
61 COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
62 COM_INTERFACE_ENTRY(IOleInPlaceObject)
63 COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
64 COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
65 COM_INTERFACE_ENTRY(IOleControl)
66 COM_INTERFACE_ENTRY(IOleObject)
67 COM_INTERFACE_ENTRY(IPersistStreamInit)
68 COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
69 COM_INTERFACE_ENTRY(ISupportErrorInfo)
70 COM_INTERFACE_ENTRY(IConnectionPointContainer)
71 COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
72 COM_INTERFACE_ENTRY(IQuickActivate)
73 COM_INTERFACE_ENTRY(IPersistStorage)
74 COM_INTERFACE_ENTRY(IDataObject)
75 COM_INTERFACE_ENTRY(IProvideClassInfo)
76 COM_INTERFACE_ENTRY(IProvideClassInfo2)
77 COM_INTERFACE_ENTRY(IObjectWithSite)
78 COM_INTERFACE_ENTRY(IServiceProvider)
79 COM_INTERFACE_ENTRY_IID(IID_IObjectSafety, IObjectSafety)
80 END_COM_MAP()
81
82 BEGIN_PROP_MAP(ChromeTestControl)
83 PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
84 PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
85 PROP_ENTRY_TYPE("BackColor", DISPID_BACKCOLOR, CLSID_StockColorPage,
86 VT_COLOR)
87 PROP_ENTRY_TYPE("BorderColor", DISPID_BORDERCOLOR, CLSID_StockColorPage,
88 VT_COLOR)
89 PROP_ENTRY_TYPE("Caption", DISPID_CAPTION, CLSID_NULL, VT_BSTR)
90 PROP_ENTRY_TYPE("ForeColor", DISPID_FORECOLOR, CLSID_StockColorPage, VT_COLOR)
91 // Example entries
92 // PROP_ENTRY("Property Description", dispid, clsid)
93 // PROP_PAGE(CLSID_StockColorPage)
94 END_PROP_MAP()
95
96 BEGIN_CONNECTION_POINT_MAP(ChromeTestControl)
97 CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
98 CONNECTION_POINT_ENTRY(__uuidof(_IChromeTestControlEvents))
99 END_CONNECTION_POINT_MAP()
100
101 BEGIN_MSG_MAP(ChromeTestControl)
102 CHAIN_MSG_MAP(CComControl<ChromeTestControl>)
103 DEFAULT_REFLECTION_HANDLER()
104 END_MSG_MAP()
105
106 // ISupportsErrorInfo
107 STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) {
108 static const IID* arr[] = {
109 &IID_IChromeTestControl,
110 };
111
112 for (int i=0; i<sizeof(arr)/sizeof(arr[0]); i++) {
113 if (InlineIsEqualGUID(*arr[i], riid))
114 return S_OK;
115 }
116 return S_FALSE;
117 }
118
119 // IViewObjectEx
120 DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
121
122 // IChromeTestControl
123 public:
124 HRESULT OnDraw(ATL_DRAWINFO& di);
125
126 void OnBackColorChanged() {
127 ATLTRACE(_T("OnBackColorChanged\n"));
128 }
129 void OnBorderColorChanged() {
130 ATLTRACE(_T("OnBorderColorChanged\n"));
131 }
132 void OnCaptionChanged() {
133 ATLTRACE(_T("OnCaptionChanged\n"));
134 }
135 void OnForeColorChanged() {
136 ATLTRACE(_T("OnForeColorChanged\n"));
137 }
138 STDMETHOD(_InternalQueryService)(REFGUID guidService, REFIID riid,
139 void** ppvObject) {
140 return E_NOTIMPL;
141 }
142
143 DECLARE_PROTECT_FINAL_CONSTRUCT()
144
145 HRESULT FinalConstruct() {
146 return S_OK;
147 }
148
149 void FinalRelease() {
150 }
151
152 STDMETHOD(get_StringProp)(BSTR* val) {
153 *val = string_prop_.copy();
154 return S_OK;
155 }
156
157 STDMETHOD(put_StringProp)(BSTR val) {
158 string_prop_ = val;
159 return S_OK;
160 }
161 STDMETHOD(get_LongProp)(LONG* val) {
162 *val = long_prop_;
163 return S_OK;
164 }
165
166 STDMETHOD(put_LongProp)(LONG val) {
167 long_prop_ = val;
168 return S_OK;
169 }
170 STDMETHOD(get_DoubleProp)(DOUBLE* val) {
171 *val = double_prop_;
172 return S_OK;
173 }
174
175 STDMETHOD(put_DoubleProp)(DOUBLE val) {
176 double_prop_ = val;
177 return S_OK;
178 }
179
180 STDMETHOD(get_BoolProp)(VARIANT_BOOL* val) {
181 *val = bool_prop_;
182 return S_OK;
183 }
184
185 STDMETHOD(put_BoolProp)(VARIANT_BOOL val) {
186 bool_prop_ = val;
187 return S_OK;
188 }
189
190 STDMETHOD(get_ByteProp)(BYTE* val) {
191 *val = byte_prop_;
192 return S_OK;
193 }
194
195 STDMETHOD(put_ByteProp)(BYTE val) {
196 byte_prop_ = val;
197 return S_OK;
198 }
199
200 STDMETHOD(get_FloatProp)(FLOAT* val) {
201 *val = float_prop_;
202 return S_OK;
203 }
204
205 STDMETHOD(put_FloatProp)(FLOAT val) {
206 float_prop_ = val;
207 return S_OK;
208 }
209
210 STDMETHOD(SetByte)(BYTE val) {
211 byte_prop_ = val;
212 return S_OK;
213 }
214 STDMETHOD(SetByteRet)(BYTE val, BYTE* ret) {
215 byte_prop_ = val;
216 *ret = val;
217 return S_OK;
218 }
219 STDMETHOD(SetStringRet)(BSTR val, BSTR* ret) {
220 string_prop_ = val;
221 *ret = string_prop_.copy();
222 return S_OK;
223 }
224 STDMETHOD(BigSetMethodRet)(BSTR string_param, BYTE byte_param,
225 FLOAT float_param, VARIANT_BOOL bool_param,
226 BSTR* ret) {
227 string_prop_ = string_param;
228 byte_prop_ = byte_param;
229 float_prop_ = float_param;
230 bool_prop_ = bool_param;
231 *ret = SysAllocString(string_param);
232 return S_OK;
233 }
234 STDMETHOD(GetCookie)(BSTR* cookie) {
235 CComPtr<IOleContainer> container;
236 m_spClientSite->GetContainer(&container);
237 CComQIPtr<IHTMLDocument2> doc = container;
238 if (doc == NULL) {
239 *cookie = SysAllocString(L"Bad");
240 return S_FALSE;
241 } else {
242 return doc->get_cookie(cookie);
243 }
244 }
245
246 // These varialbes are used by CStockPropImpl invisibly and they have to be
247 // be public to be accessible.
248 OLE_COLOR m_clrBackColor;
249 OLE_COLOR m_clrBorderColor;
250 CComBSTR m_bstrCaption;
251 OLE_COLOR m_clrForeColor;
252 private:
253 _bstr_t string_prop_;
254 LONG long_prop_;
255 DOUBLE double_prop_;
256 VARIANT_BOOL bool_prop_;
257 BYTE byte_prop_;
258 FLOAT float_prop_;
259 };
260
261 OBJECT_ENTRY_AUTO(__uuidof(ChromeTestControl), ChromeTestControl)
262
263 #endif // #ifndef CHROME_TEST_ACTIVEX_TEST_CONTROL_CHROME_TEST_CONTROL_H__
OLDNEW
« no previous file with comments | « chrome/test/activex_test_control/activex_test_control.rgs ('k') | chrome/test/activex_test_control/chrome_test_control.bmp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698