Merge lp:~osomon/oxide/linkHovered into lp:~oxide-developers/oxide/oxide.trunk
- linkHovered
- Merge into oxide.trunk
Proposed by
Olivier Tilloy
Status: | Merged |
---|---|
Merged at revision: | 1281 |
Proposed branch: | lp:~osomon/oxide/linkHovered |
Merge into: | lp:~oxide-developers/oxide/oxide.trunk |
Diff against target: |
358 lines (+120/-3) 15 files modified
qt/core/browser/oxide_qt_web_view.cc (+8/-0) qt/core/browser/oxide_qt_web_view.h (+3/-0) qt/core/glue/oxide_qt_web_view_proxy.h (+2/-0) qt/core/glue/oxide_qt_web_view_proxy_client.h (+2/-1) qt/qmlplugin/oxide.qmltypes (+5/-2) qt/qmlplugin/oxide_qml_plugin.cc (+2/-0) qt/quick/api/oxideqquickwebview.cc (+16/-0) qt/quick/api/oxideqquickwebview_p.h (+5/-0) qt/quick/api/oxideqquickwebview_p_p.h (+1/-0) qt/tests/qmltests/api/tst_WebView_hoveredUrl.html (+7/-0) qt/tests/qmltests/api/tst_WebView_hoveredUrl.qml (+51/-0) shared/browser/oxide_web_view.cc (+9/-0) shared/browser/oxide_web_view.h (+5/-0) shared/browser/oxide_web_view_client.cc (+2/-0) shared/browser/oxide_web_view_client.h (+2/-0) |
To merge this branch: | bzr merge lp:~osomon/oxide/linkHovered |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chris Coulson | Approve | ||
Review via email: mp+277562@code.launchpad.net |
Commit message
Add a hoveredUrl property to the QML WebView API.
Description of the change
Add a hoveredUrl property to the QML WebView API.
This differs from QtWebEngine’s API which exposes only a linkHovered(
To post a comment you must log in.
lp:~osomon/oxide/linkHovered
updated
- 1274. By Olivier Tilloy
-
Replace the linkHovered signal with a hoveredUrl property (with the corresponding change notifier).
- 1275. By Olivier Tilloy
-
Add a unit test for the hoveredLink property.
lp:~osomon/oxide/linkHovered
updated
- 1276. By Olivier Tilloy
-
Store the target URL in oxide::WebView.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'qt/core/browser/oxide_qt_web_view.cc' | |||
2 | --- qt/core/browser/oxide_qt_web_view.cc 2015-10-27 11:36:49 +0000 | |||
3 | +++ qt/core/browser/oxide_qt_web_view.cc 2015-11-23 18:04:16 +0000 | |||
4 | @@ -873,6 +873,10 @@ | |||
5 | 873 | client_->CloseRequested(); | 873 | client_->CloseRequested(); |
6 | 874 | } | 874 | } |
7 | 875 | 875 | ||
8 | 876 | void WebView::TargetURLChanged() { | ||
9 | 877 | client_->TargetURLChanged(); | ||
10 | 878 | } | ||
11 | 879 | |||
12 | 876 | size_t WebView::GetScriptMessageHandlerCount() const { | 880 | size_t WebView::GetScriptMessageHandlerCount() const { |
13 | 877 | return message_handlers_.size(); | 881 | return message_handlers_.size(); |
14 | 878 | } | 882 | } |
15 | @@ -1358,6 +1362,10 @@ | |||
16 | 1358 | } | 1362 | } |
17 | 1359 | } | 1363 | } |
18 | 1360 | 1364 | ||
19 | 1365 | QUrl WebView::targetUrl() const { | ||
20 | 1366 | return QUrl(QString::fromStdString(view_->target_url().spec())); | ||
21 | 1367 | } | ||
22 | 1368 | |||
23 | 1361 | void WebView::teardownFrameTree() { | 1369 | void WebView::teardownFrameTree() { |
24 | 1362 | DCHECK(!frame_tree_torn_down_); | 1370 | DCHECK(!frame_tree_torn_down_); |
25 | 1363 | 1371 | ||
26 | 1364 | 1372 | ||
27 | === modified file 'qt/core/browser/oxide_qt_web_view.h' | |||
28 | --- qt/core/browser/oxide_qt_web_view.h 2015-10-21 19:06:54 +0000 | |||
29 | +++ qt/core/browser/oxide_qt_web_view.h 2015-11-23 18:04:16 +0000 | |||
30 | @@ -171,6 +171,7 @@ | |||
31 | 171 | void ContentBlocked() override; | 171 | void ContentBlocked() override; |
32 | 172 | void PrepareToCloseResponseReceived(bool proceed) override; | 172 | void PrepareToCloseResponseReceived(bool proceed) override; |
33 | 173 | void CloseRequested() override; | 173 | void CloseRequested() override; |
34 | 174 | void TargetURLChanged() override; | ||
35 | 174 | 175 | ||
36 | 175 | // oxide::ScriptMessageTarget implementation | 176 | // oxide::ScriptMessageTarget implementation |
37 | 176 | size_t GetScriptMessageHandlerCount() const override; | 177 | size_t GetScriptMessageHandlerCount() const override; |
38 | @@ -285,6 +286,8 @@ | |||
39 | 285 | 286 | ||
40 | 286 | void executeEditingCommand(EditingCommands command) const override; | 287 | void executeEditingCommand(EditingCommands command) const override; |
41 | 287 | 288 | ||
42 | 289 | QUrl targetUrl() const override; | ||
43 | 290 | |||
44 | 288 | void teardownFrameTree() override; | 291 | void teardownFrameTree() override; |
45 | 289 | 292 | ||
46 | 290 | // This must outlive |view_| | 293 | // This must outlive |view_| |
47 | 291 | 294 | ||
48 | === modified file 'qt/core/glue/oxide_qt_web_view_proxy.h' | |||
49 | --- qt/core/glue/oxide_qt_web_view_proxy.h 2015-10-16 21:36:30 +0000 | |||
50 | +++ qt/core/glue/oxide_qt_web_view_proxy.h 2015-11-23 18:04:16 +0000 | |||
51 | @@ -237,6 +237,8 @@ | |||
52 | 237 | 237 | ||
53 | 238 | virtual void executeEditingCommand(EditingCommands command) const = 0; | 238 | virtual void executeEditingCommand(EditingCommands command) const = 0; |
54 | 239 | 239 | ||
55 | 240 | virtual QUrl targetUrl() const = 0; | ||
56 | 241 | |||
57 | 240 | virtual void teardownFrameTree() = 0; | 242 | virtual void teardownFrameTree() = 0; |
58 | 241 | }; | 243 | }; |
59 | 242 | 244 | ||
60 | 243 | 245 | ||
61 | === modified file 'qt/core/glue/oxide_qt_web_view_proxy_client.h' | |||
62 | --- qt/core/glue/oxide_qt_web_view_proxy_client.h 2015-10-08 15:56:22 +0000 | |||
63 | +++ qt/core/glue/oxide_qt_web_view_proxy_client.h 2015-11-23 18:04:16 +0000 | |||
64 | @@ -19,7 +19,6 @@ | |||
65 | 19 | #define _OXIDE_QT_CORE_GLUE_WEB_VIEW_PROXY_CLIENT_H_ | 19 | #define _OXIDE_QT_CORE_GLUE_WEB_VIEW_PROXY_CLIENT_H_ |
66 | 20 | 20 | ||
67 | 21 | #include <QRect> | 21 | #include <QRect> |
68 | 22 | #include <QUrl> | ||
69 | 23 | #include <QtGlobal> | 22 | #include <QtGlobal> |
70 | 24 | 23 | ||
71 | 25 | #include "qt/core/glue/oxide_qt_javascript_dialog_proxy_client.h" | 24 | #include "qt/core/glue/oxide_qt_javascript_dialog_proxy_client.h" |
72 | @@ -150,6 +149,8 @@ | |||
73 | 150 | 149 | ||
74 | 151 | virtual void PrepareToCloseResponse(bool proceed) = 0; | 150 | virtual void PrepareToCloseResponse(bool proceed) = 0; |
75 | 152 | virtual void CloseRequested() = 0; | 151 | virtual void CloseRequested() = 0; |
76 | 152 | |||
77 | 153 | virtual void TargetURLChanged() = 0; | ||
78 | 153 | }; | 154 | }; |
79 | 154 | 155 | ||
80 | 155 | } // namespace qt | 156 | } // namespace qt |
81 | 156 | 157 | ||
82 | === modified file 'qt/qmlplugin/oxide.qmltypes' | |||
83 | --- qt/qmlplugin/oxide.qmltypes 2015-10-19 17:27:42 +0000 | |||
84 | +++ qt/qmlplugin/oxide.qmltypes 2015-11-23 18:04:16 +0000 | |||
85 | @@ -4,7 +4,7 @@ | |||
86 | 4 | // It is used for QML tooling purposes only. | 4 | // It is used for QML tooling purposes only. |
87 | 5 | // | 5 | // |
88 | 6 | // This file was auto-generated by: | 6 | // This file was auto-generated by: |
90 | 7 | // 'qmlplugindump -v -noinstantiate com.canonical.Oxide 1.11 com/canonical/Oxide' | 7 | // 'qmlplugindump -v -noinstantiate com.canonical.Oxide 1.12 com/canonical/Oxide' |
91 | 8 | 8 | ||
92 | 9 | Module { | 9 | Module { |
93 | 10 | Component { | 10 | Component { |
94 | @@ -460,13 +460,14 @@ | |||
95 | 460 | exports: [ | 460 | exports: [ |
96 | 461 | "WebView 1.0", | 461 | "WebView 1.0", |
97 | 462 | "WebView 1.11", | 462 | "WebView 1.11", |
98 | 463 | "WebView 1.12", | ||
99 | 463 | "WebView 1.3", | 464 | "WebView 1.3", |
100 | 464 | "WebView 1.4", | 465 | "WebView 1.4", |
101 | 465 | "WebView 1.5", | 466 | "WebView 1.5", |
102 | 466 | "WebView 1.8", | 467 | "WebView 1.8", |
103 | 467 | "WebView 1.9" | 468 | "WebView 1.9" |
104 | 468 | ] | 469 | ] |
106 | 469 | exportMetaObjectRevisions: [0, 6, 1, 2, 3, 4, 5] | 470 | exportMetaObjectRevisions: [0, 6, 7, 1, 2, 3, 4, 5] |
107 | 470 | attachedType: "OxideQQuickWebViewAttached" | 471 | attachedType: "OxideQQuickWebViewAttached" |
108 | 471 | Enum { | 472 | Enum { |
109 | 472 | name: "LogMessageSeverityLevel" | 473 | name: "LogMessageSeverityLevel" |
110 | @@ -618,6 +619,7 @@ | |||
111 | 618 | isPointer: true | 619 | isPointer: true |
112 | 619 | } | 620 | } |
113 | 620 | Property { name: "webProcessStatus"; revision: 4; type: "WebProcessStatus"; isReadonly: true } | 621 | Property { name: "webProcessStatus"; revision: 4; type: "WebProcessStatus"; isReadonly: true } |
114 | 622 | Property { name: "hoveredUrl"; type: "QUrl"; isReadonly: true } | ||
115 | 621 | Signal { name: "loadingStateChanged"; revision: 1 } | 623 | Signal { name: "loadingStateChanged"; revision: 1 } |
116 | 622 | Signal { | 624 | Signal { |
117 | 623 | name: "loadEvent" | 625 | name: "loadEvent" |
118 | @@ -686,6 +688,7 @@ | |||
119 | 686 | revision: 5 | 688 | revision: 5 |
120 | 687 | Parameter { name: "request"; type: "QJSValue" } | 689 | Parameter { name: "request"; type: "QJSValue" } |
121 | 688 | } | 690 | } |
122 | 691 | Signal { name: "hoveredUrlChanged"; revision: 7 } | ||
123 | 689 | Signal { | 692 | Signal { |
124 | 690 | name: "loadingChanged" | 693 | name: "loadingChanged" |
125 | 691 | Parameter { name: "loadEvent"; type: "OxideQLoadEvent" } | 694 | Parameter { name: "loadEvent"; type: "OxideQLoadEvent" } |
126 | 692 | 695 | ||
127 | === modified file 'qt/qmlplugin/oxide_qml_plugin.cc' | |||
128 | --- qt/qmlplugin/oxide_qml_plugin.cc 2015-09-25 22:35:33 +0000 | |||
129 | +++ qt/qmlplugin/oxide_qml_plugin.cc 2015-11-23 18:04:16 +0000 | |||
130 | @@ -162,6 +162,8 @@ | |||
131 | 162 | qmlRegisterType<OxideQQuickWebView, 5>(uri, 1, 9, "WebView"); | 162 | qmlRegisterType<OxideQQuickWebView, 5>(uri, 1, 9, "WebView"); |
132 | 163 | 163 | ||
133 | 164 | qmlRegisterType<OxideQQuickWebView, 6>(uri, 1, 11, "WebView"); | 164 | qmlRegisterType<OxideQQuickWebView, 6>(uri, 1, 11, "WebView"); |
134 | 165 | |||
135 | 166 | qmlRegisterType<OxideQQuickWebView, 7>(uri, 1, 12, "WebView"); | ||
136 | 165 | } | 167 | } |
137 | 166 | }; | 168 | }; |
138 | 167 | 169 | ||
139 | 168 | 170 | ||
140 | === modified file 'qt/quick/api/oxideqquickwebview.cc' | |||
141 | --- qt/quick/api/oxideqquickwebview.cc 2015-11-20 15:49:58 +0000 | |||
142 | +++ qt/quick/api/oxideqquickwebview.cc 2015-11-23 18:04:16 +0000 | |||
143 | @@ -636,6 +636,12 @@ | |||
144 | 636 | emit q->closeRequested(); | 636 | emit q->closeRequested(); |
145 | 637 | } | 637 | } |
146 | 638 | 638 | ||
147 | 639 | void OxideQQuickWebViewPrivate::TargetURLChanged() { | ||
148 | 640 | Q_Q(OxideQQuickWebView); | ||
149 | 641 | |||
150 | 642 | emit q->hoveredUrlChanged(); | ||
151 | 643 | } | ||
152 | 644 | |||
153 | 639 | void OxideQQuickWebViewPrivate::completeConstruction() { | 645 | void OxideQQuickWebViewPrivate::completeConstruction() { |
154 | 640 | Q_Q(OxideQQuickWebView); | 646 | Q_Q(OxideQQuickWebView); |
155 | 641 | 647 | ||
156 | @@ -2068,6 +2074,16 @@ | |||
157 | 2068 | return static_cast<WebProcessStatus>(d->proxy()->webProcessStatus()); | 2074 | return static_cast<WebProcessStatus>(d->proxy()->webProcessStatus()); |
158 | 2069 | } | 2075 | } |
159 | 2070 | 2076 | ||
160 | 2077 | QUrl OxideQQuickWebView::hoveredUrl() const { | ||
161 | 2078 | Q_D(const OxideQQuickWebView); | ||
162 | 2079 | |||
163 | 2080 | if (!d->proxy()) { | ||
164 | 2081 | return QUrl(); | ||
165 | 2082 | } | ||
166 | 2083 | |||
167 | 2084 | return d->proxy()->targetUrl(); | ||
168 | 2085 | } | ||
169 | 2086 | |||
170 | 2071 | // static | 2087 | // static |
171 | 2072 | OxideQQuickWebViewAttached* OxideQQuickWebView::qmlAttachedProperties( | 2088 | OxideQQuickWebViewAttached* OxideQQuickWebView::qmlAttachedProperties( |
172 | 2073 | QObject* object) { | 2089 | QObject* object) { |
173 | 2074 | 2090 | ||
174 | === modified file 'qt/quick/api/oxideqquickwebview_p.h' | |||
175 | --- qt/quick/api/oxideqquickwebview_p.h 2015-09-25 22:30:19 +0000 | |||
176 | +++ qt/quick/api/oxideqquickwebview_p.h 2015-11-23 18:04:16 +0000 | |||
177 | @@ -131,6 +131,8 @@ | |||
178 | 131 | 131 | ||
179 | 132 | Q_PROPERTY(WebProcessStatus webProcessStatus READ webProcessStatus NOTIFY webProcessStatusChanged REVISION 4) | 132 | Q_PROPERTY(WebProcessStatus webProcessStatus READ webProcessStatus NOTIFY webProcessStatusChanged REVISION 4) |
180 | 133 | 133 | ||
181 | 134 | Q_PROPERTY(QUrl hoveredUrl READ hoveredUrl NOTIFY hoveredUrlChanged) | ||
182 | 135 | |||
183 | 134 | Q_DECLARE_PRIVATE(OxideQQuickWebView) | 136 | Q_DECLARE_PRIVATE(OxideQQuickWebView) |
184 | 135 | 137 | ||
185 | 136 | public: | 138 | public: |
186 | @@ -293,6 +295,8 @@ | |||
187 | 293 | 295 | ||
188 | 294 | WebProcessStatus webProcessStatus() const; | 296 | WebProcessStatus webProcessStatus() const; |
189 | 295 | 297 | ||
190 | 298 | QUrl hoveredUrl() const; | ||
191 | 299 | |||
192 | 296 | static OxideQQuickWebViewAttached* qmlAttachedProperties(QObject* object); | 300 | static OxideQQuickWebViewAttached* qmlAttachedProperties(QObject* object); |
193 | 297 | 301 | ||
194 | 298 | OxideQFindController* findController() const; | 302 | OxideQFindController* findController() const; |
195 | @@ -357,6 +361,7 @@ | |||
196 | 357 | Q_REVISION(2) void closeRequested(); | 361 | Q_REVISION(2) void closeRequested(); |
197 | 358 | Q_REVISION(4) void webProcessStatusChanged(); | 362 | Q_REVISION(4) void webProcessStatusChanged(); |
198 | 359 | Q_REVISION(5) void httpAuthenticationRequested(const QJSValue& request); | 363 | Q_REVISION(5) void httpAuthenticationRequested(const QJSValue& request); |
199 | 364 | Q_REVISION(7) void hoveredUrlChanged(); | ||
200 | 360 | 365 | ||
201 | 361 | // Deprecated since 1.3 | 366 | // Deprecated since 1.3 |
202 | 362 | void loadingChanged(const OxideQLoadEvent& loadEvent); | 367 | void loadingChanged(const OxideQLoadEvent& loadEvent); |
203 | 363 | 368 | ||
204 | === modified file 'qt/quick/api/oxideqquickwebview_p_p.h' | |||
205 | --- qt/quick/api/oxideqquickwebview_p_p.h 2015-10-08 15:56:22 +0000 | |||
206 | +++ qt/quick/api/oxideqquickwebview_p_p.h 2015-11-23 18:04:16 +0000 | |||
207 | @@ -142,6 +142,7 @@ | |||
208 | 142 | void ContentBlocked() override; | 142 | void ContentBlocked() override; |
209 | 143 | void PrepareToCloseResponse(bool proceed) override; | 143 | void PrepareToCloseResponse(bool proceed) override; |
210 | 144 | void CloseRequested() override; | 144 | void CloseRequested() override; |
211 | 145 | void TargetURLChanged() override; | ||
212 | 145 | 146 | ||
213 | 146 | oxide::qt::WebViewProxy* proxy() const { | 147 | oxide::qt::WebViewProxy* proxy() const { |
214 | 147 | return oxide::qt::WebViewProxyHandle::proxy(); | 148 | return oxide::qt::WebViewProxyHandle::proxy(); |
215 | 148 | 149 | ||
216 | === added file 'qt/tests/qmltests/api/tst_WebView_hoveredUrl.html' | |||
217 | --- qt/tests/qmltests/api/tst_WebView_hoveredUrl.html 1970-01-01 00:00:00 +0000 | |||
218 | +++ qt/tests/qmltests/api/tst_WebView_hoveredUrl.html 2015-11-23 18:04:16 +0000 | |||
219 | @@ -0,0 +1,7 @@ | |||
220 | 1 | <html> | ||
221 | 2 | <body> | ||
222 | 3 | <p><a id="link1" href="http://example.org/">example.org</a></p> | ||
223 | 4 | <p><button id="button">button</button></p> | ||
224 | 5 | <p><a id="link2" href="https://launchpad.net/">launchpad.net</a></p> | ||
225 | 6 | </body> | ||
226 | 7 | </html> | ||
227 | 0 | 8 | ||
228 | === added file 'qt/tests/qmltests/api/tst_WebView_hoveredUrl.qml' | |||
229 | --- qt/tests/qmltests/api/tst_WebView_hoveredUrl.qml 1970-01-01 00:00:00 +0000 | |||
230 | +++ qt/tests/qmltests/api/tst_WebView_hoveredUrl.qml 2015-11-23 18:04:16 +0000 | |||
231 | @@ -0,0 +1,51 @@ | |||
232 | 1 | import QtQuick 2.0 | ||
233 | 2 | import QtTest 1.0 | ||
234 | 3 | import com.canonical.Oxide 1.12 | ||
235 | 4 | import com.canonical.Oxide.Testing 1.0 | ||
236 | 5 | |||
237 | 6 | TestWebView { | ||
238 | 7 | id: webView | ||
239 | 8 | focus: true | ||
240 | 9 | width: 200 | ||
241 | 10 | height: 200 | ||
242 | 11 | |||
243 | 12 | SignalSpy { | ||
244 | 13 | id: spy | ||
245 | 14 | target: webView | ||
246 | 15 | signalName: "hoveredUrlChanged" | ||
247 | 16 | } | ||
248 | 17 | |||
249 | 18 | TestCase { | ||
250 | 19 | name: "WebView_hoveredUrl" | ||
251 | 20 | when: windowShown | ||
252 | 21 | |||
253 | 22 | function test_hoveredUrl() { | ||
254 | 23 | webView.url = "http://foo.testsuite/tst_WebView_hoveredUrl.html" | ||
255 | 24 | verify(webView.waitForLoadSucceeded()); | ||
256 | 25 | spy.clear(); | ||
257 | 26 | |||
258 | 27 | var r = webView.getTestApi().getBoundingClientRectForSelector("#link1"); | ||
259 | 28 | mouseMove(webView, r.x + r.width / 2, r.y + r.height / 2); | ||
260 | 29 | spy.wait(); | ||
261 | 30 | compare(webView.hoveredUrl, "http://example.org/"); | ||
262 | 31 | compare(spy.count, 1); | ||
263 | 32 | |||
264 | 33 | r = webView.getTestApi().getBoundingClientRectForSelector("#button"); | ||
265 | 34 | mouseMove(webView, r.x + r.width / 2, r.y + r.height / 2); | ||
266 | 35 | spy.wait(); | ||
267 | 36 | compare(webView.hoveredUrl, ""); | ||
268 | 37 | compare(spy.count, 2); | ||
269 | 38 | |||
270 | 39 | r = webView.getTestApi().getBoundingClientRectForSelector("#link2"); | ||
271 | 40 | mouseMove(webView, r.x + r.width / 2, r.y + r.height / 2); | ||
272 | 41 | spy.wait(); | ||
273 | 42 | compare(webView.hoveredUrl, "https://launchpad.net/"); | ||
274 | 43 | compare(spy.count, 3); | ||
275 | 44 | |||
276 | 45 | mouseMove(webView, r.x + r.width / 2, r.y + r.height * 2); | ||
277 | 46 | spy.wait(); | ||
278 | 47 | compare(webView.hoveredUrl, ""); | ||
279 | 48 | compare(spy.count, 4); | ||
280 | 49 | } | ||
281 | 50 | } | ||
282 | 51 | } | ||
283 | 0 | 52 | ||
284 | === modified file 'shared/browser/oxide_web_view.cc' | |||
285 | --- shared/browser/oxide_web_view.cc 2015-11-16 20:03:58 +0000 | |||
286 | +++ shared/browser/oxide_web_view.cc 2015-11-23 18:04:16 +0000 | |||
287 | @@ -785,6 +785,15 @@ | |||
288 | 785 | client_->CloseRequested(); | 785 | client_->CloseRequested(); |
289 | 786 | } | 786 | } |
290 | 787 | 787 | ||
291 | 788 | void WebView::UpdateTargetURL(content::WebContents* source, const GURL& url) { | ||
292 | 789 | DCHECK_VALID_SOURCE_CONTENTS | ||
293 | 790 | |||
294 | 791 | if (url != target_url_) { | ||
295 | 792 | target_url_ = url; | ||
296 | 793 | client_->TargetURLChanged(); | ||
297 | 794 | } | ||
298 | 795 | } | ||
299 | 796 | |||
300 | 788 | bool WebView::AddMessageToConsole(content::WebContents* source, | 797 | bool WebView::AddMessageToConsole(content::WebContents* source, |
301 | 789 | int32 level, | 798 | int32 level, |
302 | 790 | const base::string16& message, | 799 | const base::string16& message, |
303 | 791 | 800 | ||
304 | === modified file 'shared/browser/oxide_web_view.h' | |||
305 | --- shared/browser/oxide_web_view.h 2015-11-11 21:20:30 +0000 | |||
306 | +++ shared/browser/oxide_web_view.h 2015-11-23 18:04:16 +0000 | |||
307 | @@ -288,6 +288,8 @@ | |||
308 | 288 | 288 | ||
309 | 289 | bool CanCreateWindows() const; | 289 | bool CanCreateWindows() const; |
310 | 290 | 290 | ||
311 | 291 | const GURL& target_url() const { return target_url_; } | ||
312 | 292 | |||
313 | 291 | private: | 293 | private: |
314 | 292 | WebView(WebViewClient* client); | 294 | WebView(WebViewClient* client); |
315 | 293 | 295 | ||
316 | @@ -390,6 +392,7 @@ | |||
317 | 390 | bool* was_blocked) final; | 392 | bool* was_blocked) final; |
318 | 391 | void LoadProgressChanged(content::WebContents* source, double progress) final; | 393 | void LoadProgressChanged(content::WebContents* source, double progress) final; |
319 | 392 | void CloseContents(content::WebContents* source) final; | 394 | void CloseContents(content::WebContents* source) final; |
320 | 395 | void UpdateTargetURL(content::WebContents* source, const GURL& url) final; | ||
321 | 393 | bool AddMessageToConsole(content::WebContents* source, | 396 | bool AddMessageToConsole(content::WebContents* source, |
322 | 394 | int32 level, | 397 | int32 level, |
323 | 395 | const base::string16& message, | 398 | const base::string16& message, |
324 | @@ -511,6 +514,8 @@ | |||
325 | 511 | 514 | ||
326 | 512 | RenderWidgetHostID interstitial_rwh_id_; | 515 | RenderWidgetHostID interstitial_rwh_id_; |
327 | 513 | 516 | ||
328 | 517 | GURL target_url_; | ||
329 | 518 | |||
330 | 514 | base::WeakPtrFactory<WebView> weak_factory_; | 519 | base::WeakPtrFactory<WebView> weak_factory_; |
331 | 515 | 520 | ||
332 | 516 | DISALLOW_COPY_AND_ASSIGN(WebView); | 521 | DISALLOW_COPY_AND_ASSIGN(WebView); |
333 | 517 | 522 | ||
334 | === modified file 'shared/browser/oxide_web_view_client.cc' | |||
335 | --- shared/browser/oxide_web_view_client.cc 2015-10-21 19:06:54 +0000 | |||
336 | +++ shared/browser/oxide_web_view_client.cc 2015-11-23 18:04:16 +0000 | |||
337 | @@ -147,6 +147,8 @@ | |||
338 | 147 | 147 | ||
339 | 148 | void WebViewClient::CloseRequested() {} | 148 | void WebViewClient::CloseRequested() {} |
340 | 149 | 149 | ||
341 | 150 | void WebViewClient::TargetURLChanged() {} | ||
342 | 151 | |||
343 | 150 | void WebViewClient::HttpAuthenticationRequested( | 152 | void WebViewClient::HttpAuthenticationRequested( |
344 | 151 | ResourceDispatcherHostLoginDelegate* login_delegate) {} | 153 | ResourceDispatcherHostLoginDelegate* login_delegate) {} |
345 | 152 | 154 | ||
346 | 153 | 155 | ||
347 | === modified file 'shared/browser/oxide_web_view_client.h' | |||
348 | --- shared/browser/oxide_web_view_client.h 2015-10-21 19:06:54 +0000 | |||
349 | +++ shared/browser/oxide_web_view_client.h 2015-11-23 18:04:16 +0000 | |||
350 | @@ -183,6 +183,8 @@ | |||
351 | 183 | 183 | ||
352 | 184 | virtual void CloseRequested(); | 184 | virtual void CloseRequested(); |
353 | 185 | 185 | ||
354 | 186 | virtual void TargetURLChanged(); | ||
355 | 187 | |||
356 | 186 | virtual void HttpAuthenticationRequested( | 188 | virtual void HttpAuthenticationRequested( |
357 | 187 | ResourceDispatcherHostLoginDelegate* login_delegate); | 189 | ResourceDispatcherHostLoginDelegate* login_delegate); |
358 | 188 | }; | 190 | }; |
This looks mostly ok. One thing I'd prefer is for the actual target URL to be stored in oxide::WebView. As the target URL can be updated with keyboard focus, it's possible that a newly created WebContents (created with window.open) might get an update for this before we create a webview. In this case, we'll miss it but in the future I plan to completely decouple the WebContentsDelegate implementation from WebView