Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/Wrapper.h

Issue 5750789393874944: [IE] First round of ATL removal (Closed)
Patch Set: Created June 20, 2014, 9:22 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /**
2 * \file Wrapper.h Wrappers for Windows platform calls and the like.
3 *
4 * The main purpose of this file is to isolate Windows-specific data types, repl acing them with ones from the standard library.
5 */
6
7 #ifndef WRAPPER_H
sergei 2014/07/08 11:58:34 `WRAPPER_H` is too generic and it's very easy to g
Eric 2014/07/08 17:46:37 This is the convention we've been using in all rec
8 #define WRAPPER_H
9
10 /*
11 * We need ATL for the time being to write the Browser class, which wraps CComQI Ptr.
12 */
13 #include "ATL_Deprecate.h"
14
15 #include <string>
16
17 #include <Exdisp.h>
18
19 namespace Wrapper
20 {
21 /**
22 * Wrapper for UrlUnescape
23 *
24 * Modifies the string value in place.
25 */
26 std::wstring & Unescape_URL( std::wstring & url ) ;
27
28 /**
29 * Wrapper around a pointer to an IWebBrowser2 interface.
30 */
31 class Browser
Oleksandr 2014/06/26 00:48:43 I suppose the general idea is to make these classe
Eric 2014/06/26 15:13:56 Yes, basically.
32 {
33 /**
34 * The underlying browser
35 */
36 CComQIPtr<IWebBrowser2> _browser;
37
38 public:
39 /**
40 * Ordinary constructor.
41 */
42 Browser( CComQIPtr<IWebBrowser2> browser )
43 : _browser( browser )
44 {}
45
46 /**
47 * Navigate to a url in a new tab, or failing that, in a new window.
48 *
49 * return true iff navigation was successful
50 */
51 HRESULT navigate( std::wstring url );
52
53 /**
54 * Retrieve the "LocationURL" property
55 */
56 bool Location_URL( std::wstring & value ) const;
sergei 2014/07/08 11:58:34 It should be without the underscore.
57 };
58
59 /**
60 *
61 */
62 class Internet_Bind_Info
sergei 2014/07/08 11:58:34 In the other parts of the project the naming conve
63 {
64 IInternetBindInfo * _bind_info;
65 public:
66 Internet_Bind_Info( IInternetBindInfo * bind_info )
67 : _bind_info( bind_info )
68 {}
69
70 std::wstring bind_string_single( BINDSTRING type );
71 };
72
73 /**
74 *
75 */
76 class HTML_Element
sergei 2014/07/08 11:58:34 But here for me `HTML_Element` looks better than `
77 {
78 IHTMLElement * _element;
79 public:
80 HTML_Element( IHTMLElement * element )
81 : _element( element )
82 {}
83
84 /**
85 * Retrieve an attribute value, if present.
86 *
87 * \param attr_value
88 * Returns attribute value, if attribute is present; otherwise unaltered.
89 * \return
90 * true if attribute is present
91 * false otherwise
92 */
93 bool attribute( std::wstring attr_name, std::wstring & attr_value ) const;
94
95 /**
96 * Retrieve an integer attribute value, if the attribute is present and its value is an integer.
97 *
98 * \param attr_value
99 * Returns attribute value, if attribute is present and is an integer; oth erwise unaltered.
100 * \return
101 * true if attribute is present and is an integer
102 * false otherwise
103 */
104 bool attribute( std::wstring attr_name, int & attr_value ) const;
105
106 /**
107 * Retrieve the id property.
108 */
109 bool id( std::wstring & value ) const;
110
111 /**
112 * Retrieve the class name property.
113 */
114 bool class_name( std::wstring & value ) const;
115
116 /**
117 * Retrieve the innerHTML property.
118 *
119 * This function is considered always to succeed, setting 'value' to
120 * Thus the return value is void instead of bool.
121 *
122 */
123 bool inner_HTML( std::wstring & value ) const;
124
125 /**
126 * Retrieve the tag property
127 */
128 bool tag_name( std::wstring & value ) const;
129 };
130
131 /**
132 *
133 */
134 class HTML_Style
135 {
136 IHTMLStyle * _style;
137 public:
138 /**
139 * Ordinary constructor
140 */
141 HTML_Style( IHTMLStyle * style )
142 : _style( style )
143 {}
144
145 /**
146 * Retrieve the display property.
147 */
148 bool display( std::wstring & value ) const;
149
150 /**
151 * Assign the display property.
152 */
153 bool assign_display( const std::wstring & value );
154
155 /**
156 * Retrieve the CSS text.
157 */
158 bool CSS_text( std::wstring & value ) const;
159 };
160
161 /**
162 */
163 class HTML_Element_Collection
164 {
165 IHTMLElementCollection * _elements;
166 public:
167 HTML_Element_Collection( IHTMLElementCollection * elements )
168 : _elements( elements )
169 {}
170
171 /**
172 * Retrieve an item by index.
173 *
174 * This is a wrapper around IHTMLElementCollection::item
175 * and where the 'name' argument is an integer, returning a value by index .
176 * Note that the wrapped function item() returns S_OK even when the function is not found.
177 * Thus we indicate all error conditions with a zero return value.
178 *
179 * \return
180 * IDispatch point to the element if the element is found
181 * 0 otherwise
182 */
183 IDispatch * at( long index );
184 };
185
186 }
187
188 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld