Merge lp:~chrisccoulson/oxide/refactor-webview-rwhv-interation into lp:~oxide-developers/oxide/oxide.trunk

Proposed by Chris Coulson
Status: Merged
Merged at revision: 1227
Proposed branch: lp:~chrisccoulson/oxide/refactor-webview-rwhv-interation
Merge into: lp:~oxide-developers/oxide/oxide.trunk
Diff against target: 3849 lines (+1746/-856)
30 files modified
qt/core/browser/input/oxide_qt_input_method_context.cc (+424/-0)
qt/core/browser/input/oxide_qt_input_method_context.h (+82/-0)
qt/core/browser/input/oxide_qt_input_method_context_client.h (+36/-0)
qt/core/browser/oxide_qt_web_view.cc (+16/-278)
qt/core/browser/oxide_qt_web_view.h (+10/-19)
qt/core/core.gyp (+6/-3)
shared/browser/compositor/oxide_compositor.cc (+16/-30)
shared/browser/compositor/oxide_compositor.h (+7/-27)
shared/browser/compositor/oxide_compositor_client.h (+0/-2)
shared/browser/compositor/oxide_compositor_observer.cc (+60/-0)
shared/browser/compositor/oxide_compositor_observer.h (+49/-0)
shared/browser/input/oxide_ime_bridge.cc (+31/-0)
shared/browser/input/oxide_ime_bridge.h (+84/-0)
shared/browser/input/oxide_ime_bridge_impl.cc (+157/-0)
shared/browser/input/oxide_ime_bridge_impl.h (+69/-0)
shared/browser/input/oxide_input_method_context.cc (+69/-0)
shared/browser/input/oxide_input_method_context.h (+69/-0)
shared/browser/input/oxide_input_method_context_observer.cc (+61/-0)
shared/browser/input/oxide_input_method_context_observer.h (+49/-0)
shared/browser/oxide_render_widget_host_view.cc (+120/-132)
shared/browser/oxide_render_widget_host_view.h (+18/-16)
shared/browser/oxide_render_widget_host_view_container.h (+35/-28)
shared/browser/oxide_web_contents_view.cc (+45/-28)
shared/browser/oxide_web_contents_view.h (+6/-2)
shared/browser/oxide_web_view.cc (+139/-204)
shared/browser/oxide_web_view.h (+30/-56)
shared/browser/oxide_web_view_client.cc (+3/-13)
shared/browser/oxide_web_view_client.h (+2/-17)
shared/common/oxide_unowned_user_data.h (+41/-0)
shared/shared.gyp (+12/-1)
To merge this branch: bzr merge lp:~chrisccoulson/oxide/refactor-webview-rwhv-interation
Reviewer Review Type Date Requested Status
Chris Coulson Pending
Review via email: mp+274723@code.launchpad.net
To post a comment you must log in.
1222. By Chris Coulson

Merge from trunk

1223. By Chris Coulson

When a RWHV is hidden, make sure we hide its cc::Layer

1224. By Chris Coulson

Don't proxy EvictCurrentFrame up to the WebView. This already doesn't make sense, and we should have a separate algorithm for LayerTreeHost eviction when a WebView is hidden. The current implementation won't make sense when we have Interstitial views anyway

1225. By Chris Coulson

Create RWHVs with a container

1226. By Chris Coulson

Change the behaviour of RWHV::IsShowing, and make sure that when we create a new cc::Layer it has the correct visibility

1227. By Chris Coulson

Fix RWHV::HasFocus

1228. By Chris Coulson

Merge from trunk

1229. By Chris Coulson

Merge from trunk

1230. By Chris Coulson

Split IME related calls from WebViewClient in to new classes

1231. By Chris Coulson

Attach the IM context when creating a new webview

1232. By Chris Coulson

Remove an unused method from WebViewClient

1233. By Chris Coulson

Fix cursor updates to work with interstitial views

1234. By Chris Coulson

Fix a shutdown crash

1235. By Chris Coulson

Turn a couple of CHECKs in to DCHECKs

1236. By Chris Coulson

Actually observe the input method context

1237. By Chris Coulson

Add CompositorObserver and make RWHV use this, rather than relying on WebView to proxy DidCommit to it

1238. By Chris Coulson

Fix a -Wreorder warning

1239. By Chris Coulson

Don't call Show() or Hide() when setting the container

1240. By Chris Coulson

We only need to set the RWHV visibility / focus for the first view

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'qt/core/browser/input'
=== added file 'qt/core/browser/input/oxide_qt_input_method_context.cc'
--- qt/core/browser/input/oxide_qt_input_method_context.cc 1970-01-01 00:00:00 +0000
+++ qt/core/browser/input/oxide_qt_input_method_context.cc 2015-10-21 17:31:00 +0000
@@ -0,0 +1,424 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#include "oxide_qt_input_method_context.h"
19
20#include <string>
21#include <vector>
22
23#include <QFocusEvent>
24#include <QGuiApplication>
25#include <QInputMethod>
26#include <QInputMethodEvent>
27#include <QRect>
28#include <QString>
29#include <QTextCharFormat>
30#include <QWindow>
31
32#include "base/strings/utf_string_conversions.h"
33#include "third_party/skia/include/core/SkColor.h"
34#include "third_party/WebKit/public/platform/WebColor.h"
35#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
36#include "ui/base/ime/text_input_type.h"
37#include "ui/gfx/geometry/rect.h"
38#include "ui/gfx/range/range.h"
39
40#include "shared/browser/input/oxide_ime_bridge.h"
41
42#include "oxide_qt_input_method_context_client.h"
43
44namespace oxide {
45namespace qt {
46
47namespace {
48
49Qt::InputMethodHints QImHintsFromInputType(ui::TextInputType type) {
50 switch (type) {
51 case ui::TEXT_INPUT_TYPE_TEXT:
52 case ui::TEXT_INPUT_TYPE_TEXT_AREA:
53 case ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE:
54 return Qt::ImhPreferLowercase;
55 case ui::TEXT_INPUT_TYPE_PASSWORD:
56 return Qt::ImhHiddenText | Qt::ImhSensitiveData |
57 Qt::ImhNoAutoUppercase | Qt::ImhPreferLowercase |
58 Qt::ImhNoPredictiveText;
59 case ui::TEXT_INPUT_TYPE_SEARCH:
60 return Qt::ImhNoAutoUppercase | Qt::ImhPreferLowercase;
61 case ui::TEXT_INPUT_TYPE_EMAIL:
62 return Qt::ImhEmailCharactersOnly;
63 case ui::TEXT_INPUT_TYPE_NUMBER:
64 return Qt::ImhFormattedNumbersOnly;
65 case ui::TEXT_INPUT_TYPE_TELEPHONE:
66 return Qt::ImhDialableCharactersOnly;
67 case ui::TEXT_INPUT_TYPE_URL:
68 return Qt::ImhUrlCharactersOnly;
69 case ui::TEXT_INPUT_TYPE_DATE:
70 case ui::TEXT_INPUT_TYPE_MONTH:
71 case ui::TEXT_INPUT_TYPE_WEEK:
72 return Qt::ImhDate;
73 case ui::TEXT_INPUT_TYPE_DATE_TIME:
74 case ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL:
75 case ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD:
76 return Qt::ImhDate | Qt::ImhTime;
77 case ui::TEXT_INPUT_TYPE_TIME:
78 return Qt::ImhTime;
79 default:
80 return Qt::ImhNone;
81 }
82}
83
84}
85
86void InputMethodContext::OnInputPanelVisibilityChanged() {
87}
88
89bool InputMethodContext::ShouldShowInputPanel() const {
90 if (!ime_bridge()) {
91 return false;
92 }
93
94 if (ime_bridge()->text_input_type() != ui::TEXT_INPUT_TYPE_NONE &&
95 ime_bridge()->show_ime_if_needed() &&
96 ime_bridge()->focused_node_is_editable()) {
97 return true;
98 }
99
100 return false;
101}
102
103bool InputMethodContext::ShouldHideInputPanel() const {
104 if (!ime_bridge()) {
105 return true;
106 }
107
108 if (ime_bridge()->text_input_type() == ui::TEXT_INPUT_TYPE_NONE &&
109 !ime_bridge()->focused_node_is_editable()) {
110 return true;
111 }
112
113 return false;
114}
115
116void InputMethodContext::SetInputPanelVisibility(bool visible) {
117 client_->SetInputMethodEnabled(visible);
118
119 if (!visible) {
120 has_input_method_state_ = false;
121 }
122
123 // Do not check whether the input method is currently visible here, to avoid
124 // a possible race condition: if hide() and show() are called very quickly
125 // in a row, when show() is called the hide() request might not have
126 // completed yet, and isVisible() could return true.
127 // See https://launchpad.net/bugs/1377755
128 QInputMethod* im = QGuiApplication::inputMethod();
129 if (im) {
130 im->setVisible(visible);
131 }
132}
133
134bool InputMethodContext::IsInputPanelVisible() const {
135 QInputMethod* im = QGuiApplication::inputMethod();
136 if (!im) {
137 return false;
138 }
139
140 return im->isVisible();
141}
142
143void InputMethodContext::TextInputStateChanged() {
144 if (!client_) {
145 return;
146 }
147
148 if (!client_->HasFocus()) {
149 return;
150 }
151
152 // Don't notify if type is none. See https://launchpad.net/bugs/1381083
153 if (ime_bridge() &&
154 ime_bridge()->text_input_type() != ui::TEXT_INPUT_TYPE_NONE) {
155 QGuiApplication::inputMethod()->update(
156 static_cast<Qt::InputMethodQueries>(Qt::ImQueryInput | Qt::ImHints));
157 }
158
159 if (ShouldShowInputPanel()) {
160 SetInputPanelVisibility(true);
161 } else if (ShouldHideInputPanel()) {
162 SetInputPanelVisibility(false);
163 }
164}
165
166void InputMethodContext::SelectionBoundsChanged() {
167 if (!client_) {
168 return;
169 }
170
171 if (!client_->HasFocus()) {
172 return;
173 }
174
175 QInputMethod* im = QGuiApplication::inputMethod();
176 if (!im) {
177 return;
178 }
179
180 im->update(static_cast<Qt::InputMethodQueries>(
181 Qt::ImCursorRectangle
182 | Qt::ImCursorPosition
183 | Qt::ImAnchorPosition
184#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
185 | Qt::ImTextBeforeCursor
186 | Qt::ImTextAfterCursor
187#endif
188 ));
189}
190
191void InputMethodContext::SelectionChanged() {
192 if (!client_) {
193 return;
194 }
195
196 if (!client_->HasFocus()) {
197 return;
198 }
199
200 QInputMethod* im = QGuiApplication::inputMethod();
201 if (!im) {
202 return;
203 }
204
205 im->update(static_cast<Qt::InputMethodQueries>(
206 Qt::ImSurroundingText
207 | Qt::ImCurrentSelection
208#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
209 | Qt::ImTextBeforeCursor
210 | Qt::ImTextAfterCursor
211#endif
212 ));
213}
214
215void InputMethodContext::CancelComposition() {
216 if (!has_input_method_state_) {
217 return;
218 }
219
220 QInputMethod* im = QGuiApplication::inputMethod();
221 if (!im) {
222 return;
223 }
224
225 im->reset();
226}
227
228void InputMethodContext::FocusedNodeChanged() {
229 if (!client_) {
230 return;
231 }
232
233 // Work around for https://launchpad.net/bugs/1323743
234 if (QGuiApplication::focusWindow() &&
235 QGuiApplication::focusWindow()->focusObject()) {
236 QGuiApplication::focusWindow()->focusObjectChanged(
237 QGuiApplication::focusWindow()->focusObject());
238 }
239
240 if (ShouldHideInputPanel() && client_->HasFocus()) {
241 SetInputPanelVisibility(false);
242 } else if (!has_input_method_state_ && ShouldShowInputPanel()) {
243 // See https://launchpad.net/bugs/1400372
244 SetInputPanelVisibility(true);
245 } else if (has_input_method_state_ &&
246 ime_bridge() &&
247 ime_bridge()->focused_node_is_editable() &&
248 QGuiApplication::inputMethod()) {
249 QGuiApplication::inputMethod()->reset();
250 }
251}
252
253InputMethodContext::InputMethodContext(InputMethodContextClient* client)
254 : client_(client),
255 has_input_method_state_(false) {
256 QInputMethod* im = QGuiApplication::inputMethod();
257 if (im) {
258 connect(im, SIGNAL(visibleChanged()),
259 SLOT(OnInputPanelVisibilityChanged()));
260 }
261}
262
263InputMethodContext::~InputMethodContext() {
264 QInputMethod* im = QGuiApplication::inputMethod();
265 if (im) {
266 im->disconnect(this);
267 }
268}
269
270void InputMethodContext::DetachClient() {
271 client_ = nullptr;
272}
273
274QVariant InputMethodContext::Query(Qt::InputMethodQuery query) const {
275 switch (query) {
276 case Qt::ImHints:
277 if (!ime_bridge()) {
278 return QVariant(QImHintsFromInputType(ui::TEXT_INPUT_TYPE_NONE));
279 }
280 return QVariant(QImHintsFromInputType(ime_bridge()->text_input_type()));
281 case Qt::ImCursorRectangle: {
282 if (!ime_bridge()) {
283 return QRect();
284 }
285 // XXX: Is this in the right coordinate space?
286 return QRect(ime_bridge()->caret_rect().x(),
287 ime_bridge()->caret_rect().y(),
288 ime_bridge()->caret_rect().width(),
289 ime_bridge()->caret_rect().height());
290 }
291 case Qt::ImCursorPosition:
292 if (!ime_bridge()) {
293 return 0;
294 }
295 return static_cast<int>(ime_bridge()->selection_cursor_position() &
296 INT_MAX);
297 case Qt::ImSurroundingText:
298 if (!ime_bridge()) {
299 return QString();
300 }
301 return QString::fromStdString(
302 base::UTF16ToUTF8(ime_bridge()->GetSelectionText()));
303 case Qt::ImCurrentSelection:
304 if (!ime_bridge()) {
305 return QString();
306 }
307 return QString::fromStdString(
308 base::UTF16ToUTF8(ime_bridge()->GetSelectedText()));
309 case Qt::ImAnchorPosition:
310 if (!ime_bridge()) {
311 return 0;
312 }
313 return static_cast<int>(ime_bridge()->selection_anchor_position() &
314 INT_MAX);
315#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
316 case Qt::ImTextBeforeCursor: {
317 if (!ime_bridge()) {
318 return QString();
319 }
320 std::string text = base::UTF16ToUTF8(ime_bridge()->GetSelectionText());
321 return QString::fromStdString(
322 text.substr(0, ime_bridge()->selection_cursor_position()));
323 }
324 case Qt::ImTextAfterCursor: {
325 if (!ime_bridge()) {
326 return QString();
327 }
328 std::string text = base::UTF16ToUTF8(ime_bridge()->GetSelectionText());
329 if (ime_bridge()->selection_cursor_position() > text.length()) {
330 return QString();
331 }
332 return QString::fromStdString(
333 text.substr(ime_bridge()->selection_cursor_position(),
334 std::string::npos));
335 }
336#endif
337 default:
338 break;
339 }
340
341 return QVariant();
342}
343
344void InputMethodContext::FocusChanged(QFocusEvent* event) {
345 if (!event->gotFocus()) {
346 return;
347 }
348
349 if (!ShouldShowInputPanel()) {
350 return;
351 }
352
353 SetInputPanelVisibility(true);
354}
355
356void InputMethodContext::HandleEvent(QInputMethodEvent* event) {
357 QString commit_string = event->commitString();
358
359 if (!commit_string.isEmpty()) {
360 gfx::Range replacement_range = gfx::Range::InvalidRange();
361 if (event->replacementLength() > 0) {
362 replacement_range.set_start(event->replacementStart());
363 replacement_range.set_end(event->replacementStart() +
364 event->replacementLength());
365 }
366 if (ime_bridge()) {
367 ime_bridge()->CommitText(base::UTF8ToUTF16(commit_string.toStdString()),
368 replacement_range);
369 }
370 }
371
372 QString preedit_string = event->preeditString();
373
374 std::vector<blink::WebCompositionUnderline> underlines;
375 int cursor_position = -1;
376 gfx::Range selection_range = gfx::Range::InvalidRange();
377
378 for (const auto& attribute : event->attributes()) {
379 switch (attribute.type) {
380 case QInputMethodEvent::Cursor:
381 if (attribute.length > 0) {
382 cursor_position = attribute.start;
383 }
384 break;
385 case QInputMethodEvent::Selection:
386 selection_range.set_start(
387 qMin(attribute.start, (attribute.start + attribute.length)));
388 selection_range.set_end(
389 qMax(attribute.start, (attribute.start + attribute.length)));
390 break;
391 case QInputMethodEvent::TextFormat: {
392 QTextCharFormat format =
393 attribute.value.value<QTextFormat>().toCharFormat();
394 blink::WebColor color = format.underlineColor().rgba();
395 int start = qMin(attribute.start, (attribute.start + attribute.length));
396 int end = qMax(attribute.start, (attribute.start + attribute.length));
397 blink::WebCompositionUnderline underline(
398 start, end, color, false, SK_ColorTRANSPARENT);
399 underlines.push_back(underline);
400 break;
401 }
402 default:
403 break;
404 }
405 }
406
407 if (!selection_range.IsValid()) {
408 selection_range =
409 gfx::Range(cursor_position > 0 ?
410 cursor_position :
411 preedit_string.length());
412 }
413
414 if (ime_bridge()) {
415 ime_bridge()->SetComposingText(
416 base::UTF8ToUTF16(preedit_string.toStdString()),
417 underlines, selection_range);
418 }
419
420 has_input_method_state_ = !preedit_string.isEmpty();
421}
422
423} // namespace qt
424} // namespace oxide
0425
=== added file 'qt/core/browser/input/oxide_qt_input_method_context.h'
--- qt/core/browser/input/oxide_qt_input_method_context.h 1970-01-01 00:00:00 +0000
+++ qt/core/browser/input/oxide_qt_input_method_context.h 2015-10-21 17:31:00 +0000
@@ -0,0 +1,82 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#ifndef _OXIDE_QT_CORE_BROWSER_INPUT_INPUT_METHOD_CONTEXT_H_
19#define _OXIDE_QT_CORE_BROWSER_INPUT_INPUT_METHOD_CONTEXT_H_
20
21#include <QObject>
22#include <QtGlobal>
23#include <QVariant>
24
25#include "base/macros.h"
26
27#include "shared/browser/input/oxide_input_method_context.h"
28
29QT_BEGIN_NAMESPACE
30class QFocusEvent;
31class QInputMethodEvent;
32QT_END_NAMESPACE
33
34namespace oxide {
35namespace qt {
36
37class InputMethodContextClient;
38
39class InputMethodContext : public QObject,
40 public oxide::InputMethodContext {
41 Q_OBJECT
42
43 public:
44 InputMethodContext(InputMethodContextClient* client);
45 ~InputMethodContext() override;
46
47 QVariant Query(Qt::InputMethodQuery query) const;
48
49 // Null out |client_| to prevent calls back in to it during its destructor
50 void DetachClient();
51
52 void FocusChanged(QFocusEvent* event);
53 void HandleEvent(QInputMethodEvent* event);
54
55 private Q_SLOTS:
56 void OnInputPanelVisibilityChanged();
57
58 private:
59 bool ShouldShowInputPanel() const;
60 bool ShouldHideInputPanel() const;
61
62 void SetInputPanelVisibility(bool visible);
63
64 // oxide::InputMethodContext implementation
65 bool IsInputPanelVisible() const override;
66 void TextInputStateChanged() override;
67 void SelectionBoundsChanged() override;
68 void SelectionChanged() override;
69 void CancelComposition() override;
70 void FocusedNodeChanged() override;
71
72 InputMethodContextClient* client_; // Owns us
73
74 bool has_input_method_state_;
75
76 DISALLOW_COPY_AND_ASSIGN(InputMethodContext);
77};
78
79} // namespace qt
80} // namespace oxide
81
82#endif // _OXIDE_QT_CORE_BROWSER_INPUT_INPUT_METHOD_CONTEXT_H_
083
=== added file 'qt/core/browser/input/oxide_qt_input_method_context_client.h'
--- qt/core/browser/input/oxide_qt_input_method_context_client.h 1970-01-01 00:00:00 +0000
+++ qt/core/browser/input/oxide_qt_input_method_context_client.h 2015-10-21 17:31:00 +0000
@@ -0,0 +1,36 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#ifndef _OXIDE_QT_CORE_BROWSER_INPUT_INPUT_METHOD_CONTEXT_CLIENT_H_
19#define _OXIDE_QT_CORE_BROWSER_INPUT_INPUT_METHOD_CONTEXT_CLIENT_H_
20
21namespace oxide {
22namespace qt {
23
24class InputMethodContextClient {
25 public:
26 virtual ~InputMethodContextClient() {}
27
28 virtual bool HasFocus() const = 0;
29
30 virtual void SetInputMethodEnabled(bool enabled) = 0;
31};
32
33} // namespace qt
34} // namespace oxide
35
36#endif // _OXIDE_QT_CORE_BROWSER_INPUT_INPUT_METHOD_CONTEXT_CLIENT_H_
037
=== modified file 'qt/core/browser/oxide_qt_web_view.cc'
--- qt/core/browser/oxide_qt_web_view.cc 2015-10-16 21:36:30 +0000
+++ qt/core/browser/oxide_qt_web_view.cc 2015-10-21 17:31:00 +0000
@@ -25,14 +25,12 @@
25#include <QCursor>25#include <QCursor>
26#include <QGuiApplication>26#include <QGuiApplication>
27#include <QInputEvent>27#include <QInputEvent>
28#include <QInputMethod>
29#include <QKeyEvent>28#include <QKeyEvent>
29#include <QPixmap>
30#include <QScreen>30#include <QScreen>
31#include <QString>31#include <QString>
32#include <QtDebug>32#include <QtDebug>
33#include <QTextCharFormat>
34#include <QUrl>33#include <QUrl>
35#include <QWindow>
3634
37#include "base/logging.h"35#include "base/logging.h"
38#include "base/macros.h"36#include "base/macros.h"
@@ -46,16 +44,12 @@
46#include "content/public/browser/navigation_controller.h"44#include "content/public/browser/navigation_controller.h"
47#include "content/browser/web_contents/web_contents_impl.h"45#include "content/browser/web_contents/web_contents_impl.h"
48#include "net/base/net_errors.h"46#include "net/base/net_errors.h"
49#include "third_party/skia/include/core/SkColor.h"
50#include "third_party/WebKit/public/platform/WebColor.h"
51#include "third_party/WebKit/public/platform/WebCursorInfo.h"47#include "third_party/WebKit/public/platform/WebCursorInfo.h"
52#include "third_party/WebKit/public/platform/WebTopControlsState.h"48#include "third_party/WebKit/public/platform/WebTopControlsState.h"
53#include "ui/base/ime/text_input_type.h"
54#include "ui/events/event.h"49#include "ui/events/event.h"
55#include "ui/gfx/geometry/point.h"50#include "ui/gfx/geometry/point.h"
56#include "ui/gfx/geometry/rect.h"51#include "ui/gfx/geometry/rect.h"
57#include "ui/gfx/geometry/size.h"52#include "ui/gfx/geometry/size.h"
58#include "ui/gfx/range/range.h"
59#include "url/gurl.h"53#include "url/gurl.h"
6054
61#include "qt/core/api/oxideqdownloadrequest.h"55#include "qt/core/api/oxideqdownloadrequest.h"
@@ -74,6 +68,7 @@
74#include "qt/core/api/oxideqfindcontroller_p.h"68#include "qt/core/api/oxideqfindcontroller_p.h"
75#include "qt/core/api/oxideqwebpreferences.h"69#include "qt/core/api/oxideqwebpreferences.h"
76#include "qt/core/api/oxideqwebpreferences_p.h"70#include "qt/core/api/oxideqwebpreferences_p.h"
71#include "qt/core/browser/input/oxide_qt_input_method_context.h"
77#include "qt/core/glue/oxide_qt_web_frame_proxy_client.h"72#include "qt/core/glue/oxide_qt_web_frame_proxy_client.h"
78#include "qt/core/glue/oxide_qt_web_view_proxy_client.h"73#include "qt/core/glue/oxide_qt_web_view_proxy_client.h"
79#include "shared/browser/compositor/oxide_compositor_frame_data.h"74#include "shared/browser/compositor/oxide_compositor_frame_data.h"
@@ -236,41 +231,6 @@
236 return QCursor(cs);231 return QCursor(cs);
237}232}
238233
239Qt::InputMethodHints QImHintsFromInputType(ui::TextInputType type) {
240 switch (type) {
241 case ui::TEXT_INPUT_TYPE_TEXT:
242 case ui::TEXT_INPUT_TYPE_TEXT_AREA:
243 case ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE:
244 return Qt::ImhPreferLowercase;
245 case ui::TEXT_INPUT_TYPE_PASSWORD:
246 return Qt::ImhHiddenText | Qt::ImhSensitiveData |
247 Qt::ImhNoAutoUppercase | Qt::ImhPreferLowercase |
248 Qt::ImhNoPredictiveText;
249 case ui::TEXT_INPUT_TYPE_SEARCH:
250 return Qt::ImhNoAutoUppercase | Qt::ImhPreferLowercase;
251 case ui::TEXT_INPUT_TYPE_EMAIL:
252 return Qt::ImhEmailCharactersOnly;
253 case ui::TEXT_INPUT_TYPE_NUMBER:
254 return Qt::ImhFormattedNumbersOnly;
255 case ui::TEXT_INPUT_TYPE_TELEPHONE:
256 return Qt::ImhDialableCharactersOnly;
257 case ui::TEXT_INPUT_TYPE_URL:
258 return Qt::ImhUrlCharactersOnly;
259 case ui::TEXT_INPUT_TYPE_DATE:
260 case ui::TEXT_INPUT_TYPE_MONTH:
261 case ui::TEXT_INPUT_TYPE_WEEK:
262 return Qt::ImhDate;
263 case ui::TEXT_INPUT_TYPE_DATE_TIME:
264 case ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL:
265 case ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD:
266 return Qt::ImhDate | Qt::ImhTime;
267 case ui::TEXT_INPUT_TYPE_TIME:
268 return Qt::ImhTime;
269 default:
270 return Qt::ImhNone;
271 }
272}
273
274static const char* STATE_SERIALIZER_MAGIC_NUMBER = "oxide";234static const char* STATE_SERIALIZER_MAGIC_NUMBER = "oxide";
275static uint16_t STATE_SERIALIZER_VERSION = 1;235static uint16_t STATE_SERIALIZER_VERSION = 1;
276236
@@ -429,22 +389,12 @@
429 QRect rect_;389 QRect rect_;
430};390};
431391
432void WebView::OnInputPanelVisibilityChanged() {
433 view_->InputPanelVisibilityChanged();
434}
435
436WebView::WebView(WebViewProxyClient* client,392WebView::WebView(WebViewProxyClient* client,
437 OxideQSecurityStatus* security_status)393 OxideQSecurityStatus* security_status)
438 : client_(client),394 : input_method_context_(new InputMethodContext(this)),
439 has_input_method_state_(false),395 client_(client),
440 security_status_(security_status),396 security_status_(security_status),
441 frame_tree_torn_down_(false) {397 frame_tree_torn_down_(false) {}
442 QInputMethod* im = QGuiApplication::inputMethod();
443 if (im) {
444 connect(im, SIGNAL(visibleChanged()),
445 SLOT(OnInputPanelVisibilityChanged()));
446 }
447}
448398
449float WebView::GetDeviceScaleFactor() const {399float WebView::GetDeviceScaleFactor() const {
450 QScreen* screen = client_->GetScreen();400 QScreen* screen = client_->GetScreen();
@@ -455,48 +405,6 @@
455 return GetDeviceScaleFactorFromQScreen(screen);405 return GetDeviceScaleFactorFromQScreen(screen);
456}406}
457407
458bool WebView::ShouldShowInputPanel() const {
459 if (!view_) {
460 // Can be called during WebView construction when |view_| is still null.
461 return false;
462 }
463
464 if (view_->text_input_type() != ui::TEXT_INPUT_TYPE_NONE &&
465 view_->show_ime_if_needed() && view_->focused_node_is_editable()) {
466 return true;
467 }
468
469 return false;
470}
471
472bool WebView::ShouldHideInputPanel() const {
473 if (!view_) {
474 // Can be called during WebView construction when |view_| is still null.
475 return true;
476 }
477
478 if (view_->text_input_type() == ui::TEXT_INPUT_TYPE_NONE &&
479 !view_->focused_node_is_editable()) {
480 return true;
481 }
482
483 return false;
484}
485
486void WebView::SetInputPanelVisibility(bool visible) {
487 client_->SetInputMethodEnabled(visible);
488
489 if (!visible) {
490 has_input_method_state_ = false;
491 }
492
493 // Do not check whether the input method is currently visible here, to avoid
494 // a possible race condition: if hide() and show() are called very quickly
495 // in a row, when show() is called the hide() request might not have
496 // completed yet, and isVisible() could return true.
497 QGuiApplication::inputMethod()->setVisible(visible);
498}
499
500void WebView::CommonInit(OxideQFindController* find_controller) {408void WebView::CommonInit(OxideQFindController* find_controller) {
501 content::WebContents* contents = view_->GetWebContents();409 content::WebContents* contents = view_->GetWebContents();
502410
@@ -524,6 +432,10 @@
524 OxideQWebPreferencesPrivate::get(p)->preferences());432 OxideQWebPreferencesPrivate::get(p)->preferences());
525}433}
526434
435void WebView::SetInputMethodEnabled(bool enabled) {
436 client_->SetInputMethodEnabled(enabled);
437}
438
527blink::WebScreenInfo WebView::GetScreenInfo() const {439blink::WebScreenInfo WebView::GetScreenInfo() const {
528 QScreen* screen = client_->GetScreen();440 QScreen* screen = client_->GetScreen();
529 if (!screen) {441 if (!screen) {
@@ -549,15 +461,6 @@
549 return client_->HasFocus();461 return client_->HasFocus();
550}462}
551463
552bool WebView::IsInputPanelVisible() const {
553 QInputMethod* im = QGuiApplication::inputMethod();
554 if (!im) {
555 return false;
556 }
557
558 return im->isVisible();
559}
560
561oxide::JavaScriptDialog* WebView::CreateJavaScriptDialog(464oxide::JavaScriptDialog* WebView::CreateJavaScriptDialog(
562 content::JavaScriptMessageType javascript_message_type) {465 content::JavaScriptMessageType javascript_message_type) {
563 JavaScriptDialogProxyClient::Type type;466 JavaScriptDialogProxyClient::Type type;
@@ -918,77 +821,8 @@
918 client_->EvictCurrentFrame();821 client_->EvictCurrentFrame();
919}822}
920823
921void WebView::TextInputStateChanged() {824oxide::InputMethodContext* WebView::GetInputMethodContext() const {
922 if (!HasFocus()) {825 return input_method_context_.get();
923 return;
924 }
925
926 if (view_->text_input_type() != ui::TEXT_INPUT_TYPE_NONE) {
927 QGuiApplication::inputMethod()->update(
928 static_cast<Qt::InputMethodQueries>(Qt::ImQueryInput | Qt::ImHints));
929 }
930
931 if (ShouldShowInputPanel()) {
932 SetInputPanelVisibility(true);
933 } else if (ShouldHideInputPanel()) {
934 SetInputPanelVisibility(false);
935 }
936}
937
938void WebView::FocusedNodeChanged() {
939 // Work around for https://launchpad.net/bugs/1323743
940 if (QGuiApplication::focusWindow() &&
941 QGuiApplication::focusWindow()->focusObject()) {
942 QGuiApplication::focusWindow()->focusObjectChanged(
943 QGuiApplication::focusWindow()->focusObject());
944 }
945
946 if (ShouldHideInputPanel() && HasFocus()) {
947 SetInputPanelVisibility(false);
948 } else if (!has_input_method_state_ && ShouldShowInputPanel()) {
949 SetInputPanelVisibility(true);
950 } else if (has_input_method_state_ && view_->focused_node_is_editable()) {
951 QGuiApplication::inputMethod()->reset();
952 }
953}
954
955void WebView::SelectionBoundsChanged() {
956 if (!HasFocus()) {
957 return;
958 }
959
960 QGuiApplication::inputMethod()->update(
961 static_cast<Qt::InputMethodQueries>(
962 Qt::ImCursorRectangle
963 | Qt::ImCursorPosition
964 | Qt::ImAnchorPosition
965#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
966 | Qt::ImTextBeforeCursor
967 | Qt::ImTextAfterCursor
968#endif
969 ));
970}
971
972void WebView::ImeCancelComposition() {
973 if (has_input_method_state_) {
974 QGuiApplication::inputMethod()->reset();
975 }
976}
977
978void WebView::SelectionChanged() {
979 if (!HasFocus()) {
980 return;
981 }
982
983 QGuiApplication::inputMethod()->update(
984 static_cast<Qt::InputMethodQueries>(
985 Qt::ImSurroundingText
986 | Qt::ImCurrentSelection
987#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
988 | Qt::ImTextBeforeCursor
989 | Qt::ImTextAfterCursor
990#endif
991 ));
992}826}
993827
994void WebView::UpdateCursor(const content::WebCursor& cursor) {828void WebView::UpdateCursor(const content::WebCursor& cursor) {
@@ -1189,10 +1023,7 @@
1189}1023}
11901024
1191void WebView::handleFocusEvent(QFocusEvent* event) {1025void WebView::handleFocusEvent(QFocusEvent* event) {
1192 if (event->gotFocus() && ShouldShowInputPanel()) {1026 input_method_context_->FocusChanged(event);
1193 SetInputPanelVisibility(true);
1194 }
1195
1196 view_->FocusChanged();1027 view_->FocusChanged();
1197}1028}
11981029
@@ -1208,62 +1039,7 @@
1208}1039}
12091040
1210void WebView::handleInputMethodEvent(QInputMethodEvent* event) {1041void WebView::handleInputMethodEvent(QInputMethodEvent* event) {
1211 QString commit_string = event->commitString();1042 input_method_context_->HandleEvent(event);
1212
1213 if (!commit_string.isEmpty()) {
1214 gfx::Range replacement_range = gfx::Range::InvalidRange();
1215 if (event->replacementLength() > 0) {
1216 replacement_range.set_start(event->replacementStart());
1217 replacement_range.set_end(event->replacementStart() +
1218 event->replacementLength());
1219 }
1220 view_->ImeCommitText(base::UTF8ToUTF16(commit_string.toStdString()),
1221 replacement_range);
1222 }
1223
1224 QString preedit_string = event->preeditString();
1225
1226 std::vector<blink::WebCompositionUnderline> underlines;
1227 int cursor_position = -1;
1228 gfx::Range selection_range = gfx::Range::InvalidRange();
1229
1230 Q_FOREACH (const QInputMethodEvent::Attribute& attribute, event->attributes()) {
1231 switch (attribute.type) {
1232 case QInputMethodEvent::Cursor:
1233 if (attribute.length > 0) {
1234 cursor_position = attribute.start;
1235 }
1236 break;
1237 case QInputMethodEvent::Selection:
1238 selection_range.set_start(
1239 qMin(attribute.start, (attribute.start + attribute.length)));
1240 selection_range.set_end(
1241 qMax(attribute.start, (attribute.start + attribute.length)));
1242 break;
1243 case QInputMethodEvent::TextFormat: {
1244 QTextCharFormat format =
1245 attribute.value.value<QTextFormat>().toCharFormat();
1246 blink::WebColor color = format.underlineColor().rgba();
1247 int start = qMin(attribute.start, (attribute.start + attribute.length));
1248 int end = qMax(attribute.start, (attribute.start + attribute.length));
1249 blink::WebCompositionUnderline underline(
1250 start, end, color, false, SK_ColorTRANSPARENT);
1251 underlines.push_back(underline);
1252 break;
1253 }
1254 default:
1255 break;
1256 }
1257 }
1258
1259 if (!selection_range.IsValid()) {
1260 selection_range = gfx::Range(
1261 cursor_position > 0 ? cursor_position : preedit_string.length());
1262 }
1263 view_->ImeSetComposingText(base::UTF8ToUTF16(preedit_string.toStdString()),
1264 underlines, selection_range);
1265
1266 has_input_method_state_ = !preedit_string.isEmpty();
1267}1043}
12681044
1269void WebView::handleKeyEvent(QKeyEvent* event) {1045void WebView::handleKeyEvent(QKeyEvent* event) {
@@ -1313,42 +1089,7 @@
1313}1089}
13141090
1315QVariant WebView::inputMethodQuery(Qt::InputMethodQuery query) const {1091QVariant WebView::inputMethodQuery(Qt::InputMethodQuery query) const {
1316 switch (query) {1092 return input_method_context_->Query(query);
1317 case Qt::ImHints:
1318 return QVariant(QImHintsFromInputType(view_->text_input_type()));
1319 case Qt::ImCursorRectangle: {
1320 // XXX: Is this in the right coordinate space?
1321 return QRect(view_->caret_rect().x(), view_->caret_rect().y(),
1322 view_->caret_rect().width(), view_->caret_rect().height());
1323 }
1324 case Qt::ImCursorPosition:
1325 return static_cast<int>(view_->selection_cursor_position() & INT_MAX);
1326 case Qt::ImSurroundingText:
1327 return QString::fromStdString(base::UTF16ToUTF8(view_->GetSelectionText()));
1328 case Qt::ImCurrentSelection:
1329 return QString::fromStdString(base::UTF16ToUTF8(view_->GetSelectedText()));
1330 case Qt::ImAnchorPosition:
1331 return static_cast<int>(view_->selection_anchor_position() & INT_MAX);
1332#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
1333 case Qt::ImTextBeforeCursor: {
1334 std::string text = base::UTF16ToUTF8(view_->GetSelectionText());
1335 return QString::fromStdString(
1336 text.substr(0, view_->selection_cursor_position()));
1337 }
1338 case Qt::ImTextAfterCursor: {
1339 std::string text = base::UTF16ToUTF8(view_->GetSelectionText());
1340 if (view_->selection_cursor_position() > text.length()) {
1341 return QString();
1342 }
1343 return QString::fromStdString(
1344 text.substr(view_->selection_cursor_position(), std::string::npos));
1345 }
1346#endif
1347 default:
1348 break;
1349 }
1350
1351 return QVariant();
1352}1093}
13531094
1354void WebView::goBack() {1095void WebView::goBack() {
@@ -1689,13 +1430,10 @@
1689WebView::~WebView() {1430WebView::~WebView() {
1690 DCHECK(frame_tree_torn_down_);1431 DCHECK(frame_tree_torn_down_);
16911432
1433 input_method_context_->DetachClient();
1434
1692 oxide::PermissionRequestDispatcher::FromWebContents(1435 oxide::PermissionRequestDispatcher::FromWebContents(
1693 view_->GetWebContents())->set_client(nullptr);1436 view_->GetWebContents())->set_client(nullptr);
1694
1695 QInputMethod* im = QGuiApplication::inputMethod();
1696 if (im) {
1697 im->disconnect(this);
1698 }
1699}1437}
17001438
1701// static1439// static
17021440
=== modified file 'qt/core/browser/oxide_qt_web_view.h'
--- qt/core/browser/oxide_qt_web_view.h 2015-10-16 21:36:30 +0000
+++ qt/core/browser/oxide_qt_web_view.h 2015-10-21 17:31:00 +0000
@@ -20,7 +20,6 @@
2020
21#include <QKeyEvent>21#include <QKeyEvent>
22#include <QList>22#include <QList>
23#include <QObject>
24#include <QPointer>23#include <QPointer>
25#include <QSharedPointer>24#include <QSharedPointer>
26#include <QtGlobal>25#include <QtGlobal>
@@ -28,6 +27,7 @@
28#include "base/macros.h"27#include "base/macros.h"
29#include "base/memory/scoped_ptr.h"28#include "base/memory/scoped_ptr.h"
3029
30#include "qt/core/browser/input/oxide_qt_input_method_context_client.h"
31#include "qt/core/browser/oxide_qt_event_utils.h"31#include "qt/core/browser/oxide_qt_event_utils.h"
32#include "qt/core/glue/oxide_qt_web_view_proxy.h"32#include "qt/core/glue/oxide_qt_web_view_proxy.h"
33#include "shared/browser/oxide_javascript_dialog_manager.h"33#include "shared/browser/oxide_javascript_dialog_manager.h"
@@ -53,16 +53,15 @@
53namespace qt {53namespace qt {
5454
55class CompositorFrameHandle;55class CompositorFrameHandle;
56class InputMethodContext;
56class WebContext;57class WebContext;
57class WebViewProxyClient;58class WebViewProxyClient;
5859
59class WebView : public QObject,60class WebView : public InputMethodContextClient,
60 public oxide::WebViewClient,61 public oxide::WebViewClient,
61 public oxide::PermissionRequestDispatcherClient,62 public oxide::PermissionRequestDispatcherClient,
62 public oxide::WebFrameTreeObserver,63 public oxide::WebFrameTreeObserver,
63 public WebViewProxy {64 public WebViewProxy {
64 Q_OBJECT
65
66 public:65 public:
67 WebView(WebViewProxyClient* client,66 WebView(WebViewProxyClient* client,
68 OxideQFindController* find_controller,67 OxideQFindController* find_controller,
@@ -85,29 +84,24 @@
8584
86 const oxide::SecurityStatus& GetSecurityStatus() const;85 const oxide::SecurityStatus& GetSecurityStatus() const;
8786
88 private Q_SLOTS:
89 void OnInputPanelVisibilityChanged();
90
91 private:87 private:
92 WebView(WebViewProxyClient* client,88 WebView(WebViewProxyClient* client,
93 OxideQSecurityStatus* security_status);89 OxideQSecurityStatus* security_status);
9490
95 float GetDeviceScaleFactor() const;91 float GetDeviceScaleFactor() const;
9692
97 bool ShouldShowInputPanel() const;
98 bool ShouldHideInputPanel() const;
99 void SetInputPanelVisibility(bool visible);
100
101 void CommonInit(OxideQFindController* find_controller);93 void CommonInit(OxideQFindController* find_controller);
10294
103 void EnsurePreferences();95 void EnsurePreferences();
10496
97 // InputMethodContextClient implementation
98 void SetInputMethodEnabled(bool enabled);
99
105 // oxide::WebViewClient implementation100 // oxide::WebViewClient implementation
106 blink::WebScreenInfo GetScreenInfo() const override;101 blink::WebScreenInfo GetScreenInfo() const override;
107 gfx::Rect GetViewBoundsPix() const override;102 gfx::Rect GetViewBoundsPix() const override;
108 bool IsVisible() const override;103 bool IsVisible() const override;
109 bool HasFocus() const override;104 bool HasFocus() const override;
110 bool IsInputPanelVisible() const override;
111 oxide::JavaScriptDialog* CreateJavaScriptDialog(105 oxide::JavaScriptDialog* CreateJavaScriptDialog(
112 content::JavaScriptMessageType javascript_message_type) override;106 content::JavaScriptMessageType javascript_message_type) override;
113 oxide::JavaScriptDialog* CreateBeforeUnloadDialog() override;107 oxide::JavaScriptDialog* CreateBeforeUnloadDialog() override;
@@ -169,11 +163,7 @@
169 oxide::FilePicker* CreateFilePicker(content::RenderViewHost* rvh) override;163 oxide::FilePicker* CreateFilePicker(content::RenderViewHost* rvh) override;
170 void SwapCompositorFrame() override;164 void SwapCompositorFrame() override;
171 void EvictCurrentFrame() override;165 void EvictCurrentFrame() override;
172 void TextInputStateChanged() override;166 oxide::InputMethodContext* GetInputMethodContext() const override;
173 void FocusedNodeChanged() override;
174 void SelectionBoundsChanged() override;
175 void ImeCancelComposition() override;
176 void SelectionChanged() override;
177 void UpdateCursor(const content::WebCursor& cursor) override;167 void UpdateCursor(const content::WebCursor& cursor) override;
178 void SecurityStatusChanged(const oxide::SecurityStatus& old) override;168 void SecurityStatusChanged(const oxide::SecurityStatus& old) override;
179 void OnCertificateError(scoped_ptr<oxide::CertificateError> error) override;169 void OnCertificateError(scoped_ptr<oxide::CertificateError> error) override;
@@ -293,12 +283,13 @@
293283
294 void teardownFrameTree() override;284 void teardownFrameTree() override;
295285
286 // This must outlive |view_|
287 scoped_ptr<InputMethodContext> input_method_context_;
288
296 scoped_ptr<oxide::WebView> view_;289 scoped_ptr<oxide::WebView> view_;
297290
298 WebViewProxyClient* client_;291 WebViewProxyClient* client_;
299292
300 bool has_input_method_state_;
301
302 QPointer<OxideQSecurityStatus> security_status_;293 QPointer<OxideQSecurityStatus> security_status_;
303 QList<ScriptMessageHandlerProxyHandle*> message_handlers_;294 QList<ScriptMessageHandlerProxyHandle*> message_handlers_;
304295
305296
=== modified file 'qt/core/core.gyp'
--- qt/core/core.gyp 2015-09-20 08:39:19 +0000
+++ qt/core/core.gyp 2015-10-21 17:31:00 +0000
@@ -61,13 +61,16 @@
61 ],61 ],
62 'sources': [62 'sources': [
63 '<(INTERMEDIATE_DIR)/moc_oxide_qt_browser_platform_integration.cc',63 '<(INTERMEDIATE_DIR)/moc_oxide_qt_browser_platform_integration.cc',
64 '<(INTERMEDIATE_DIR)/moc_oxide_qt_web_view.cc',64 '<(INTERMEDIATE_DIR)/moc_oxide_qt_input_method_context.cc',
65 'api/internal/oxideqmediacapturedevices_p.cc',65 'api/internal/oxideqmediacapturedevices_p.cc',
66 'api/internal/oxideqwebpreferences_p.cc',66 'api/internal/oxideqwebpreferences_p.cc',
67 'app/oxide_qt_main.cc',67 'app/oxide_qt_main.cc',
68 'app/oxide_qt_main.h',68 'app/oxide_qt_main.h',
69 'app/oxide_qt_platform_delegate.cc',69 'app/oxide_qt_platform_delegate.cc',
70 'app/oxide_qt_platform_delegate.h',70 'app/oxide_qt_platform_delegate.h',
71 'browser/input/oxide_qt_input_method_context.cc',
72 'browser/input/oxide_qt_input_method_context.h',
73 'browser/input/oxide_qt_input_method_context_client.h',
71 'browser/oxide_qt_browser_platform_integration.cc',74 'browser/oxide_qt_browser_platform_integration.cc',
72 'browser/oxide_qt_browser_platform_integration.h',75 'browser/oxide_qt_browser_platform_integration.h',
73 'browser/oxide_qt_browser_startup.cc',76 'browser/oxide_qt_browser_startup.cc',
@@ -179,8 +182,8 @@
179 'includes': [ 'moc.gypi' ]182 'includes': [ 'moc.gypi' ]
180 },183 },
181 {184 {
182 'action_name': 'moc_oxide_qt_web_view.cc',185 'action_name': 'moc_oxide_qt_input_method_context.cc',
183 'moc_input': 'browser/oxide_qt_web_view.h',186 'moc_input': 'browser/input/oxide_qt_input_method_context.h',
184 'includes': [ 'moc.gypi' ]187 'includes': [ 'moc.gypi' ]
185 },188 },
186 ],189 ],
187190
=== modified file 'shared/browser/compositor/oxide_compositor.cc'
--- shared/browser/compositor/oxide_compositor.cc 2015-10-09 09:27:28 +0000
+++ shared/browser/compositor/oxide_compositor.cc 2015-10-21 17:31:00 +0000
@@ -40,6 +40,7 @@
40#include "oxide_compositor_client.h"40#include "oxide_compositor_client.h"
41#include "oxide_compositor_frame_data.h"41#include "oxide_compositor_frame_data.h"
42#include "oxide_compositor_frame_handle.h"42#include "oxide_compositor_frame_handle.h"
43#include "oxide_compositor_observer.h"
43#include "oxide_compositor_output_surface_gl.h"44#include "oxide_compositor_output_surface_gl.h"
44#include "oxide_compositor_output_surface_software.h"45#include "oxide_compositor_output_surface_software.h"
45#include "oxide_compositor_software_output_device.h"46#include "oxide_compositor_software_output_device.h"
@@ -87,7 +88,6 @@
87 root_layer_(cc::Layer::Create(cc::LayerSettings())),88 root_layer_(cc::Layer::Create(cc::LayerSettings())),
88 proxy_(new CompositorThreadProxy(this)),89 proxy_(new CompositorThreadProxy(this)),
89 next_output_surface_id_(1),90 next_output_surface_id_(1),
90 lock_count_(0),
91 weak_factory_(this) {91 weak_factory_(this) {
92 DCHECK(CalledOnValidThread());92 DCHECK(CalledOnValidThread());
93}93}
@@ -103,29 +103,6 @@
103 client_->CompositorSwapFrame(handle.get());103 client_->CompositorSwapFrame(handle.get());
104}104}
105105
106void Compositor::LockCompositor() {
107 DCHECK(CalledOnValidThread());
108 if (lock_count_++ > 0) {
109 return;
110 }
111
112 if (layer_tree_host_) {
113 layer_tree_host_->SetDeferCommits(true);
114 }
115}
116
117void Compositor::UnlockCompositor() {
118 DCHECK(CalledOnValidThread());
119 DCHECK(lock_count_ > 0);
120 if (--lock_count_ > 0) {
121 return;
122 }
123
124 if (layer_tree_host_) {
125 layer_tree_host_->SetDeferCommits(false);
126 }
127}
128
129scoped_ptr<cc::OutputSurface> Compositor::CreateOutputSurface() {106scoped_ptr<cc::OutputSurface> Compositor::CreateOutputSurface() {
130 DCHECK(CalledOnValidThread());107 DCHECK(CalledOnValidThread());
131108
@@ -155,6 +132,14 @@
155 return output.Pass();132 return output.Pass();
156}133}
157134
135void Compositor::AddObserver(CompositorObserver* observer) {
136 observers_.AddObserver(observer);
137}
138
139void Compositor::RemoveObserver(CompositorObserver* observer) {
140 observers_.RemoveObserver(observer);
141}
142
158void Compositor::WillBeginMainFrame() {}143void Compositor::WillBeginMainFrame() {}
159void Compositor::BeginMainFrame(const cc::BeginFrameArgs& args) {}144void Compositor::BeginMainFrame(const cc::BeginFrameArgs& args) {}
160void Compositor::BeginMainFrameNotExpectedSoon() {}145void Compositor::BeginMainFrameNotExpectedSoon() {}
@@ -194,7 +179,7 @@
194void Compositor::WillCommit() {}179void Compositor::WillCommit() {}
195180
196void Compositor::DidCommit() {181void Compositor::DidCommit() {
197 client_->CompositorDidCommit();182 FOR_EACH_OBSERVER(CompositorObserver, observers_, CompositorDidCommit());
198}183}
199184
200void Compositor::DidCommitAndDrawFrame() {}185void Compositor::DidCommitAndDrawFrame() {}
@@ -214,7 +199,7 @@
214}199}
215200
216Compositor::~Compositor() {201Compositor::~Compositor() {
217 CHECK_EQ(lock_count_, 0U);202 FOR_EACH_OBSERVER(CompositorObserver, observers_, OnCompositorDestruction());
218 proxy_->CompositorDestroyed();203 proxy_->CompositorDestroyed();
219}204}
220205
@@ -249,15 +234,15 @@
249 layer_tree_host_->SetVisible(true);234 layer_tree_host_->SetVisible(true);
250 layer_tree_host_->SetViewportSize(size_);235 layer_tree_host_->SetViewportSize(size_);
251 layer_tree_host_->SetDeviceScaleFactor(device_scale_factor_);236 layer_tree_host_->SetDeviceScaleFactor(device_scale_factor_);
252
253 if (lock_count_ > 0) {
254 layer_tree_host_->SetDeferCommits(true);
255 }
256 }237 }
257}238}
258239
259void Compositor::SetDeviceScaleFactor(float scale) {240void Compositor::SetDeviceScaleFactor(float scale) {
260 DCHECK(CalledOnValidThread());241 DCHECK(CalledOnValidThread());
242 if (scale == device_scale_factor_) {
243 return;
244 }
245
261 device_scale_factor_ = scale;246 device_scale_factor_ = scale;
262247
263 if (layer_tree_host_) {248 if (layer_tree_host_) {
@@ -281,6 +266,7 @@
281266
282void Compositor::SetRootLayer(scoped_refptr<cc::Layer> layer) {267void Compositor::SetRootLayer(scoped_refptr<cc::Layer> layer) {
283 DCHECK(CalledOnValidThread());268 DCHECK(CalledOnValidThread());
269
284 root_layer_->RemoveAllChildren();270 root_layer_->RemoveAllChildren();
285 if (layer.get()) {271 if (layer.get()) {
286 root_layer_->AddChild(layer);272 root_layer_->AddChild(layer);
287273
=== modified file 'shared/browser/compositor/oxide_compositor.h'
--- shared/browser/compositor/oxide_compositor.h 2015-08-14 16:32:46 +0000
+++ shared/browser/compositor/oxide_compositor.h 2015-10-21 17:31:00 +0000
@@ -23,6 +23,7 @@
23#include "base/memory/scoped_ptr.h"23#include "base/memory/scoped_ptr.h"
24#include "base/memory/scoped_vector.h"24#include "base/memory/scoped_vector.h"
25#include "base/memory/weak_ptr.h"25#include "base/memory/weak_ptr.h"
26#include "base/observer_list.h"
26#include "base/threading/non_thread_safe.h"27#include "base/threading/non_thread_safe.h"
27#include "cc/trees/layer_tree_host_client.h"28#include "cc/trees/layer_tree_host_client.h"
28#include "ui/gfx/geometry/size.h"29#include "ui/gfx/geometry/size.h"
@@ -41,7 +42,7 @@
41class CompositorClient;42class CompositorClient;
42class CompositorFrameData;43class CompositorFrameData;
43class CompositorFrameHandle;44class CompositorFrameHandle;
44class CompositorLock;45class CompositorObserver;
45class CompositorThreadProxy;46class CompositorThreadProxy;
4647
47class Compositor final : public cc::LayerTreeHostClient,48class Compositor final : public cc::LayerTreeHostClient,
@@ -63,18 +64,18 @@
63 FrameHandleVector returned_frames);64 FrameHandleVector returned_frames);
6465
65 private:66 private:
66 friend class CompositorLock;67 friend class CompositorObserver;
67 friend class CompositorThreadProxy;68 friend class CompositorThreadProxy;
6869
69 Compositor(CompositorClient* client);70 Compositor(CompositorClient* client);
7071
71 void SendSwapCompositorFrameToClient(scoped_ptr<CompositorFrameData> frame);72 void SendSwapCompositorFrameToClient(scoped_ptr<CompositorFrameData> frame);
7273
73 void LockCompositor();
74 void UnlockCompositor();
75
76 scoped_ptr<cc::OutputSurface> CreateOutputSurface();74 scoped_ptr<cc::OutputSurface> CreateOutputSurface();
7775
76 void AddObserver(CompositorObserver* observer);
77 void RemoveObserver(CompositorObserver* observer);
78
78 // cc::LayerTreeHostClient implementation79 // cc::LayerTreeHostClient implementation
79 void WillBeginMainFrame() final;80 void WillBeginMainFrame() final;
80 void BeginMainFrame(const cc::BeginFrameArgs& args) final;81 void BeginMainFrame(const cc::BeginFrameArgs& args) final;
@@ -112,34 +113,13 @@
112113
113 uint32 next_output_surface_id_;114 uint32 next_output_surface_id_;
114115
115 uint32 lock_count_;116 base::ObserverList<CompositorObserver> observers_;
116117
117 base::WeakPtrFactory<Compositor> weak_factory_;118 base::WeakPtrFactory<Compositor> weak_factory_;
118119
119 DISALLOW_COPY_AND_ASSIGN(Compositor);120 DISALLOW_COPY_AND_ASSIGN(Compositor);
120};121};
121122
122class CompositorLock final {
123 public:
124 CompositorLock(Compositor* compositor)
125 : compositor_(compositor) {
126 if (compositor_) {
127 compositor_->LockCompositor();
128 }
129 }
130
131 ~CompositorLock() {
132 if (compositor_) {
133 compositor_->UnlockCompositor();
134 }
135 }
136
137 private:
138 Compositor* compositor_;
139
140 DISALLOW_COPY_AND_ASSIGN(CompositorLock);
141};
142
143} // namespace oxide123} // namespace oxide
144124
145#endif // _OXIDE_SHARED_BROWSER_COMPOSITOR_COMPOSITOR_H_125#endif // _OXIDE_SHARED_BROWSER_COMPOSITOR_COMPOSITOR_H_
146126
=== modified file 'shared/browser/compositor/oxide_compositor_client.h'
--- shared/browser/compositor/oxide_compositor_client.h 2015-08-14 16:32:46 +0000
+++ shared/browser/compositor/oxide_compositor_client.h 2015-10-21 17:31:00 +0000
@@ -28,8 +28,6 @@
28 public:28 public:
29 virtual ~CompositorClient() {}29 virtual ~CompositorClient() {}
3030
31 virtual void CompositorDidCommit() = 0;
32
33 virtual void CompositorSwapFrame(CompositorFrameHandle* handle) = 0;31 virtual void CompositorSwapFrame(CompositorFrameHandle* handle) = 0;
34};32};
3533
3634
=== added file 'shared/browser/compositor/oxide_compositor_observer.cc'
--- shared/browser/compositor/oxide_compositor_observer.cc 1970-01-01 00:00:00 +0000
+++ shared/browser/compositor/oxide_compositor_observer.cc 2015-10-21 17:31:00 +0000
@@ -0,0 +1,60 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#include "oxide_compositor_observer.h"
19
20#include "oxide_compositor.h"
21
22namespace oxide {
23
24CompositorObserver::CompositorObserver()
25 : compositor_(nullptr) {}
26
27CompositorObserver::CompositorObserver(Compositor* compositor)
28 : compositor_(compositor) {
29 if (compositor_) {
30 compositor_->AddObserver(this);
31 }
32}
33
34void CompositorObserver::Observe(Compositor* compositor) {
35 if (compositor == compositor_) {
36 return;
37 }
38
39 if (compositor_) {
40 compositor_->RemoveObserver(this);
41 }
42 compositor_ = compositor;
43 if (compositor_) {
44 compositor_->AddObserver(this);
45 }
46}
47
48void CompositorObserver::OnCompositorDestruction() {
49 compositor_ = nullptr;
50}
51
52CompositorObserver::~CompositorObserver() {
53 if (compositor_) {
54 compositor_->RemoveObserver(this);
55 }
56}
57
58void CompositorObserver::CompositorDidCommit() {}
59
60} // namespace oxide
061
=== added file 'shared/browser/compositor/oxide_compositor_observer.h'
--- shared/browser/compositor/oxide_compositor_observer.h 1970-01-01 00:00:00 +0000
+++ shared/browser/compositor/oxide_compositor_observer.h 2015-10-21 17:31:00 +0000
@@ -0,0 +1,49 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#ifndef _OXIDE_SHARED_BROWSER_COMPOSITOR_COMPOSITOR_OBSERVER_H_
19#define _OXIDE_SHARED_BROWSER_COMPOSITOR_COMPOSITOR_OBSERVER_H_
20
21namespace oxide {
22
23class Compositor;
24
25class CompositorObserver {
26 public:
27 virtual ~CompositorObserver();
28
29 virtual void CompositorDidCommit();
30
31 protected:
32 CompositorObserver();
33 CompositorObserver(Compositor* compositor);
34
35 void Observe(Compositor* compositor);
36
37 Compositor* compositor() const { return compositor_; }
38
39 private:
40 friend class Compositor;
41
42 void OnCompositorDestruction();
43
44 Compositor* compositor_;
45};
46
47} // namespace oxide
48
49#endif // _OXIDE_SHARED_BROWSER_COMPOSITOR_COMPOSITOR_OBSERVER_H_
050
=== added directory 'shared/browser/input'
=== added file 'shared/browser/input/oxide_ime_bridge.cc'
--- shared/browser/input/oxide_ime_bridge.cc 1970-01-01 00:00:00 +0000
+++ shared/browser/input/oxide_ime_bridge.cc 2015-10-21 17:31:00 +0000
@@ -0,0 +1,31 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#include "oxide_ime_bridge.h"
19
20namespace oxide {
21
22ImeBridge::ImeBridge()
23 : text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
24 show_ime_if_needed_(false),
25 selection_cursor_position_(0),
26 selection_anchor_position_(0),
27 focused_node_is_editable_(false) {}
28
29ImeBridge::~ImeBridge() {}
30
31} // namespace oxide
032
=== added file 'shared/browser/input/oxide_ime_bridge.h'
--- shared/browser/input/oxide_ime_bridge.h 1970-01-01 00:00:00 +0000
+++ shared/browser/input/oxide_ime_bridge.h 2015-10-21 17:31:00 +0000
@@ -0,0 +1,84 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#ifndef _OXIDE_SHARED_BROWSER_INPUT_IME_BRIDGE_H_
19#define _OXIDE_SHARED_BROWSER_INPUT_IME_BRIDGE_H_
20
21#include <vector>
22
23#include "base/macros.h"
24#include "base/strings/string16.h"
25#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
26#include "ui/base/ime/text_input_type.h"
27#include "ui/gfx/geometry/rect.h"
28
29namespace gfx {
30class Range;
31}
32
33namespace oxide {
34
35// This class contains state for a particular RWHV. InputMethodContext is
36// connected to one ImeBridge
37class ImeBridge {
38 public:
39 ImeBridge();
40 virtual ~ImeBridge();
41
42 ui::TextInputType text_input_type() const { return text_input_type_; }
43
44 bool show_ime_if_needed() const { return show_ime_if_needed_; }
45
46 gfx::Rect caret_rect() const { return caret_rect_; }
47
48 size_t selection_cursor_position() const {
49 return selection_cursor_position_;
50 }
51
52 size_t selection_anchor_position() const {
53 return selection_anchor_position_;
54 }
55
56 bool focused_node_is_editable() const {
57 return focused_node_is_editable_;
58 }
59
60 virtual base::string16 GetSelectionText() const = 0;
61 virtual base::string16 GetSelectedText() const = 0;
62
63 virtual void CommitText(const base::string16& text,
64 const gfx::Range& replacement_range) = 0;
65 virtual void SetComposingText(
66 const base::string16& text,
67 const std::vector<blink::WebCompositionUnderline>& underlines,
68 const gfx::Range& selection_range) = 0;
69
70 protected:
71 ui::TextInputType text_input_type_;
72 bool show_ime_if_needed_;
73 gfx::Rect caret_rect_;
74 size_t selection_cursor_position_;
75 size_t selection_anchor_position_;
76 bool focused_node_is_editable_;
77
78 private:
79 DISALLOW_COPY_AND_ASSIGN(ImeBridge);
80};
81
82} // namespace oxide
83
84#endif // _OXIDE_SHARED_BROWSER_INPUT_IME_BRIDGE_H_
085
=== added file 'shared/browser/input/oxide_ime_bridge_impl.cc'
--- shared/browser/input/oxide_ime_bridge_impl.cc 1970-01-01 00:00:00 +0000
+++ shared/browser/input/oxide_ime_bridge_impl.cc 2015-10-21 17:31:00 +0000
@@ -0,0 +1,157 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#include "oxide_ime_bridge_impl.h"
19
20#include "content/browser/renderer_host/render_widget_host_impl.h"
21#include "content/public/browser/native_web_keyboard_event.h"
22#include "third_party/WebKit/public/web/WebInputEvent.h"
23#include "ui/events/keycodes/keyboard_codes.h"
24
25#include "shared/browser/oxide_render_widget_host_view.h"
26
27#include "oxide_input_method_context.h"
28
29namespace oxide {
30
31namespace {
32
33// Qt input methods don’t generate key events, but a lot of web pages out there
34// rely on keydown and keyup events to e.g. perform search-as-you-type or
35// enable/disable a submit button based on the contents of a text input field,
36// so we send a fake pair of keydown/keyup events.
37// This mimicks what is done in GtkIMContextWrapper::HandlePreeditChanged(…)
38// and GtkIMContextWrapper::HandleCommit(…)
39// (see content/browser/renderer_host/gtk_im_context_wrapper.cc).
40void SendFakeCompositionKeyEvent(content::RenderWidgetHostImpl* host,
41 blink::WebInputEvent::Type type) {
42 content::NativeWebKeyboardEvent fake_event;
43 fake_event.windowsKeyCode = ui::VKEY_PROCESSKEY;
44 fake_event.skip_in_browser = true;
45 fake_event.type = type;
46 host->ForwardKeyboardEvent(fake_event);
47}
48
49}
50
51base::string16 ImeBridgeImpl::GetSelectionText() const {
52 return rwhv_->selection_text();
53}
54
55base::string16 ImeBridgeImpl::GetSelectedText() const {
56 return rwhv_->GetSelectedText();
57}
58
59void ImeBridgeImpl::CommitText(const base::string16& text,
60 const gfx::Range& replacement_range) {
61 if (!rwhv_->host()) {
62 return;
63 }
64
65 SendFakeCompositionKeyEvent(rwhv_->host(), blink::WebInputEvent::RawKeyDown);
66 rwhv_->host()->ImeConfirmComposition(text, replacement_range, false);
67 SendFakeCompositionKeyEvent(rwhv_->host(), blink::WebInputEvent::KeyUp);
68}
69
70void ImeBridgeImpl::SetComposingText(
71 const base::string16& text,
72 const std::vector<blink::WebCompositionUnderline>& underlines,
73 const gfx::Range& selection_range) {
74 if (!rwhv_->host()) {
75 return;
76 }
77
78 SendFakeCompositionKeyEvent(rwhv_->host(), blink::WebInputEvent::RawKeyDown);
79 rwhv_->host()->ImeSetComposition(text,
80 underlines,
81 selection_range.start(),
82 selection_range.end());
83 SendFakeCompositionKeyEvent(rwhv_->host(), blink::WebInputEvent::KeyUp);
84}
85
86ImeBridgeImpl::ImeBridgeImpl(RenderWidgetHostView* rwhv)
87 : rwhv_(rwhv),
88 context_(nullptr) {}
89
90ImeBridgeImpl::~ImeBridgeImpl() {
91 SetContext(nullptr);
92}
93
94void ImeBridgeImpl::SetContext(InputMethodContext* context) {
95 if (context_) {
96 DCHECK_EQ(context_->ime_bridge(), this);
97 context_->SetImeBridge(nullptr);
98 }
99 context_ = context;
100 if (context_) {
101 DCHECK(!context_->ime_bridge());
102 context_->SetImeBridge(this);
103 }
104}
105
106void ImeBridgeImpl::TextInputStateChanged(ui::TextInputType type,
107 bool show_ime_if_needed) {
108 if (type == text_input_type_ &&
109 show_ime_if_needed == show_ime_if_needed_) {
110 return;
111 }
112
113 text_input_type_ = type;
114 show_ime_if_needed_ = show_ime_if_needed;
115
116 if (!context_) {
117 return;
118 }
119
120 context_->TextInputStateChanged();
121}
122
123void ImeBridgeImpl::SelectionBoundsChanged(const gfx::Rect& caret_rect,
124 size_t selection_cursor_position,
125 size_t selection_anchor_position) {
126 if (caret_rect == caret_rect_ &&
127 selection_cursor_position == selection_cursor_position_ &&
128 selection_anchor_position == selection_anchor_position_) {
129 return;
130 }
131
132 caret_rect_ = caret_rect;
133 selection_cursor_position_ = selection_cursor_position;
134 selection_anchor_position_ = selection_anchor_position;
135
136 if (!context_) {
137 return;
138 }
139
140 context_->SelectionBoundsChanged();
141}
142
143void ImeBridgeImpl::FocusedNodeChanged(bool is_editable_node) {
144 if (is_editable_node == focused_node_is_editable_) {
145 return;
146 }
147
148 focused_node_is_editable_ = is_editable_node;
149
150 if (!context_) {
151 return;
152 }
153
154 context_->FocusedNodeChanged();
155}
156
157} // namespace oxide
0158
=== added file 'shared/browser/input/oxide_ime_bridge_impl.h'
--- shared/browser/input/oxide_ime_bridge_impl.h 1970-01-01 00:00:00 +0000
+++ shared/browser/input/oxide_ime_bridge_impl.h 2015-10-21 17:31:00 +0000
@@ -0,0 +1,69 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#ifndef _OXIDE_SHARED_BROWSER_INPUT_IME_BRIDGE_IMPL_H_
19#define _OXIDE_SHARED_BROWSER_INPUT_IME_BRIDGE_IMPL_H_
20
21#include "base/macros.h"
22#include "ui/base/ime/text_input_type.h"
23
24#include "shared/browser/input/oxide_ime_bridge.h"
25
26namespace gfx {
27class Rect;
28}
29
30namespace oxide {
31
32class InputMethodContext;
33class RenderWidgetHostView;
34
35class ImeBridgeImpl : public ImeBridge {
36 public:
37 ImeBridgeImpl(RenderWidgetHostView* rwhv);
38 ~ImeBridgeImpl() override;
39
40 InputMethodContext* context() const { return context_; }
41 void SetContext(InputMethodContext* context);
42
43 void TextInputStateChanged(ui::TextInputType type,
44 bool show_ime_if_needed);
45 void SelectionBoundsChanged(const gfx::Rect& caret_rect,
46 size_t selection_cursor_position,
47 size_t selection_anchor_position);
48 void FocusedNodeChanged(bool is_editable_node);
49
50 private:
51 base::string16 GetSelectionText() const override;
52 base::string16 GetSelectedText() const override;
53 void CommitText(const base::string16& text,
54 const gfx::Range& replacement_range) override;
55 void SetComposingText(
56 const base::string16& text,
57 const std::vector<blink::WebCompositionUnderline>& underlines,
58 const gfx::Range& selection_range) override;
59
60 RenderWidgetHostView* rwhv_; // Owns us
61
62 InputMethodContext* context_;
63
64 DISALLOW_COPY_AND_ASSIGN(ImeBridgeImpl);
65};
66
67} // namespace oxide
68
69#endif // _OXIDE_SHARED_BROWSER_INPUT_IME_BRIDGE_IMPL_H_
070
=== added file 'shared/browser/input/oxide_input_method_context.cc'
--- shared/browser/input/oxide_input_method_context.cc 1970-01-01 00:00:00 +0000
+++ shared/browser/input/oxide_input_method_context.cc 2015-10-21 17:31:00 +0000
@@ -0,0 +1,69 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#include "oxide_input_method_context.h"
19
20#include "oxide_input_method_context_observer.h"
21
22namespace oxide {
23
24void InputMethodContext::NotifyInputPanelVisibilityChanged() {
25 FOR_EACH_OBSERVER(InputMethodContextObserver,
26 observers_,
27 InputPanelVisibilityChanged());
28}
29
30void InputMethodContext::SetImeBridge(ImeBridge* bridge) {
31 ime_bridge_ = bridge;
32
33 CancelComposition();
34
35 // XXX: This is a bit of a hammer
36 TextInputStateChanged();
37 SelectionBoundsChanged();
38 SelectionChanged();
39 FocusedNodeChanged();
40}
41
42void InputMethodContext::AddObserver(InputMethodContextObserver* observer) {
43 observers_.AddObserver(observer);
44}
45
46void InputMethodContext::RemoveObserver(InputMethodContextObserver* observer) {
47 observers_.RemoveObserver(observer);
48}
49
50InputMethodContext::InputMethodContext()
51 : ime_bridge_(nullptr) {}
52
53InputMethodContext::~InputMethodContext() {
54 FOR_EACH_OBSERVER(InputMethodContextObserver,
55 observers_,
56 OnInputMethodContextDestruction());
57}
58
59bool InputMethodContext::IsInputPanelVisible() const {
60 return false;
61}
62
63void InputMethodContext::TextInputStateChanged() {}
64void InputMethodContext::SelectionBoundsChanged() {}
65void InputMethodContext::SelectionChanged() {}
66void InputMethodContext::CancelComposition() {}
67void InputMethodContext::FocusedNodeChanged() {}
68
69} // namespace oxide
070
=== added file 'shared/browser/input/oxide_input_method_context.h'
--- shared/browser/input/oxide_input_method_context.h 1970-01-01 00:00:00 +0000
+++ shared/browser/input/oxide_input_method_context.h 2015-10-21 17:31:00 +0000
@@ -0,0 +1,69 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#ifndef _OXIDE_SHARED_BROWSER_INPUT_INPUT_METHOD_CONTEXT_H_
19#define _OXIDE_SHARED_BROWSER_INPUT_INPUT_METHOD_CONTEXT_H_
20
21#include "base/macros.h"
22#include "base/observer_list.h"
23
24namespace oxide {
25
26class ImeBridge;
27class ImeBridgeImpl;
28class InputMethodContextObserver;
29
30// This class is the interface from ImeBridgeImpl to the toolkit provided
31// input method context, and provides a way for the toolkit layer to access
32// the currently connected ImeBridge
33class InputMethodContext {
34 public:
35 InputMethodContext();
36 virtual ~InputMethodContext();
37
38 virtual bool IsInputPanelVisible() const;
39
40 virtual void TextInputStateChanged();
41 virtual void SelectionBoundsChanged();
42 virtual void SelectionChanged();
43 virtual void CancelComposition();
44 virtual void FocusedNodeChanged();
45
46 protected:
47 ImeBridge* ime_bridge() const { return ime_bridge_; }
48
49 void NotifyInputPanelVisibilityChanged();
50
51 private:
52 friend class ImeBridgeImpl;
53 friend class InputMethodContextObserver;
54
55 void SetImeBridge(ImeBridge* bridge);
56
57 void AddObserver(InputMethodContextObserver* observer);
58 void RemoveObserver(InputMethodContextObserver* observer);
59
60 ImeBridge* ime_bridge_;
61
62 base::ObserverList<InputMethodContextObserver> observers_;
63
64 DISALLOW_COPY_AND_ASSIGN(InputMethodContext);
65};
66
67} // namespace oxide
68
69#endif // _OXIDE_SHARED_BROWSER_INPUT_INPUT_METHOD_CONTEXT_H_
070
=== added file 'shared/browser/input/oxide_input_method_context_observer.cc'
--- shared/browser/input/oxide_input_method_context_observer.cc 1970-01-01 00:00:00 +0000
+++ shared/browser/input/oxide_input_method_context_observer.cc 2015-10-21 17:31:00 +0000
@@ -0,0 +1,61 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#include "oxide_input_method_context_observer.h"
19
20#include "oxide_input_method_context.h"
21
22namespace oxide {
23
24InputMethodContextObserver::InputMethodContextObserver()
25 : im_context_(nullptr) {}
26
27InputMethodContextObserver::InputMethodContextObserver(
28 InputMethodContext* context)
29 : im_context_(context) {
30 if (context) {
31 context->AddObserver(this);
32 }
33}
34
35void InputMethodContextObserver::Observe(InputMethodContext* context) {
36 if (context == im_context_) {
37 return;
38 }
39
40 if (im_context_) {
41 im_context_->RemoveObserver(this);
42 }
43 im_context_ = context;
44 if (im_context_) {
45 im_context_->AddObserver(this);
46 }
47}
48
49void InputMethodContextObserver::OnInputMethodContextDestruction() {
50 im_context_ = nullptr;
51}
52
53InputMethodContextObserver::~InputMethodContextObserver() {
54 if (im_context_) {
55 im_context_->RemoveObserver(this);
56 }
57}
58
59void InputMethodContextObserver::InputPanelVisibilityChanged() {}
60
61} // namespace oxide
062
=== added file 'shared/browser/input/oxide_input_method_context_observer.h'
--- shared/browser/input/oxide_input_method_context_observer.h 1970-01-01 00:00:00 +0000
+++ shared/browser/input/oxide_input_method_context_observer.h 2015-10-21 17:31:00 +0000
@@ -0,0 +1,49 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#ifndef _OXIDE_SHARED_BROWSER_INPUT_INPUT_METHOD_CONTEXT_OBSERVER_H_
19#define _OXIDE_SHARED_BROWSER_INPUT_INPUT_METHOD_CONTEXT_OBSERVER_H_
20
21namespace oxide {
22
23class InputMethodContext;
24
25class InputMethodContextObserver {
26 public:
27 virtual ~InputMethodContextObserver();
28
29 virtual void InputPanelVisibilityChanged();
30
31 protected:
32 InputMethodContextObserver();
33 InputMethodContextObserver(InputMethodContext* context);
34
35 void Observe(InputMethodContext* context);
36
37 InputMethodContext* im_context() const { return im_context_; }
38
39 private:
40 friend class InputMethodContext;
41
42 void OnInputMethodContextDestruction();
43
44 InputMethodContext* im_context_;
45};
46
47} // namespace oxide
48
49#endif // _OXIDE_SHARED_BROWSER_INPUT_INPUT_METHOD_CONTEXT_OBSERVER_H_
050
=== modified file 'shared/browser/oxide_render_widget_host_view.cc'
--- shared/browser/oxide_render_widget_host_view.cc 2015-09-29 08:25:11 +0000
+++ shared/browser/oxide_render_widget_host_view.cc 2015-10-21 17:31:00 +0000
@@ -40,13 +40,13 @@
40#include "ui/gfx/geometry/size_conversions.h"40#include "ui/gfx/geometry/size_conversions.h"
4141
42#include "shared/browser/compositor/oxide_compositor.h"42#include "shared/browser/compositor/oxide_compositor.h"
43#include "shared/browser/compositor/oxide_compositor_utils.h"43#include "shared/browser/input/oxide_input_method_context.h"
4444
45#include "oxide_browser_platform_integration.h"45#include "oxide_browser_platform_integration.h"
46#include "oxide_browser_process_main.h"46#include "oxide_browser_process_main.h"
47#include "oxide_event_utils.h"47#include "oxide_event_utils.h"
48#include "oxide_renderer_frame_evictor.h"48#include "oxide_renderer_frame_evictor.h"
49#include "oxide_render_widget_host_view_delegate.h"49#include "oxide_render_widget_host_view_container.h"
5050
51namespace oxide {51namespace oxide {
5252
@@ -81,43 +81,35 @@
81void RenderWidgetHostView::OnTextInputStateChanged(81void RenderWidgetHostView::OnTextInputStateChanged(
82 ui::TextInputType type,82 ui::TextInputType type,
83 bool show_ime_if_needed) {83 bool show_ime_if_needed) {
84 if (type != current_text_input_type_ ||84 ime_bridge_.TextInputStateChanged(type, show_ime_if_needed);
85 show_ime_if_needed != show_ime_if_needed_) {
86 current_text_input_type_ = type;
87 show_ime_if_needed_ = show_ime_if_needed;
88
89 if (delegate_) {
90 delegate_->TextInputStateChanged(current_text_input_type_,
91 show_ime_if_needed_);
92 }
93 }
94}85}
9586
96void RenderWidgetHostView::OnSelectionBoundsChanged(87void RenderWidgetHostView::OnSelectionBoundsChanged(
97 const gfx::Rect& anchor_rect,88 const gfx::Rect& anchor_rect,
98 const gfx::Rect& focus_rect,89 const gfx::Rect& focus_rect,
99 bool is_anchor_first) {90 bool is_anchor_first) {
100 caret_rect_ = gfx::UnionRects(anchor_rect, focus_rect);91 gfx::Rect caret_rect = gfx::UnionRects(anchor_rect, focus_rect);
92
93 size_t selection_cursor_position = 0;
94 size_t selection_anchor_position = 0;
10195
102 if (selection_range_.IsValid()) {96 if (selection_range_.IsValid()) {
103 if (is_anchor_first) {97 if (is_anchor_first) {
104 selection_cursor_position_ =98 selection_cursor_position =
105 selection_range_.GetMax() - selection_text_offset_;99 selection_range_.GetMax() - selection_text_offset_;
106 selection_anchor_position_ =100 selection_anchor_position =
107 selection_range_.GetMin() - selection_text_offset_;101 selection_range_.GetMin() - selection_text_offset_;
108 } else {102 } else {
109 selection_cursor_position_ =103 selection_cursor_position =
110 selection_range_.GetMin() - selection_text_offset_;104 selection_range_.GetMin() - selection_text_offset_;
111 selection_anchor_position_ =105 selection_anchor_position =
112 selection_range_.GetMax() - selection_text_offset_;106 selection_range_.GetMax() - selection_text_offset_;
113 }107 }
114 }108 }
115109
116 if (delegate_) {110 ime_bridge_.SelectionBoundsChanged(caret_rect,
117 delegate_->SelectionBoundsChanged(caret_rect_,111 selection_cursor_position,
118 selection_cursor_position_,112 selection_anchor_position);
119 selection_anchor_position_);
120 }
121}113}
122114
123void RenderWidgetHostView::SelectionChanged(const base::string16& text,115void RenderWidgetHostView::SelectionChanged(const base::string16& text,
@@ -136,17 +128,17 @@
136128
137 content::RenderWidgetHostViewBase::SelectionChanged(text, offset, range);129 content::RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
138130
139 if (delegate_) {131 if (ime_bridge_.context()) {
140 delegate_->SelectionChanged();132 ime_bridge_.context()->SelectionChanged();
141 }133 }
142}134}
143135
144gfx::Size RenderWidgetHostView::GetPhysicalBackingSize() const {136gfx::Size RenderWidgetHostView::GetPhysicalBackingSize() const {
145 if (!delegate_) {137 if (!container_) {
146 return gfx::Size();138 return gfx::Size();
147 }139 }
148140
149 return delegate_->GetViewSizePix();141 return container_->GetViewSizePix();
150}142}
151143
152bool RenderWidgetHostView::DoTopControlsShrinkBlinkSize() const {144bool RenderWidgetHostView::DoTopControlsShrinkBlinkSize() const {
@@ -154,18 +146,15 @@
154}146}
155147
156float RenderWidgetHostView::GetTopControlsHeight() const {148float RenderWidgetHostView::GetTopControlsHeight() const {
157 if (!delegate_) {149 if (!container_) {
158 return 0.0f;150 return 0.0f;
159 }151 }
160152
161 return delegate_->GetLocationBarHeightDip();153 return container_->GetLocationBarHeightDip();
162}154}
163155
164void RenderWidgetHostView::FocusedNodeChanged(bool is_editable_node) {156void RenderWidgetHostView::FocusedNodeChanged(bool is_editable_node) {
165 focused_node_is_editable_ = is_editable_node;157 ime_bridge_.FocusedNodeChanged(is_editable_node);
166 if (delegate_) {
167 delegate_->FocusedNodeChanged(is_editable_node);
168 }
169}158}
170159
171void RenderWidgetHostView::OnSwapCompositorFrame(160void RenderWidgetHostView::OnSwapCompositorFrame(
@@ -186,9 +175,6 @@
186 return;175 return;
187 }176 }
188177
189 Compositor* compositor = delegate_ ? delegate_->GetCompositor() : nullptr;
190 CompositorLock lock(compositor);
191
192 if (output_surface_id != last_output_surface_id_) {178 if (output_surface_id != last_output_surface_id_) {
193 resource_collection_->SetClient(nullptr);179 resource_collection_->SetClient(nullptr);
194 if (resource_collection_->LoseAllResources()) {180 if (resource_collection_->LoseAllResources()) {
@@ -228,10 +214,16 @@
228 frame_size != frame_provider_->frame_size() ||214 frame_size != frame_provider_->frame_size() ||
229 frame_size_dip != last_frame_size_dip_) {215 frame_size_dip != last_frame_size_dip_) {
230 DetachLayer();216 DetachLayer();
217
231 frame_provider_ = new cc::DelegatedFrameProvider(resource_collection_,218 frame_provider_ = new cc::DelegatedFrameProvider(resource_collection_,
232 frame_data.Pass());219 frame_data.Pass());
233 layer_ = cc::DelegatedRendererLayer::Create(cc::LayerSettings(),220 layer_ = cc::DelegatedRendererLayer::Create(cc::LayerSettings(),
234 frame_provider_);221 frame_provider_);
222 layer_->SetIsDrawable(true);
223 layer_->SetContentsOpaque(true);
224 layer_->SetBounds(frame_size_dip);
225 layer_->SetHideLayerAndSubtree(!is_showing_);
226
235 AttachLayer();227 AttachLayer();
236 } else {228 } else {
237 frame_provider_->SetFrameData(frame_data.Pass());229 frame_provider_->SetFrameData(frame_data.Pass());
@@ -241,15 +233,12 @@
241 last_frame_size_dip_ = frame_size_dip;233 last_frame_size_dip_ = frame_size_dip;
242234
243 if (layer_.get()) {235 if (layer_.get()) {
244 layer_->SetIsDrawable(true);
245 layer_->SetContentsOpaque(true);
246 layer_->SetBounds(frame_size_dip);
247 layer_->SetNeedsDisplayRect(damage_rect_dip);236 layer_->SetNeedsDisplayRect(damage_rect_dip);
248 }237 }
249238
250 if (frame_is_evicted_) {239 if (frame_is_evicted_) {
251 frame_is_evicted_ = false;240 frame_is_evicted_ = false;
252 RendererFrameEvictor::GetInstance()->AddFrame(this, IsShowing());241 RendererFrameEvictor::GetInstance()->AddFrame(this, is_showing_);
253 }242 }
254243
255 compositor_frame_metadata_ = frame->metadata;244 compositor_frame_metadata_ = frame->metadata;
@@ -267,6 +256,7 @@
267 gesture_provider_->SetDoubleTapSupportForPageEnabled(256 gesture_provider_->SetDoubleTapSupportForPageEnabled(
268 !has_fixed_page_scale && !has_mobile_viewport);257 !has_fixed_page_scale && !has_mobile_viewport);
269258
259 Compositor* compositor = container_->GetCompositor();
270 if (!compositor || !compositor->IsActive()) {260 if (!compositor || !compositor->IsActive()) {
271 RunAckCallbacks();261 RunAckCallbacks();
272 }262 }
@@ -291,12 +281,17 @@
291 const std::vector<content::WebPluginGeometry>& moves) {}281 const std::vector<content::WebPluginGeometry>& moves) {}
292282
293void RenderWidgetHostView::UpdateCursor(const content::WebCursor& cursor) {283void RenderWidgetHostView::UpdateCursor(const content::WebCursor& cursor) {
294 if (cursor.IsEqual(current_cursor_)) {284 if (cursor.IsEqual(web_cursor_)) {
295 return;285 return;
296 }286 }
297287
298 current_cursor_ = cursor;288 web_cursor_ = cursor;
299 UpdateCursorOnWebView();289
290 if (is_loading_) {
291 return;
292 }
293
294 UpdateCurrentCursor();
300}295}
301296
302void RenderWidgetHostView::SetIsLoading(bool is_loading) {297void RenderWidgetHostView::SetIsLoading(bool is_loading) {
@@ -305,15 +300,15 @@
305 }300 }
306301
307 is_loading_ = is_loading;302 is_loading_ = is_loading;
308 UpdateCursorOnWebView();303 UpdateCurrentCursor();
309}304}
310305
311void RenderWidgetHostView::ImeCancelComposition() {306void RenderWidgetHostView::ImeCancelComposition() {
312 if (!delegate_) {307 if (!ime_bridge_.context()) {
313 return;308 return;
314 }309 }
315310
316 delegate_->ImeCancelComposition();311 ime_bridge_.context()->CancelComposition();
317}312}
318313
319void RenderWidgetHostView::RenderProcessGone(base::TerminationStatus status,314void RenderWidgetHostView::RenderProcessGone(base::TerminationStatus status,
@@ -354,13 +349,13 @@
354}349}
355350
356void RenderWidgetHostView::GetScreenInfo(blink::WebScreenInfo* result) {351void RenderWidgetHostView::GetScreenInfo(blink::WebScreenInfo* result) {
357 if (!delegate_) {352 if (!container_) {
358 *result =353 *result =
359 BrowserPlatformIntegration::GetInstance()->GetDefaultScreenInfo();354 BrowserPlatformIntegration::GetInstance()->GetDefaultScreenInfo();
360 return;355 return;
361 }356 }
362357
363 *result = delegate_->GetScreenInfo();358 *result = container_->GetScreenInfo();
364}359}
365360
366bool RenderWidgetHostView::GetScreenColorProfile(361bool RenderWidgetHostView::GetScreenColorProfile(
@@ -412,11 +407,11 @@
412}407}
413408
414bool RenderWidgetHostView::HasFocus() const {409bool RenderWidgetHostView::HasFocus() const {
415 if (!delegate_) {410 if (!container_) {
416 return false;411 return false;
417 }412 }
418413
419 return delegate_->HasFocus();414 return container_->HasFocus(this);
420}415}
421416
422bool RenderWidgetHostView::IsSurfaceAvailableForCopy() const {417bool RenderWidgetHostView::IsSurfaceAvailableForCopy() const {
@@ -425,20 +420,22 @@
425420
426void RenderWidgetHostView::Show() {421void RenderWidgetHostView::Show() {
427 if (is_showing_) {422 if (is_showing_) {
428 DCHECK(delegate_);423 return;
429 return;424 }
430 }
431
432 if (!delegate_) {
433 return;
434 }
435
436 is_showing_ = true;425 is_showing_ = true;
437426
427 if (layer_.get()) {
428 layer_->SetHideLayerAndSubtree(false);
429 }
430
438 if (!frame_is_evicted_) {431 if (!frame_is_evicted_) {
439 RendererFrameEvictor::GetInstance()->LockFrame(this);432 RendererFrameEvictor::GetInstance()->LockFrame(this);
440 }433 }
441434
435 if (!host_ || !host_->is_hidden()) {
436 return;
437 }
438
442 host_->WasShown(ui::LatencyInfo());439 host_->WasShown(ui::LatencyInfo());
443}440}
444441
@@ -446,30 +443,36 @@
446 if (!is_showing_) {443 if (!is_showing_) {
447 return;444 return;
448 }445 }
449
450 is_showing_ = false;446 is_showing_ = false;
451447
448 if (layer_.get()) {
449 layer_->SetHideLayerAndSubtree(true);
450 }
451
452 if (!frame_is_evicted_) {452 if (!frame_is_evicted_) {
453 RendererFrameEvictor::GetInstance()->UnlockFrame(this);453 RendererFrameEvictor::GetInstance()->UnlockFrame(this);
454 }454 }
455455
456 RunAckCallbacks();
457
458 if (!host_ || host_->is_hidden()) {
459 return;
460 }
461
456 host_->WasHidden();462 host_->WasHidden();
457
458 RunAckCallbacks();
459}463}
460464
461bool RenderWidgetHostView::IsShowing() {465bool RenderWidgetHostView::IsShowing() {
462 DCHECK(!is_showing_ || delegate_);466 return is_showing_ && container_ && container_->IsVisible();
463 return is_showing_;
464}467}
465468
466gfx::Rect RenderWidgetHostView::GetViewBounds() const {469gfx::Rect RenderWidgetHostView::GetViewBounds() const {
467 gfx::Rect bounds;470 gfx::Rect bounds;
468471
469 if (!delegate_) {472 if (!container_) {
470 bounds = gfx::Rect(last_size_);473 bounds = gfx::Rect(last_size_);
471 } else {474 } else {
472 bounds = delegate_->GetViewBoundsDip();475 bounds = container_->GetViewBoundsDip();
473 }476 }
474477
475 if (DoTopControlsShrinkBlinkSize()) {478 if (DoTopControlsShrinkBlinkSize()) {
@@ -485,6 +488,10 @@
485488
486void RenderWidgetHostView::UnlockMouse() {}489void RenderWidgetHostView::UnlockMouse() {}
487490
491void RenderWidgetHostView::CompositorDidCommit() {
492 RunAckCallbacks();
493}
494
488void RenderWidgetHostView::OnGestureEvent(495void RenderWidgetHostView::OnGestureEvent(
489 const blink::WebGestureEvent& event) {496 const blink::WebGestureEvent& event) {
490 if (!host_) {497 if (!host_) {
@@ -517,10 +524,6 @@
517void RenderWidgetHostView::EvictCurrentFrame() {524void RenderWidgetHostView::EvictCurrentFrame() {
518 frame_is_evicted_ = true;525 frame_is_evicted_ = true;
519 DestroyDelegatedContent();526 DestroyDelegatedContent();
520
521 if (delegate_) {
522 delegate_->EvictCurrentFrame();
523 }
524}527}
525528
526void RenderWidgetHostView::UnusedResourcesAreAvailable() {529void RenderWidgetHostView::UnusedResourcesAreAvailable() {
@@ -529,19 +532,20 @@
529 }532 }
530}533}
531534
532void RenderWidgetHostView::UpdateCursorOnWebView() {535void RenderWidgetHostView::UpdateCurrentCursor() {
533 if (!delegate_) {
534 return;
535 }
536
537 if (is_loading_) {536 if (is_loading_) {
538 content::WebCursor::CursorInfo busy_cursor_info(537 content::WebCursor::CursorInfo busy_cursor_info(
539 blink::WebCursorInfo::TypeWait);538 blink::WebCursorInfo::TypeWait);
540 content::WebCursor busy_cursor(busy_cursor_info);539 current_cursor_ = content::WebCursor(busy_cursor_info);
541 delegate_->UpdateCursor(busy_cursor);
542 } else {540 } else {
543 delegate_->UpdateCursor(current_cursor_);541 current_cursor_ = web_cursor_;
544 }542 }
543
544 if (!container_) {
545 return;
546 }
547
548 container_->CursorChanged();
545}549}
546550
547void RenderWidgetHostView::DestroyDelegatedContent() {551void RenderWidgetHostView::DestroyDelegatedContent() {
@@ -582,92 +586,76 @@
582}586}
583587
584void RenderWidgetHostView::AttachLayer() {588void RenderWidgetHostView::AttachLayer() {
585 if (!delegate_) {589 if (!container_) {
586 return;590 return;
587 }591 }
588 if (!layer_.get()) {592 if (!layer_.get()) {
589 return;593 return;
590 }594 }
591595
592 delegate_->GetCompositor()->SetRootLayer(layer_.get());596 container_->AttachLayer(layer_);
593}597}
594598
595void RenderWidgetHostView::DetachLayer() {599void RenderWidgetHostView::DetachLayer() {
596 if (!delegate_) {600 if (!container_) {
597 return;601 return;
598 }602 }
599 if (!layer_.get()) {603 if (!layer_.get()) {
600 return;604 return;
601 }605 }
602606
603 delegate_->GetCompositor()->SetRootLayer(scoped_refptr<cc::Layer>());607 container_->DetachLayer(layer_);
604}608}
605609
606RenderWidgetHostView::RenderWidgetHostView(content::RenderWidgetHost* host) :610RenderWidgetHostView::RenderWidgetHostView(
607 host_(content::RenderWidgetHostImpl::From(host)),611 content::RenderWidgetHost* host,
608 delegate_(nullptr),612 RenderWidgetHostViewContainer* container)
609 resource_collection_(new cc::DelegatedFrameResourceCollection()),613 : host_(content::RenderWidgetHostImpl::From(host)),
610 last_output_surface_id_(0),614 container_(container),
611 frame_is_evicted_(true),615 resource_collection_(new cc::DelegatedFrameResourceCollection()),
612 selection_cursor_position_(0),616 last_output_surface_id_(0),
613 selection_anchor_position_(0),617 frame_is_evicted_(true),
614 current_text_input_type_(ui::TEXT_INPUT_TYPE_NONE),618 ime_bridge_(this),
615 show_ime_if_needed_(false),619 is_loading_(false),
616 focused_node_is_editable_(false),620 is_showing_(false),
617 is_loading_(false),621 top_controls_shrink_blink_size_(false),
618 is_showing_(false),622 gesture_provider_(GestureProvider::Create(this)) {
619 top_controls_shrink_blink_size_(false),
620 gesture_provider_(GestureProvider::Create(this)) {
621 CHECK(host_) << "Implementation didn't supply a RenderWidgetHost";623 CHECK(host_) << "Implementation didn't supply a RenderWidgetHost";
622624
623 resource_collection_->SetClient(this);625 resource_collection_->SetClient(this);
624 host_->SetView(this);626 host_->SetView(this);
625627
626 gesture_provider_->SetDoubleTapSupportForPageEnabled(false);628 gesture_provider_->SetDoubleTapSupportForPageEnabled(false);
629
630 if (container) {
631 CompositorObserver::Observe(container->GetCompositor());
632 }
627}633}
628634
629RenderWidgetHostView::~RenderWidgetHostView() {635RenderWidgetHostView::~RenderWidgetHostView() {
630 resource_collection_->SetClient(nullptr);636 resource_collection_->SetClient(nullptr);
631 SetDelegate(nullptr);637 SetContainer(nullptr);
632}638}
633639
634void RenderWidgetHostView::CompositorDidCommit() {640void RenderWidgetHostView::SetContainer(
635 RunAckCallbacks();641 RenderWidgetHostViewContainer* container) {
636}642 if (container == container_) {
637
638void RenderWidgetHostView::SetDelegate(
639 RenderWidgetHostViewDelegate* delegate) {
640 if (delegate == delegate_) {
641 return;643 return;
642 }644 }
643645
644 DetachLayer();646 DetachLayer();
645 delegate_ = delegate;647 container_ = container;
646 AttachLayer();648 AttachLayer();
647649
648 if (delegate_) {650 CompositorObserver::Observe(
649 DCHECK(host_) <<651 container_ ? container_->GetCompositor() : nullptr);
650 "Shouldn't be attaching to a delegate when we're already destroyed";652
651 host_->SendScreenRects();653 if (!host_) {
652 host_->WasResized();654 return;
653
654 if (delegate_->IsVisible()) {
655 Show();
656 } else {
657 Hide();
658 }
659
660 UpdateCursorOnWebView();
661 delegate_->TextInputStateChanged(current_text_input_type_,
662 show_ime_if_needed_);
663 delegate_->FocusedNodeChanged(focused_node_is_editable_);
664 delegate_->SelectionBoundsChanged(caret_rect_,
665 selection_cursor_position_,
666 selection_anchor_position_);
667 delegate_->SelectionChanged();
668 } else if (host_) {
669 Hide();
670 }655 }
656
657 host_->SendScreenRects();
658 host_->WasResized();
671}659}
672660
673void RenderWidgetHostView::Blur() {661void RenderWidgetHostView::Blur() {
674662
=== modified file 'shared/browser/oxide_render_widget_host_view.h'
--- shared/browser/oxide_render_widget_host_view.h 2015-09-29 08:25:11 +0000
+++ shared/browser/oxide_render_widget_host_view.h 2015-10-21 17:31:00 +0000
@@ -30,10 +30,10 @@
30#include "cc/layers/delegated_frame_resource_collection.h"30#include "cc/layers/delegated_frame_resource_collection.h"
31#include "cc/output/compositor_frame_metadata.h"31#include "cc/output/compositor_frame_metadata.h"
32#include "content/common/cursors/webcursor.h"32#include "content/common/cursors/webcursor.h"
33#include "ui/base/ime/text_input_type.h"
34#include "ui/gfx/geometry/rect.h"
35#include "ui/gfx/geometry/size.h"33#include "ui/gfx/geometry/size.h"
3634
35#include "shared/browser/compositor/oxide_compositor_observer.h"
36#include "shared/browser/input/oxide_ime_bridge_impl.h"
37#include "shared/browser/oxide_gesture_provider.h"37#include "shared/browser/oxide_gesture_provider.h"
38#include "shared/browser/oxide_renderer_frame_evictor_client.h"38#include "shared/browser/oxide_renderer_frame_evictor_client.h"
39#include "shared/port/content/browser/render_widget_host_view_oxide.h"39#include "shared/port/content/browser/render_widget_host_view_oxide.h"
@@ -53,23 +53,25 @@
5353
54namespace oxide {54namespace oxide {
5555
56class RenderWidgetHostViewDelegate;56class RenderWidgetHostViewContainer;
57class WebView;
5857
59class RenderWidgetHostView final :58class RenderWidgetHostView final :
60 public content::RenderWidgetHostViewOxide,59 public content::RenderWidgetHostViewOxide,
60 public CompositorObserver,
61 public GestureProviderClient,61 public GestureProviderClient,
62 public RendererFrameEvictorClient,62 public RendererFrameEvictorClient,
63 public cc::DelegatedFrameResourceCollectionClient,63 public cc::DelegatedFrameResourceCollectionClient,
64 public base::SupportsWeakPtr<RenderWidgetHostView> {64 public base::SupportsWeakPtr<RenderWidgetHostView> {
65 public:65 public:
66 RenderWidgetHostView(content::RenderWidgetHost* render_widget_host);66 RenderWidgetHostView(content::RenderWidgetHost* render_widget_host,
67 RenderWidgetHostViewContainer* container);
67 ~RenderWidgetHostView();68 ~RenderWidgetHostView();
6869
69 content::RenderWidgetHostImpl* host() const { return host_; }70 content::RenderWidgetHostImpl* host() const { return host_; }
7071
71 void CompositorDidCommit();72 void SetContainer(RenderWidgetHostViewContainer* container);
72 void SetDelegate(RenderWidgetHostViewDelegate* delegate);73
74 ImeBridgeImpl* ime_bridge() { return &ime_bridge_; }
7375
74 const base::string16& selection_text() const {76 const base::string16& selection_text() const {
75 return selection_text_;77 return selection_text_;
@@ -79,6 +81,8 @@
79 return compositor_frame_metadata_;81 return compositor_frame_metadata_;
80 }82 }
8183
84 const content::WebCursor& current_cursor() const { return current_cursor_; }
85
82 void HandleTouchEvent(const ui::MotionEvent& event);86 void HandleTouchEvent(const ui::MotionEvent& event);
83 void ResetGestureDetection();87 void ResetGestureDetection();
8488
@@ -158,6 +162,9 @@
158 bool LockMouse() final;162 bool LockMouse() final;
159 void UnlockMouse() final;163 void UnlockMouse() final;
160164
165 // CompositorObserver implementation
166 void CompositorDidCommit() final;
167
161 // GestureProviderClient implementation168 // GestureProviderClient implementation
162 void OnGestureEvent(const blink::WebGestureEvent& event) final;169 void OnGestureEvent(const blink::WebGestureEvent& event) final;
163170
@@ -169,7 +176,7 @@
169176
170 // ===================177 // ===================
171178
172 void UpdateCursorOnWebView();179 void UpdateCurrentCursor();
173180
174 void DestroyDelegatedContent();181 void DestroyDelegatedContent();
175 void SendDelegatedFrameAck(uint32 surface_id);182 void SendDelegatedFrameAck(uint32 surface_id);
@@ -180,7 +187,7 @@
180187
181 content::RenderWidgetHostImpl* host_;188 content::RenderWidgetHostImpl* host_;
182189
183 RenderWidgetHostViewDelegate* delegate_;190 RenderWidgetHostViewContainer* container_;
184191
185 gfx::GLSurfaceHandle shared_surface_handle_;192 gfx::GLSurfaceHandle shared_surface_handle_;
186193
@@ -197,15 +204,10 @@
197204
198 bool frame_is_evicted_;205 bool frame_is_evicted_;
199206
200 gfx::Rect caret_rect_;207 ImeBridgeImpl ime_bridge_;
201 size_t selection_cursor_position_;
202 size_t selection_anchor_position_;
203
204 ui::TextInputType current_text_input_type_;
205 bool show_ime_if_needed_;
206 bool focused_node_is_editable_;
207208
208 bool is_loading_;209 bool is_loading_;
210 content::WebCursor web_cursor_;
209 content::WebCursor current_cursor_;211 content::WebCursor current_cursor_;
210212
211 bool is_showing_;213 bool is_showing_;
212214
=== renamed file 'shared/browser/oxide_render_widget_host_view_delegate.h' => 'shared/browser/oxide_render_widget_host_view_container.h'
--- shared/browser/oxide_render_widget_host_view_delegate.h 2015-05-14 15:37:57 +0000
+++ shared/browser/oxide_render_widget_host_view_container.h 2015-10-21 17:31:00 +0000
@@ -1,5 +1,5 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2014 Canonical Ltd.2// Copyright (C) 2014-2015 Canonical Ltd.
33
4// This library is free software; you can redistribute it and/or4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public5// modify it under the terms of the GNU Lesser General Public
@@ -15,16 +15,24 @@
15// License along with this library; if not, write to the Free Software15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1717
18#ifndef _OXIDE_SHARED_BROWSER_RENDER_WIDGET_HOST_VIEW_DELEGATE_H_18#ifndef _OXIDE_SHARED_BROWSER_RENDER_WIDGET_HOST_VIEW_CONTAINER_H_
19#define _OXIDE_SHARED_BROWSER_RENDER_WIDGET_HOST_VIEW_DELEGATE_H_19#define _OXIDE_SHARED_BROWSER_RENDER_WIDGET_HOST_VIEW_CONTAINER_H_
2020
21#include <vector>
22
23#include "base/memory/ref_counted.h"
24#include "content/public/common/menu_item.h"
21#include "third_party/WebKit/public/platform/WebScreenInfo.h"25#include "third_party/WebKit/public/platform/WebScreenInfo.h"
22#include "ui/base/ime/text_input_type.h"
23#include "ui/gfx/geometry/rect.h"26#include "ui/gfx/geometry/rect.h"
24#include "ui/gfx/geometry/size.h"27#include "ui/gfx/geometry/size.h"
2528
29namespace cc {
30class Layer;
31}
32
26namespace content {33namespace content {
27class WebCursor;34struct ContextMenuParams;
35class RenderFrameHost;
28}36}
2937
30namespace gfx {38namespace gfx {
@@ -34,44 +42,43 @@
34namespace oxide {42namespace oxide {
3543
36class Compositor;44class Compositor;
37class WebView;45class RenderWidgetHostView;
3846
39class RenderWidgetHostViewDelegate {47class RenderWidgetHostViewContainer {
40 public:48 public:
41 virtual ~RenderWidgetHostViewDelegate() {}49 virtual ~RenderWidgetHostViewContainer() {}
42
43 virtual void EvictCurrentFrame() = 0;
44
45 virtual void UpdateCursor(const content::WebCursor& cursor) = 0;
46
47 virtual void TextInputStateChanged(ui::TextInputType type,
48 bool show_ime_if_needed) = 0;
49
50 virtual void FocusedNodeChanged(bool is_editable_node) = 0;
51
52 virtual void ImeCancelComposition() = 0;
53
54 virtual void SelectionBoundsChanged(const gfx::Rect& caret_rect,
55 size_t selection_cursor_position,
56 size_t selection_anchor_position) = 0;
57
58 virtual void SelectionChanged() = 0;
5950
60 virtual Compositor* GetCompositor() const = 0;51 virtual Compositor* GetCompositor() const = 0;
6152
53 virtual void AttachLayer(scoped_refptr<cc::Layer> layer) = 0;
54
55 virtual void DetachLayer(scoped_refptr<cc::Layer> layer) = 0;
56
57 virtual void CursorChanged() = 0;
58
62 virtual gfx::Size GetViewSizePix() const = 0;59 virtual gfx::Size GetViewSizePix() const = 0;
6360
64 virtual gfx::Rect GetViewBoundsDip() const = 0;61 virtual gfx::Rect GetViewBoundsDip() const = 0;
6562
66 virtual blink::WebScreenInfo GetScreenInfo() const = 0;63 virtual blink::WebScreenInfo GetScreenInfo() const = 0;
6764
68 virtual bool HasFocus() const = 0;65 virtual bool HasFocus(const RenderWidgetHostView* view) const = 0;
6966
70 virtual bool IsVisible() const = 0;67 virtual bool IsVisible() const = 0;
7168
72 virtual float GetLocationBarHeightDip() const = 0;69 virtual float GetLocationBarHeightDip() const = 0;
70
71 virtual void ShowContextMenu(content::RenderFrameHost* render_frame_host,
72 const content::ContextMenuParams& params) = 0;
73
74 virtual void ShowPopupMenu(content::RenderFrameHost* render_frame_host,
75 const gfx::Rect& bounds,
76 int selected_item,
77 const std::vector<content::MenuItem>& items,
78 bool allow_multiple_selection) = 0;
79 virtual void HidePopupMenu() = 0;
73};80};
7481
75} // namespace oxide82} // namespace oxide
7683
77#endif // _OXIDE_SHARED_BROWSER_RENDER_WIDGET_HOST_VIEW_DELEGATE_H_84#endif // _OXIDE_SHARED_BROWSER_RENDER_WIDGET_HOST_VIEW_CONTAINER_H_
7885
=== modified file 'shared/browser/oxide_web_contents_view.cc'
--- shared/browser/oxide_web_contents_view.cc 2015-05-28 23:51:39 +0000
+++ shared/browser/oxide_web_contents_view.cc 2015-10-21 17:31:00 +0000
@@ -21,15 +21,27 @@
21#include "content/browser/web_contents/web_contents_impl.h"21#include "content/browser/web_contents/web_contents_impl.h"
22#include "content/public/browser/web_contents.h"22#include "content/public/browser/web_contents.h"
2323
24#include "shared/common/oxide_unowned_user_data.h"
25
24#include "oxide_render_widget_host_view.h"26#include "oxide_render_widget_host_view.h"
25#include "oxide_web_view.h"27#include "oxide_render_widget_host_view_container.h"
2628
27namespace oxide {29namespace oxide {
2830
29WebContentsView::WebContentsView(content::WebContents* web_contents) :31namespace {
30 web_contents_(web_contents) {}32int kUserDataKey;
3133}
32WebContentsView::~WebContentsView() {}34
35WebContentsView::WebContentsView(content::WebContents* web_contents)
36 : web_contents_(web_contents),
37 container_(nullptr) {
38 web_contents_->SetUserData(&kUserDataKey,
39 new UnownedUserData<WebContentsView>(this));
40}
41
42WebContentsView::~WebContentsView() {
43 web_contents_->RemoveUserData(&kUserDataKey);
44}
3345
34// static46// static
35content::WebContentsViewOxide* WebContentsView::Create(47content::WebContentsViewOxide* WebContentsView::Create(
@@ -37,8 +49,27 @@
37 return new WebContentsView(web_contents);49 return new WebContentsView(web_contents);
38}50}
3951
40WebView* WebContentsView::GetWebView() const {52// static
41 return WebView::FromWebContents(web_contents_);53WebContentsView* WebContentsView::FromWebContents(
54 content::WebContents* contents) {
55 UnownedUserData<WebContentsView>* data =
56 static_cast<UnownedUserData<WebContentsView>*>(
57 contents->GetUserData(&kUserDataKey));
58 if (!data) {
59 return nullptr;
60 }
61
62 return data->get();
63}
64
65void WebContentsView::SetContainer(RenderWidgetHostViewContainer* container) {
66 container_ = container;
67 RenderWidgetHostView* rwhv =
68 static_cast<RenderWidgetHostView*>(
69 web_contents_->GetRenderWidgetHostView());
70 if (rwhv) {
71 rwhv->SetContainer(container);
72 }
42}73}
4374
44gfx::NativeView WebContentsView::GetNativeView() const {75gfx::NativeView WebContentsView::GetNativeView() const {
@@ -54,7 +85,7 @@
54}85}
5586
56void WebContentsView::GetContainerBounds(gfx::Rect* out) const {87void WebContentsView::GetContainerBounds(gfx::Rect* out) const {
57 *out = GetWebView()->GetViewBoundsDip();88 *out = container_->GetViewBoundsDip();
58}89}
5990
60void WebContentsView::SizeContents(const gfx::Size& size) {91void WebContentsView::SizeContents(const gfx::Size& size) {
@@ -107,21 +138,7 @@
107content::RenderWidgetHostViewBase* WebContentsView::CreateViewForWidget(138content::RenderWidgetHostViewBase* WebContentsView::CreateViewForWidget(
108 content::RenderWidgetHost* render_widget_host,139 content::RenderWidgetHost* render_widget_host,
109 bool is_guest_view_hack) {140 bool is_guest_view_hack) {
110 RenderWidgetHostView* rwhv = new RenderWidgetHostView(render_widget_host);141 return new RenderWidgetHostView(render_widget_host, container_);
111
112 WebView* view = GetWebView();
113 if (view) {
114 // As RWHV contains the plumbing from WebView::VisibilityChanged to
115 // RenderWidgetHostImpl::Was{Shown,Hidden}, RWHI::is_hidden could be
116 // out of date. This ensures that we sync RWHI::is_hidden with the
117 // real visibility of the webview - see https://launchpad.net/bugs/1322622
118 view->VisibilityChanged();
119
120 // Also sync focus state
121 view->FocusChanged();
122 }
123
124 return rwhv;
125}142}
126143
127content::RenderWidgetHostViewBase* WebContentsView::CreateViewForPopupWidget(144content::RenderWidgetHostViewBase* WebContentsView::CreateViewForPopupWidget(
@@ -140,7 +157,7 @@
140void WebContentsView::ShowContextMenu(157void WebContentsView::ShowContextMenu(
141 content::RenderFrameHost* render_frame_host,158 content::RenderFrameHost* render_frame_host,
142 const content::ContextMenuParams& params) {159 const content::ContextMenuParams& params) {
143 GetWebView()->ShowContextMenu(render_frame_host, params);160 container_->ShowContextMenu(render_frame_host, params);
144}161}
145162
146void WebContentsView::StartDragging(163void WebContentsView::StartDragging(
@@ -163,13 +180,13 @@
163 const std::vector<content::MenuItem>& items,180 const std::vector<content::MenuItem>& items,
164 bool right_aligned,181 bool right_aligned,
165 bool allow_multiple_selection) {182 bool allow_multiple_selection) {
166 GetWebView()->ShowPopupMenu(render_frame_host,183 container_->ShowPopupMenu(render_frame_host,
167 bounds, selected_item, items,184 bounds, selected_item, items,
168 allow_multiple_selection);185 allow_multiple_selection);
169}186}
170187
171void WebContentsView::HidePopupMenu() {188void WebContentsView::HidePopupMenu() {
172 GetWebView()->HidePopupMenu();189 container_->HidePopupMenu();
173}190}
174191
175} // namespace oxide192} // namespace oxide
176193
=== modified file 'shared/browser/oxide_web_contents_view.h'
--- shared/browser/oxide_web_contents_view.h 2015-05-28 23:51:39 +0000
+++ shared/browser/oxide_web_contents_view.h 2015-10-21 17:31:00 +0000
@@ -27,7 +27,7 @@
2727
28namespace oxide {28namespace oxide {
2929
30class WebView;30class RenderWidgetHostViewContainer;
3131
32class WebContentsView final : public content::WebContentsViewOxide {32class WebContentsView final : public content::WebContentsViewOxide {
33 public:33 public:
@@ -35,7 +35,9 @@
35 static content::WebContentsViewOxide* Create(35 static content::WebContentsViewOxide* Create(
36 content::WebContents* web_contents);36 content::WebContents* web_contents);
3737
38 WebView* GetWebView() const;38 static WebContentsView* FromWebContents(content::WebContents* contents);
39
40 void SetContainer(RenderWidgetHostViewContainer* container);
3941
40 // content::WebContentsView42 // content::WebContentsView
41 gfx::NativeView GetNativeView() const final;43 gfx::NativeView GetNativeView() const final;
@@ -93,6 +95,8 @@
9395
94 content::WebContents* web_contents_;96 content::WebContents* web_contents_;
9597
98 RenderWidgetHostViewContainer* container_;
99
96 DISALLOW_IMPLICIT_CONSTRUCTORS(WebContentsView);100 DISALLOW_IMPLICIT_CONSTRUCTORS(WebContentsView);
97};101};
98102
99103
=== modified file 'shared/browser/oxide_web_view.cc'
--- shared/browser/oxide_web_view.cc 2015-10-08 15:56:22 +0000
+++ shared/browser/oxide_web_view.cc 2015-10-21 17:31:00 +0000
@@ -25,17 +25,18 @@
25#include "base/strings/string_util.h"25#include "base/strings/string_util.h"
26#include "base/strings/utf_string_conversions.h"26#include "base/strings/utf_string_conversions.h"
27#include "base/supports_user_data.h"27#include "base/supports_user_data.h"
28#include "cc/layers/layer.h"
29#include "cc/layers/solid_color_layer.h"
30#include "cc/trees/layer_tree_settings.h"
28#include "components/sessions/content/content_serialized_navigation_builder.h"31#include "components/sessions/content/content_serialized_navigation_builder.h"
29#include "content/browser/frame_host/render_frame_host_impl.h"32#include "content/browser/frame_host/render_frame_host_impl.h"
30#include "content/browser/renderer_host/event_with_latency_info.h"33#include "content/browser/renderer_host/event_with_latency_info.h"
31#include "content/browser/renderer_host/render_view_host_impl.h"34#include "content/browser/renderer_host/render_view_host_impl.h"
32#include "content/browser/renderer_host/render_widget_host_impl.h"35#include "content/browser/renderer_host/render_widget_host_impl.h"
33#include "content/browser/renderer_host/ui_events_helper.h"
34#include "content/browser/web_contents/web_contents_impl.h"36#include "content/browser/web_contents/web_contents_impl.h"
35#include "content/browser/web_contents/web_contents_view.h"37#include "content/browser/web_contents/web_contents_view.h"
36#include "content/public/browser/invalidate_type.h"38#include "content/public/browser/invalidate_type.h"
37#include "content/public/browser/browser_context.h"39#include "content/public/browser/browser_context.h"
38#include "content/public/browser/native_web_keyboard_event.h"
39#include "content/public/browser/navigation_controller.h"40#include "content/public/browser/navigation_controller.h"
40#include "content/public/browser/navigation_details.h"41#include "content/public/browser/navigation_details.h"
41#include "content/public/browser/navigation_entry.h"42#include "content/public/browser/navigation_entry.h"
@@ -60,7 +61,6 @@
60#include "third_party/WebKit/public/web/WebInputEvent.h"61#include "third_party/WebKit/public/web/WebInputEvent.h"
61#include "ui/base/window_open_disposition.h"62#include "ui/base/window_open_disposition.h"
62#include "ui/events/event.h"63#include "ui/events/event.h"
63#include "ui/gfx/range/range.h"
64#include "ui/gl/gl_implementation.h"64#include "ui/gl/gl_implementation.h"
65#include "ui/shell_dialogs/selected_file_info.h"65#include "ui/shell_dialogs/selected_file_info.h"
66#include "url/gurl.h"66#include "url/gurl.h"
@@ -69,12 +69,15 @@
69#include "shared/browser/compositor/oxide_compositor.h"69#include "shared/browser/compositor/oxide_compositor.h"
70#include "shared/browser/compositor/oxide_compositor_frame_data.h"70#include "shared/browser/compositor/oxide_compositor_frame_data.h"
71#include "shared/browser/compositor/oxide_compositor_frame_handle.h"71#include "shared/browser/compositor/oxide_compositor_frame_handle.h"
72#include "shared/browser/input/oxide_ime_bridge.h"
73#include "shared/browser/input/oxide_input_method_context.h"
72#include "shared/browser/media/oxide_media_capture_devices_dispatcher.h"74#include "shared/browser/media/oxide_media_capture_devices_dispatcher.h"
73#include "shared/browser/permissions/oxide_permission_request_dispatcher.h"75#include "shared/browser/permissions/oxide_permission_request_dispatcher.h"
74#include "shared/browser/permissions/oxide_temporary_saved_permission_context.h"76#include "shared/browser/permissions/oxide_temporary_saved_permission_context.h"
75#include "shared/common/oxide_content_client.h"77#include "shared/common/oxide_content_client.h"
76#include "shared/common/oxide_enum_flags.h"78#include "shared/common/oxide_enum_flags.h"
77#include "shared/common/oxide_messages.h"79#include "shared/common/oxide_messages.h"
80#include "shared/common/oxide_unowned_user_data.h"
7881
79#include "oxide_browser_context.h"82#include "oxide_browser_context.h"
80#include "oxide_browser_process_main.h"83#include "oxide_browser_process_main.h"
@@ -106,20 +109,7 @@
106109
107namespace {110namespace {
108111
109const char kWebViewKey[] = "oxide_web_view_data";112int kUserDataKey;
110
111// SupportsUserData implementations own their data. This class exists
112// because we don't want WebContents to own WebView (it's the other way
113// around)
114class WebViewUserData : public base::SupportsUserData::Data {
115 public:
116 WebViewUserData(WebView* view) : view_(view) {}
117
118 WebView* get() const { return view_; }
119
120 private:
121 WebView* view_;
122};
123113
124void FillLoadURLParamsFromOpenURLParams(114void FillLoadURLParamsFromOpenURLParams(
125 content::NavigationController::LoadURLParams* load_params,115 content::NavigationController::LoadURLParams* load_params,
@@ -143,22 +133,6 @@
143 }133 }
144}134}
145135
146// Qt input methods don’t generate key events, but a lot of web pages out there
147// rely on keydown and keyup events to e.g. perform search-as-you-type or
148// enable/disable a submit button based on the contents of a text input field,
149// so we send a fake pair of keydown/keyup events.
150// This mimicks what is done in GtkIMContextWrapper::HandlePreeditChanged(…)
151// and GtkIMContextWrapper::HandleCommit(…)
152// (see content/browser/renderer_host/gtk_im_context_wrapper.cc).
153void SendFakeCompositionKeyEvent(content::RenderWidgetHostImpl* host,
154 blink::WebInputEvent::Type type) {
155 content::NativeWebKeyboardEvent fake_event;
156 fake_event.windowsKeyCode = ui::VKEY_PROCESSKEY;
157 fake_event.skip_in_browser = true;
158 fake_event.type = type;
159 host->ForwardKeyboardEvent(fake_event);
160}
161
162void CreateHelpers(content::WebContents* contents,136void CreateHelpers(content::WebContents* contents,
163 content::WebContents* opener = nullptr) {137 content::WebContents* opener = nullptr) {
164 new WebViewContentsHelper(contents, opener);138 new WebViewContentsHelper(contents, opener);
@@ -225,13 +199,9 @@
225199
226WebView::WebView(WebViewClient* client)200WebView::WebView(WebViewClient* client)
227 : client_(client),201 : client_(client),
228 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
229 show_ime_if_needed_(false),
230 focused_node_is_editable_(false),
231 selection_cursor_position_(0),
232 selection_anchor_position_(0),
233 web_contents_helper_(nullptr),202 web_contents_helper_(nullptr),
234 compositor_(Compositor::Create(this)),203 compositor_(Compositor::Create(this)),
204 root_layer_(cc::SolidColorLayer::Create(cc::LayerSettings())),
235 is_fullscreen_(false),205 is_fullscreen_(false),
236 blocked_content_(CONTENT_TYPE_NONE),206 blocked_content_(CONTENT_TYPE_NONE),
237 location_bar_height_pix_(0),207 location_bar_height_pix_(0),
@@ -239,6 +209,14 @@
239 location_bar_animated_(true),209 location_bar_animated_(true),
240 weak_factory_(this) {210 weak_factory_(this) {
241 CHECK(client) << "Didn't specify a client";211 CHECK(client) << "Didn't specify a client";
212
213 root_layer_->SetIsDrawable(true);
214 root_layer_->SetBackgroundColor(SK_ColorWHITE);
215
216 compositor_->SetRootLayer(root_layer_);
217
218 CompositorObserver::Observe(compositor_.get());
219 InputMethodContextObserver::Observe(client_->GetInputMethodContext());
242}220}
243221
244void WebView::CommonInit(scoped_ptr<content::WebContents> contents) {222void WebView::CommonInit(scoped_ptr<content::WebContents> contents) {
@@ -246,7 +224,8 @@
246224
247 // Attach ourself to the WebContents225 // Attach ourself to the WebContents
248 web_contents_->SetDelegate(this);226 web_contents_->SetDelegate(this);
249 web_contents_->SetUserData(kWebViewKey, new WebViewUserData(this));227 web_contents_->SetUserData(&kUserDataKey,
228 new UnownedUserData<WebView>(this));
250229
251 content::WebContentsObserver::Observe(web_contents_.get());230 content::WebContentsObserver::Observe(web_contents_.get());
252231
@@ -262,6 +241,8 @@
262 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_CHANGED,241 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_CHANGED,
263 content::NotificationService::AllBrowserContextsAndSources());242 content::NotificationService::AllBrowserContextsAndSources());
264243
244 WebContentsView::FromWebContents(web_contents_.get())->SetContainer(this);
245
265 DCHECK(std::find(g_all_web_views.Get().begin(),246 DCHECK(std::find(g_all_web_views.Get().begin(),
266 g_all_web_views.Get().end(),247 g_all_web_views.Get().end(),
267 this) ==248 this) ==
@@ -329,11 +310,13 @@
329 return false;310 return false;
330 }311 }
331312
332 if (!IsInputPanelVisible()) {313 if (!client_->GetInputMethodContext() ||
314 !client_->GetInputMethodContext()->IsInputPanelVisible()) {
333 return false;315 return false;
334 }316 }
335317
336 if (!focused_node_is_editable_) {318 if (!GetRenderWidgetHostView() ||
319 !GetRenderWidgetHostView()->ime_bridge()->focused_node_is_editable()) {
337 return false;320 return false;
338 }321 }
339322
@@ -388,6 +371,10 @@
388 return client_->GetScriptMessageHandlerAt(index);371 return client_->GetScriptMessageHandlerAt(index);
389}372}
390373
374void WebView::InputPanelVisibilityChanged() {
375 MaybeScrollFocusedEditableNodeIntoView();
376}
377
391void WebView::CompositorDidCommit() {378void WebView::CompositorDidCommit() {
392 RenderWidgetHostView* rwhv = GetRenderWidgetHostView();379 RenderWidgetHostView* rwhv = GetRenderWidgetHostView();
393 if (!rwhv) {380 if (!rwhv) {
@@ -395,8 +382,6 @@
395 }382 }
396383
397 pending_compositor_frame_metadata_ = rwhv->compositor_frame_metadata();384 pending_compositor_frame_metadata_ = rwhv->compositor_frame_metadata();
398
399 rwhv->CompositorDidCommit();
400}385}
401386
402void WebView::CompositorSwapFrame(CompositorFrameHandle* handle) {387void WebView::CompositorSwapFrame(CompositorFrameHandle* handle) {
@@ -438,63 +423,79 @@
438 }423 }
439}424}
440425
441void WebView::EvictCurrentFrame() {
442 current_compositor_frame_ = nullptr;
443 client_->EvictCurrentFrame();
444}
445
446void WebView::UpdateCursor(const content::WebCursor& cursor) {
447 client_->UpdateCursor(cursor);
448}
449
450void WebView::TextInputStateChanged(ui::TextInputType type,
451 bool show_ime_if_needed) {
452 if (type == text_input_type_ &&
453 show_ime_if_needed == show_ime_if_needed_) {
454 return;
455 }
456
457 text_input_type_ = type;
458 show_ime_if_needed_ = show_ime_if_needed;
459
460 client_->TextInputStateChanged();
461}
462
463void WebView::FocusedNodeChanged(bool is_editable_node) {
464 focused_node_is_editable_ = is_editable_node;
465 client_->FocusedNodeChanged();
466
467 MaybeScrollFocusedEditableNodeIntoView();
468}
469
470void WebView::ImeCancelComposition() {
471 client_->ImeCancelComposition();
472}
473
474void WebView::SelectionBoundsChanged(const gfx::Rect& caret_rect,
475 size_t selection_cursor_position,
476 size_t selection_anchor_position) {
477 if (caret_rect == caret_rect_ &&
478 selection_cursor_position == selection_cursor_position_ &&
479 selection_anchor_position == selection_anchor_position_) {
480 return;
481 }
482
483 caret_rect_ = caret_rect;
484 selection_cursor_position_ = selection_cursor_position;
485 selection_anchor_position_ = selection_anchor_position;
486
487 client_->SelectionBoundsChanged();
488}
489
490void WebView::SelectionChanged() {
491 client_->SelectionChanged();
492}
493
494Compositor* WebView::GetCompositor() const {426Compositor* WebView::GetCompositor() const {
495 return compositor_.get();427 return compositor_.get();
496}428}
497429
430void WebView::AttachLayer(scoped_refptr<cc::Layer> layer) {
431 DCHECK(layer.get());
432 root_layer_->InsertChild(layer, 0);
433 root_layer_->SetIsDrawable(false);
434}
435
436void WebView::DetachLayer(scoped_refptr<cc::Layer> layer) {
437 DCHECK(layer.get());
438 DCHECK_EQ(layer->parent(), root_layer_.get());
439 layer->RemoveFromParent();
440 if (root_layer_->children().size() == 0) {
441 root_layer_->SetIsDrawable(true);
442 }
443}
444
445void WebView::CursorChanged() {
446 RenderWidgetHostView* rwhv = GetRenderWidgetHostView();
447 if (!rwhv) {
448 return;
449 }
450
451 client_->UpdateCursor(rwhv->current_cursor());
452}
453
454bool WebView::HasFocus(const RenderWidgetHostView* view) const {
455 if (!HasFocus()) {
456 return false;
457 }
458
459 return view == GetRenderWidgetHostView();
460}
461
462void WebView::ShowContextMenu(content::RenderFrameHost* render_frame_host,
463 const content::ContextMenuParams& params) {
464 WebContextMenu* menu = client_->CreateContextMenu(render_frame_host, params);
465 if (!menu) {
466 return;
467 }
468
469 menu->Show();
470}
471
472void WebView::ShowPopupMenu(content::RenderFrameHost* render_frame_host,
473 const gfx::Rect& bounds,
474 int selected_item,
475 const std::vector<content::MenuItem>& items,
476 bool allow_multiple_selection) {
477 DCHECK(!active_popup_menu_);
478
479 WebPopupMenu* menu = client_->CreatePopupMenu(render_frame_host);
480 if (!menu) {
481 static_cast<content::RenderFrameHostImpl *>(
482 render_frame_host)->DidCancelPopupMenu();
483 return;
484 }
485
486 active_popup_menu_ = menu->GetWeakPtr();
487
488 menu->Show(bounds, items, selected_item, allow_multiple_selection);
489}
490
491void WebView::HidePopupMenu() {
492 if (!active_popup_menu_) {
493 return;
494 }
495
496 active_popup_menu_->Close();
497}
498
498content::WebContents* WebView::OpenURLFromTab(499content::WebContents* WebView::OpenURLFromTab(
499 content::WebContents* source,500 content::WebContents* source,
500 const content::OpenURLParams& params) {501 const content::OpenURLParams& params) {
@@ -874,15 +875,31 @@
874void WebView::RenderViewHostChanged(content::RenderViewHost* old_host,875void WebView::RenderViewHostChanged(content::RenderViewHost* old_host,
875 content::RenderViewHost* new_host) {876 content::RenderViewHost* new_host) {
876 if (old_host && old_host->GetView()) {877 if (old_host && old_host->GetView()) {
877 static_cast<RenderWidgetHostView *>(old_host->GetView())->SetDelegate(nullptr);878 RenderWidgetHostView* rwhv =
879 static_cast<RenderWidgetHostView*>(old_host->GetView());
880 rwhv->SetContainer(nullptr);
881 rwhv->ime_bridge()->SetContext(nullptr);
878 }882 }
883
879 if (new_host) {884 if (new_host) {
880 if (new_host->GetView()) {885 if (new_host->GetView()) {
881 static_cast<RenderWidgetHostView *>(new_host->GetView())->SetDelegate(this);886 RenderWidgetHostView* rwhv =
887 static_cast<RenderWidgetHostView*>(new_host->GetView());
888 rwhv->SetContainer(this);
889 rwhv->ime_bridge()->SetContext(client_->GetInputMethodContext());
882 }890 }
883891
884 InitializeTopControlsForHost(new_host, !old_host);892 InitializeTopControlsForHost(new_host, !old_host);
885 }893 }
894
895 if (old_host) {
896 return;
897 }
898
899 // For the initial view, we need to sync its visibility and focus state
900 // with us. For subsequent views, RFHM does this for us
901 VisibilityChanged();
902 FocusChanged();
886}903}
887904
888void WebView::DidStartProvisionalLoadForFrame(905void WebView::DidStartProvisionalLoadForFrame(
@@ -1067,6 +1084,7 @@
1067 compositor_->SetViewportSize(GetViewSizePix());1084 compositor_->SetViewportSize(GetViewSizePix());
1068 compositor_->SetVisibility(IsVisible());1085 compositor_->SetVisibility(IsVisible());
1069 compositor_->SetDeviceScaleFactor(GetScreenInfo().deviceScaleFactor);1086 compositor_->SetDeviceScaleFactor(GetScreenInfo().deviceScaleFactor);
1087 root_layer_->SetBounds(GetViewSizeDip());
10701088
1071 if (params.restore_entries.size() > 0) {1089 if (params.restore_entries.size() > 0) {
1072 ScopedVector<content::NavigationEntry> entries =1090 ScopedVector<content::NavigationEntry> entries =
@@ -1093,22 +1111,21 @@
10931111
1094 CommonInit(contents.Pass());1112 CommonInit(contents.Pass());
10951113
1096 RenderWidgetHostView* rwhv = GetRenderWidgetHostView();
1097 if (rwhv) {
1098 rwhv->SetDelegate(this);
1099 }
1100
1101 content::RenderViewHost* rvh = GetRenderViewHost();1114 content::RenderViewHost* rvh = GetRenderViewHost();
1102 if (rvh) {1115 if (rvh) {
1103 InitializeTopControlsForHost(rvh, true);1116 InitializeTopControlsForHost(rvh, true);
1104 }1117 }
11051118
1119 RenderWidgetHostView* rwhv = GetRenderWidgetHostView();
1120 if (rwhv) {
1121 rwhv->ime_bridge()->SetContext(client_->GetInputMethodContext());
1122 }
1123
1106 // Sync WebContents with the state of the WebView1124 // Sync WebContents with the state of the WebView
1107 WasResized();1125 WasResized();
1108 ScreenUpdated();1126 ScreenUpdated();
1109 VisibilityChanged();1127 VisibilityChanged();
1110 FocusChanged();1128 FocusChanged();
1111 InputPanelVisibilityChanged();
11121129
1113 // Update SSL Status1130 // Update SSL Status
1114 content::NavigationEntry* entry =1131 content::NavigationEntry* entry =
@@ -1125,21 +1142,24 @@
1125 this),1142 this),
1126 g_all_web_views.Get().end());1143 g_all_web_views.Get().end());
11271144
1145 WebContentsView::FromWebContents(web_contents_.get())->SetContainer(nullptr);
1146
1128 RenderWidgetHostView* rwhv = GetRenderWidgetHostView();1147 RenderWidgetHostView* rwhv = GetRenderWidgetHostView();
1129 if (rwhv) {1148 if (rwhv) {
1130 rwhv->SetDelegate(nullptr);1149 rwhv->ime_bridge()->SetContext(nullptr);
1131 }1150 }
11321151
1133 // Stop WebContents from calling back in to us1152 // Stop WebContents from calling back in to us
1134 content::WebContentsObserver::Observe(nullptr);1153 content::WebContentsObserver::Observe(nullptr);
11351154
1136 web_contents_->RemoveUserData(kWebViewKey);1155 web_contents_->RemoveUserData(&kUserDataKey);
1137}1156}
11381157
1139// static1158// static
1140WebView* WebView::FromWebContents(const content::WebContents* web_contents) {1159WebView* WebView::FromWebContents(const content::WebContents* web_contents) {
1141 WebViewUserData* data = static_cast<WebViewUserData *>(1160 UnownedUserData<WebView>* data =
1142 web_contents->GetUserData(kWebViewKey));1161 static_cast<UnownedUserData<WebView>*>(
1162 web_contents->GetUserData(&kUserDataKey));
1143 if (!data) {1163 if (!data) {
1144 return nullptr;1164 return nullptr;
1145 }1165 }
@@ -1275,11 +1295,9 @@
1275}1295}
12761296
1277void WebView::WasResized() {1297void WebView::WasResized() {
1278 {1298 compositor_->SetDeviceScaleFactor(GetScreenInfo().deviceScaleFactor);
1279 CompositorLock lock(compositor_.get());1299 compositor_->SetViewportSize(GetViewSizePix());
1280 compositor_->SetDeviceScaleFactor(GetScreenInfo().deviceScaleFactor);1300 root_layer_->SetBounds(GetViewSizeDip());
1281 compositor_->SetViewportSize(GetViewSizePix());
1282 }
12831301
1284 RenderWidgetHostView* rwhv = GetRenderWidgetHostView();1302 RenderWidgetHostView* rwhv = GetRenderWidgetHostView();
1285 if (rwhv) {1303 if (rwhv) {
@@ -1309,6 +1327,14 @@
1309 web_contents_->WasShown();1327 web_contents_->WasShown();
1310 } else {1328 } else {
1311 web_contents_->WasHidden();1329 web_contents_->WasHidden();
1330 // TODO: Have an eviction algorithm for LayerTreeHosts in Compositor, and
1331 // trigger eviction of the frontbuffer from a CompositorClient callback.
1332 // XXX: Also this isn't really necessary for eviction - after all, the LTH
1333 // owned by Compositor owns the frontbuffer (via its cc::OutputSurface).
1334 // This callback is really to notify the toolkit layer that the
1335 // frontbuffer is being dropped
1336 current_compositor_frame_ = nullptr;
1337 client_->EvictCurrentFrame();
1312 }1338 }
13131339
1314 MaybeScrollFocusedEditableNodeIntoView();1340 MaybeScrollFocusedEditableNodeIntoView();
@@ -1329,10 +1355,6 @@
1329 MaybeScrollFocusedEditableNodeIntoView();1355 MaybeScrollFocusedEditableNodeIntoView();
1330}1356}
13311357
1332void WebView::InputPanelVisibilityChanged() {
1333 MaybeScrollFocusedEditableNodeIntoView();
1334}
1335
1336void WebView::UpdateWebPreferences() {1358void WebView::UpdateWebPreferences() {
1337 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost();1359 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost();
1338 if (!rvh) {1360 if (!rvh) {
@@ -1605,43 +1627,6 @@
1605 web_contents_->DispatchBeforeUnload(false);1627 web_contents_->DispatchBeforeUnload(false);
1606}1628}
16071629
1608void WebView::ShowContextMenu(content::RenderFrameHost* render_frame_host,
1609 const content::ContextMenuParams& params) {
1610 WebContextMenu* menu = client_->CreateContextMenu(render_frame_host, params);
1611 if (!menu) {
1612 return;
1613 }
1614
1615 menu->Show();
1616}
1617
1618void WebView::ShowPopupMenu(content::RenderFrameHost* render_frame_host,
1619 const gfx::Rect& bounds,
1620 int selected_item,
1621 const std::vector<content::MenuItem>& items,
1622 bool allow_multiple_selection) {
1623 DCHECK(!active_popup_menu_);
1624
1625 WebPopupMenu* menu = client_->CreatePopupMenu(render_frame_host);
1626 if (!menu) {
1627 static_cast<content::RenderFrameHostImpl *>(
1628 render_frame_host)->DidCancelPopupMenu();
1629 return;
1630 }
1631
1632 active_popup_menu_ = menu->GetWeakPtr();
1633
1634 menu->Show(bounds, items, selected_item, allow_multiple_selection);
1635}
1636
1637void WebView::HidePopupMenu() {
1638 if (!active_popup_menu_) {
1639 return;
1640 }
1641
1642 active_popup_menu_->Close();
1643}
1644
1645void WebView::AllowCertificateError(1630void WebView::AllowCertificateError(
1646 content::RenderFrameHost* rfh,1631 content::RenderFrameHost* rfh,
1647 int cert_error,1632 int cert_error,
@@ -1727,34 +1712,6 @@
1727 rvh->ForwardWheelEvent(event);1712 rvh->ForwardWheelEvent(event);
1728}1713}
17291714
1730void WebView::ImeCommitText(const base::string16& text,
1731 const gfx::Range& replacement_range) {
1732 content::RenderWidgetHostImpl* host = GetRenderWidgetHostImpl();
1733 if (!host) {
1734 return;
1735 }
1736
1737 SendFakeCompositionKeyEvent(host, blink::WebInputEvent::RawKeyDown);
1738 host->ImeConfirmComposition(text, replacement_range, false);
1739 SendFakeCompositionKeyEvent(host, blink::WebInputEvent::KeyUp);
1740}
1741
1742void WebView::ImeSetComposingText(
1743 const base::string16& text,
1744 const std::vector<blink::WebCompositionUnderline>& underlines,
1745 const gfx::Range& selection_range) {
1746 content::RenderWidgetHostImpl* host = GetRenderWidgetHostImpl();
1747 if (!host) {
1748 return;
1749 }
1750
1751 SendFakeCompositionKeyEvent(host, blink::WebInputEvent::RawKeyDown);
1752 host->ImeSetComposition(text, underlines,
1753 selection_range.start(),
1754 selection_range.end());
1755 SendFakeCompositionKeyEvent(host, blink::WebInputEvent::KeyUp);
1756}
1757
1758void WebView::DownloadRequested(1715void WebView::DownloadRequested(
1759 const GURL& url,1716 const GURL& url,
1760 const std::string& mime_type,1717 const std::string& mime_type,
@@ -1810,10 +1767,6 @@
1810 return client_->HasFocus();1767 return client_->HasFocus();
1811}1768}
18121769
1813bool WebView::IsInputPanelVisible() const {
1814 return client_->IsInputPanelVisible();
1815}
1816
1817JavaScriptDialog* WebView::CreateJavaScriptDialog(1770JavaScriptDialog* WebView::CreateJavaScriptDialog(
1818 content::JavaScriptMessageType javascript_message_type) {1771 content::JavaScriptMessageType javascript_message_type) {
1819 return client_->CreateJavaScriptDialog(javascript_message_type);1772 return client_->CreateJavaScriptDialog(javascript_message_type);
@@ -1837,23 +1790,5 @@
1837 return client_->CanCreateWindows();1790 return client_->CanCreateWindows();
1838}1791}
18391792
1840base::string16 WebView::GetSelectedText() const {
1841 RenderWidgetHostView* rwhv = GetRenderWidgetHostView();
1842 if (!rwhv) {
1843 return base::string16();
1844 }
1845
1846 return rwhv->GetSelectedText();
1847}
1848
1849const base::string16& WebView::GetSelectionText() const {
1850 RenderWidgetHostView* rwhv = GetRenderWidgetHostView();
1851 if (!rwhv) {
1852 return base::EmptyString16();
1853 }
1854
1855 return rwhv->selection_text();
1856}
1857
1858} // namespace oxide1793} // namespace oxide
18591794
18601795
=== modified file 'shared/browser/oxide_web_view.h'
--- shared/browser/oxide_web_view.h 2015-10-08 15:56:22 +0000
+++ shared/browser/oxide_web_view.h 2015-10-21 17:31:00 +0000
@@ -39,16 +39,16 @@
39#include "content/public/common/resource_type.h"39#include "content/public/common/resource_type.h"
40#include "third_party/WebKit/public/platform/WebScreenInfo.h"40#include "third_party/WebKit/public/platform/WebScreenInfo.h"
41#include "third_party/WebKit/public/platform/WebTopControlsState.h"41#include "third_party/WebKit/public/platform/WebTopControlsState.h"
42#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
43#include "ui/base/ime/text_input_type.h"
44#include "ui/gfx/geometry/point.h"42#include "ui/gfx/geometry/point.h"
45#include "ui/gfx/geometry/rect.h"43#include "ui/gfx/geometry/rect.h"
46#include "ui/gfx/geometry/size.h"44#include "ui/gfx/geometry/size.h"
4745
48#include "shared/browser/compositor/oxide_compositor_client.h"46#include "shared/browser/compositor/oxide_compositor_client.h"
47#include "shared/browser/compositor/oxide_compositor_observer.h"
48#include "shared/browser/input/oxide_input_method_context_observer.h"
49#include "shared/browser/oxide_certificate_error.h"49#include "shared/browser/oxide_certificate_error.h"
50#include "shared/browser/oxide_content_types.h"50#include "shared/browser/oxide_content_types.h"
51#include "shared/browser/oxide_render_widget_host_view_delegate.h"51#include "shared/browser/oxide_render_widget_host_view_container.h"
52#include "shared/browser/oxide_script_message_target.h"52#include "shared/browser/oxide_script_message_target.h"
53#include "shared/browser/oxide_security_status.h"53#include "shared/browser/oxide_security_status.h"
54#include "shared/browser/oxide_security_types.h"54#include "shared/browser/oxide_security_types.h"
@@ -63,10 +63,12 @@
63class WebMouseWheelEvent;63class WebMouseWheelEvent;
64} // namespace blink64} // namespace blink
6565
66namespace cc {
67class SolidColorLayer;
68}
69
66namespace content {70namespace content {
6771
68struct ContextMenuParams;
69struct MenuItem;
70class NativeWebKeyboardEvent;72class NativeWebKeyboardEvent;
71class NotificationRegistrar;73class NotificationRegistrar;
72struct OpenURLParams;74struct OpenURLParams;
@@ -75,7 +77,6 @@
75class RenderWidgetHostImpl;77class RenderWidgetHostImpl;
76class WebContents;78class WebContents;
77class WebContentsImpl;79class WebContentsImpl;
78class WebCursor;
7980
80} // namespace content81} // namespace content
8182
@@ -129,10 +130,12 @@
129// This is the main webview class. Implementations should customize this by130// This is the main webview class. Implementations should customize this by
130// providing an implementation of WebViewClient131// providing an implementation of WebViewClient
131class WebView : public ScriptMessageTarget,132class WebView : public ScriptMessageTarget,
133 private InputMethodContextObserver,
134 private CompositorObserver,
132 private CompositorClient,135 private CompositorClient,
133 private WebPreferencesObserver,136 private WebPreferencesObserver,
134 private content::NotificationObserver,137 private content::NotificationObserver,
135 private RenderWidgetHostViewDelegate,138 private RenderWidgetHostViewContainer,
136 private content::WebContentsDelegate,139 private content::WebContentsDelegate,
137 private content::WebContentsObserver {140 private content::WebContentsObserver {
138 public:141 public:
@@ -199,7 +202,6 @@
199 void ScreenUpdated();202 void ScreenUpdated();
200 void VisibilityChanged();203 void VisibilityChanged();
201 void FocusChanged();204 void FocusChanged();
202 void InputPanelVisibilityChanged();
203 void UpdateWebPreferences();205 void UpdateWebPreferences();
204206
205 BrowserContext* GetBrowserContext() const;207 BrowserContext* GetBrowserContext() const;
@@ -259,15 +261,6 @@
259261
260 void PrepareToClose();262 void PrepareToClose();
261263
262 void ShowContextMenu(content::RenderFrameHost* render_frame_host,
263 const content::ContextMenuParams& params);
264 void ShowPopupMenu(content::RenderFrameHost* render_frame_host,
265 const gfx::Rect& bounds,
266 int selected_item,
267 const std::vector<content::MenuItem>& items,
268 bool allow_multiple_selection);
269 void HidePopupMenu();
270
271 void AllowCertificateError(content::RenderFrameHost* rfh,264 void AllowCertificateError(content::RenderFrameHost* rfh,
272 int cert_error,265 int cert_error,
273 const net::SSLInfo& ssl_info,266 const net::SSLInfo& ssl_info,
@@ -283,13 +276,6 @@
283 void HandleTouchEvent(const ui::TouchEvent& event);276 void HandleTouchEvent(const ui::TouchEvent& event);
284 void HandleWheelEvent(const blink::WebMouseWheelEvent& event);277 void HandleWheelEvent(const blink::WebMouseWheelEvent& event);
285278
286 void ImeCommitText(const base::string16& text,
287 const gfx::Range& replacement_range);
288 void ImeSetComposingText(
289 const base::string16& text,
290 const std::vector<blink::WebCompositionUnderline>& underlines,
291 const gfx::Range& selection_range);
292
293 void DownloadRequested(279 void DownloadRequested(
294 const GURL& url,280 const GURL& url,
295 const std::string& mime_type,281 const std::string& mime_type,
@@ -309,7 +295,6 @@
309 gfx::Rect GetViewBoundsPix() const;295 gfx::Rect GetViewBoundsPix() const;
310 bool IsVisible() const;296 bool IsVisible() const;
311 bool HasFocus() const;297 bool HasFocus() const;
312 bool IsInputPanelVisible() const;
313298
314 JavaScriptDialog* CreateJavaScriptDialog(299 JavaScriptDialog* CreateJavaScriptDialog(
315 content::JavaScriptMessageType javascript_message_type);300 content::JavaScriptMessageType javascript_message_type);
@@ -319,17 +304,6 @@
319304
320 bool CanCreateWindows() const;305 bool CanCreateWindows() const;
321306
322 ui::TextInputType text_input_type() const { return text_input_type_; }
323 bool show_ime_if_needed() const { return show_ime_if_needed_; }
324 bool focused_node_is_editable() const { return focused_node_is_editable_; }
325
326 gfx::Rect caret_rect() const { return caret_rect_; }
327 size_t selection_cursor_position() const { return selection_cursor_position_; }
328 size_t selection_anchor_position() const { return selection_anchor_position_; }
329
330 base::string16 GetSelectedText() const;
331 const base::string16& GetSelectionText() const;
332
333 private:307 private:
334 WebView(WebViewClient* client);308 WebView(WebViewClient* client);
335309
@@ -364,8 +338,13 @@
364 virtual const ScriptMessageHandler* GetScriptMessageHandlerAt(338 virtual const ScriptMessageHandler* GetScriptMessageHandlerAt(
365 size_t index) const override;339 size_t index) const override;
366340
341 // InputMethodContextObserver implementation
342 void InputPanelVisibilityChanged() override;
343
344 // CompositorObserver implementation
345 void CompositorDidCommit() final;
346
367 // CompositorClient implementation347 // CompositorClient implementation
368 void CompositorDidCommit() final;
369 void CompositorSwapFrame(CompositorFrameHandle* handle) final;348 void CompositorSwapFrame(CompositorFrameHandle* handle) final;
370349
371 // WebPreferencesObserver implementation350 // WebPreferencesObserver implementation
@@ -376,18 +355,20 @@
376 const content::NotificationSource& source,355 const content::NotificationSource& source,
377 const content::NotificationDetails& details) final;356 const content::NotificationDetails& details) final;
378357
379 // RenderWidgetHostViewDelegate implementation358 // RenderWidgetHostViewContainer implementation
380 void EvictCurrentFrame() final;
381 void UpdateCursor(const content::WebCursor& cursor) final;
382 void TextInputStateChanged(ui::TextInputType type,
383 bool show_ime_if_needed) final;
384 void FocusedNodeChanged(bool is_editable_node) final;
385 void ImeCancelComposition() final;
386 void SelectionBoundsChanged(const gfx::Rect& caret_rect,
387 size_t selection_cursor_position,
388 size_t selection_anchor_position) final;
389 void SelectionChanged() final;
390 Compositor* GetCompositor() const final;359 Compositor* GetCompositor() const final;
360 void AttachLayer(scoped_refptr<cc::Layer> layer) final;
361 void DetachLayer(scoped_refptr<cc::Layer> layer) final;
362 void CursorChanged() final;
363 bool HasFocus(const RenderWidgetHostView* view) const final;
364 void ShowContextMenu(content::RenderFrameHost* render_frame_host,
365 const content::ContextMenuParams& params) final;
366 void ShowPopupMenu(content::RenderFrameHost* render_frame_host,
367 const gfx::Rect& bounds,
368 int selected_item,
369 const std::vector<content::MenuItem>& items,
370 bool allow_multiple_selection) final;
371 void HidePopupMenu() final;
391372
392 // content::WebContentsDelegate implementation373 // content::WebContentsDelegate implementation
393 content::WebContents* OpenURLFromTab(content::WebContents* source,374 content::WebContents* OpenURLFromTab(content::WebContents* source,
@@ -502,14 +483,6 @@
502483
503 WebViewClient* client_;484 WebViewClient* client_;
504485
505 ui::TextInputType text_input_type_;
506 bool show_ime_if_needed_;
507 bool focused_node_is_editable_;
508
509 gfx::Rect caret_rect_;
510 size_t selection_cursor_position_;
511 size_t selection_anchor_position_;
512
513 struct WebContentsDeleter {486 struct WebContentsDeleter {
514 void operator()(content::WebContents* contents);487 void operator()(content::WebContents* contents);
515 };488 };
@@ -520,6 +493,7 @@
520 WebViewContentsHelper* web_contents_helper_;493 WebViewContentsHelper* web_contents_helper_;
521494
522 scoped_ptr<Compositor> compositor_;495 scoped_ptr<Compositor> compositor_;
496 scoped_refptr<cc::SolidColorLayer> root_layer_;
523497
524 scoped_refptr<CompositorFrameHandle> current_compositor_frame_;498 scoped_refptr<CompositorFrameHandle> current_compositor_frame_;
525 std::vector<scoped_refptr<CompositorFrameHandle> > previous_compositor_frames_;499 std::vector<scoped_refptr<CompositorFrameHandle> > previous_compositor_frames_;
526500
=== modified file 'shared/browser/oxide_web_view_client.cc'
--- shared/browser/oxide_web_view_client.cc 2015-10-08 15:56:22 +0000
+++ shared/browser/oxide_web_view_client.cc 2015-10-21 17:31:00 +0000
@@ -23,10 +23,6 @@
2323
24WebViewClient::~WebViewClient() {}24WebViewClient::~WebViewClient() {}
2525
26bool WebViewClient::IsInputPanelVisible() const {
27 return false;
28}
29
30JavaScriptDialog* WebViewClient::CreateJavaScriptDialog(26JavaScriptDialog* WebViewClient::CreateJavaScriptDialog(
31 content::JavaScriptMessageType javascript_message_type) {27 content::JavaScriptMessageType javascript_message_type) {
32 return nullptr;28 return nullptr;
@@ -137,15 +133,9 @@
137133
138void WebViewClient::EvictCurrentFrame() {}134void WebViewClient::EvictCurrentFrame() {}
139135
140void WebViewClient::TextInputStateChanged() {}136InputMethodContext* WebViewClient::GetInputMethodContext() const {
141137 return nullptr;
142void WebViewClient::FocusedNodeChanged() {}138}
143
144void WebViewClient::SelectionBoundsChanged() {}
145
146void WebViewClient::ImeCancelComposition() {}
147
148void WebViewClient::SelectionChanged() {}
149139
150void WebViewClient::UpdateCursor(const content::WebCursor& cursor) {}140void WebViewClient::UpdateCursor(const content::WebCursor& cursor) {}
151141
152142
=== modified file 'shared/browser/oxide_web_view_client.h'
--- shared/browser/oxide_web_view_client.h 2015-10-08 15:56:22 +0000
+++ shared/browser/oxide_web_view_client.h 2015-10-21 17:31:00 +0000
@@ -48,6 +48,7 @@
4848
49class CertificateError;49class CertificateError;
50class FilePicker;50class FilePicker;
51class InputMethodContext;
51class JavaScriptDialog;52class JavaScriptDialog;
52class ResourceDispatcherHostLoginDelegate;53class ResourceDispatcherHostLoginDelegate;
53class SecurityStatus;54class SecurityStatus;
@@ -69,9 +70,6 @@
6970
70 virtual bool HasFocus() const = 0;71 virtual bool HasFocus() const = 0;
7172
72 // XXX(chrisccoulson): This is global state, so it doesn't belong here
73 virtual bool IsInputPanelVisible() const;
74
75 // TODO(chrisccoulson): Make a delegate for JavaScriptDialogManager and move there73 // TODO(chrisccoulson): Make a delegate for JavaScriptDialogManager and move there
76 virtual JavaScriptDialog* CreateJavaScriptDialog(74 virtual JavaScriptDialog* CreateJavaScriptDialog(
77 content::JavaScriptMessageType javascript_message_type);75 content::JavaScriptMessageType javascript_message_type);
@@ -168,20 +166,7 @@
168166
169 virtual void EvictCurrentFrame();167 virtual void EvictCurrentFrame();
170168
171 // XXX(chrisccoulson): Rethink all of these IME related bits:169 virtual InputMethodContext* GetInputMethodContext() const;
172 // - Move some logic down from qt/ to shared/
173 // - The implementations of some of these only touch process-global
174 // stuff - should we have an InputMethod singleton in shared/
175 // rather than dumping it all in WebView?
176 virtual void TextInputStateChanged();
177
178 virtual void FocusedNodeChanged();
179
180 virtual void SelectionBoundsChanged();
181
182 virtual void ImeCancelComposition();
183
184 virtual void SelectionChanged();
185170
186 virtual void UpdateCursor(const content::WebCursor& cursor);171 virtual void UpdateCursor(const content::WebCursor& cursor);
187172
188173
=== added file 'shared/common/oxide_unowned_user_data.h'
--- shared/common/oxide_unowned_user_data.h 1970-01-01 00:00:00 +0000
+++ shared/common/oxide_unowned_user_data.h 2015-10-21 17:31:00 +0000
@@ -0,0 +1,41 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2013-2015 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#ifndef _OXIDE_SHARED_COMMON_UNOWNED_USER_DATA_H_
19#define _OXIDE_SHARED_COMMON_UNOWNED_USER_DATA_H_
20
21#include "base/macros.h"
22#include "base/supports_user_data.h"
23
24namespace {
25
26template <class T>
27class UnownedUserData : public base::SupportsUserData::Data {
28 public:
29 UnownedUserData(T* ptr) : ptr_(ptr) {}
30
31 T* get() const { return ptr_; }
32
33 private:
34 T* ptr_;
35
36 DISALLOW_COPY_AND_ASSIGN(UnownedUserData);
37};
38
39} // namespace oxide
40
41#endif // _OXIDE_SHARED_COMMON_UNOWNED_USER_DATA_H_
042
=== modified file 'shared/shared.gyp'
--- shared/shared.gyp 2015-10-08 15:56:22 +0000
+++ shared/shared.gyp 2015-10-21 17:31:00 +0000
@@ -293,6 +293,8 @@
293 'browser/compositor/oxide_compositor_frame_handle.h',293 'browser/compositor/oxide_compositor_frame_handle.h',
294 'browser/compositor/oxide_compositor_gpu_shims.cc',294 'browser/compositor/oxide_compositor_gpu_shims.cc',
295 'browser/compositor/oxide_compositor_gpu_shims.h',295 'browser/compositor/oxide_compositor_gpu_shims.h',
296 'browser/compositor/oxide_compositor_observer.cc',
297 'browser/compositor/oxide_compositor_observer.h',
296 'browser/compositor/oxide_compositor_output_surface.cc',298 'browser/compositor/oxide_compositor_output_surface.cc',
297 'browser/compositor/oxide_compositor_output_surface.h',299 'browser/compositor/oxide_compositor_output_surface.h',
298 'browser/compositor/oxide_compositor_output_surface_gl.cc',300 'browser/compositor/oxide_compositor_output_surface_gl.cc',
@@ -307,6 +309,14 @@
307 'browser/compositor/oxide_compositor_utils.h',309 'browser/compositor/oxide_compositor_utils.h',
308 'browser/compositor/oxide_mailbox_buffer_map.cc',310 'browser/compositor/oxide_mailbox_buffer_map.cc',
309 'browser/compositor/oxide_mailbox_buffer_map.h',311 'browser/compositor/oxide_mailbox_buffer_map.h',
312 'browser/input/oxide_ime_bridge.cc',
313 'browser/input/oxide_ime_bridge.h',
314 'browser/input/oxide_ime_bridge_impl.cc',
315 'browser/input/oxide_ime_bridge_impl.h',
316 'browser/input/oxide_input_method_context.cc',
317 'browser/input/oxide_input_method_context.h',
318 'browser/input/oxide_input_method_context_observer.cc',
319 'browser/input/oxide_input_method_context_observer.h',
310 'browser/media/oxide_media_capture_devices_context.cc',320 'browser/media/oxide_media_capture_devices_context.cc',
311 'browser/media/oxide_media_capture_devices_context.h',321 'browser/media/oxide_media_capture_devices_context.h',
312 'browser/media/oxide_media_capture_devices_context_client.h',322 'browser/media/oxide_media_capture_devices_context_client.h',
@@ -401,7 +411,7 @@
401 'browser/oxide_render_process_initializer.h',411 'browser/oxide_render_process_initializer.h',
402 'browser/oxide_render_widget_host_view.cc',412 'browser/oxide_render_widget_host_view.cc',
403 'browser/oxide_render_widget_host_view.h',413 'browser/oxide_render_widget_host_view.h',
404 'browser/oxide_render_widget_host_view_delegate.h',414 'browser/oxide_render_widget_host_view_container.h',
405 'browser/oxide_resource_dispatcher_host_delegate.cc',415 'browser/oxide_resource_dispatcher_host_delegate.cc',
406 'browser/oxide_resource_dispatcher_host_delegate.h',416 'browser/oxide_resource_dispatcher_host_delegate.h',
407 'browser/oxide_resource_dispatcher_host_login_delegate.cc',417 'browser/oxide_resource_dispatcher_host_login_delegate.cc',
@@ -498,6 +508,7 @@
498 'common/oxide_script_message_params.h',508 'common/oxide_script_message_params.h',
499 'common/oxide_script_message_request.cc',509 'common/oxide_script_message_request.cc',
500 'common/oxide_script_message_request.h',510 'common/oxide_script_message_request.h',
511 'common/oxide_unowned_user_data.h',
501 'common/oxide_user_agent.cc',512 'common/oxide_user_agent.cc',
502 'common/oxide_user_agent.h',513 'common/oxide_user_agent.h',
503 'common/oxide_user_agent_override_set.cc',514 'common/oxide_user_agent_override_set.cc',

Subscribers

People subscribed via source and target branches