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

Unified Diff: chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus.js

Issue 2451143003: <webview>: Correctly shift focus between WebContents. (Closed)
Patch Set: Fix creis comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus.js
diff --git a/chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus.js b/chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus.js
index eebf6aced8e45bc9a28eaa785ab2d5fef196151a..7713db15fa7cbddebc14d9e39d71fc9c2ea21b16 100644
--- a/chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus.js
+++ b/chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus.js
@@ -7,6 +7,9 @@ var inputElement;
var waitingForBlur = false;
var seenBlurAfterFocus = false;
+var seenEvent = {};
+var waitingEvent = {};
+
var LOG = function(msg) {
window.console.log(msg);
};
@@ -72,6 +75,27 @@ var getInputValue = function() {
}
}
+var monitorEvent = function(type) {
+ var listener = function(e) {
+ seenEvent[type] = true;
+ if (waitingEvent[type]) {
+ sendMessage(['response-waitEvent', type]);
+ }
+ window.removeEventListener(type, listener);
+ };
+ seenEvent[type] = false;
+ waitingEvent[type] = false;
+ window.addEventListener(type, listener);
+}
+
+var waitEvent = function(type) {
+ if (seenEvent[type]) {
+ sendMessage(['response-waitEvent', type]);
+ } else {
+ waitingEvent[type] = true;
+ }
+}
+
window.addEventListener('message', function(e) {
var data = JSON.parse(e.data);
if (data[0] == 'connect') {
@@ -88,6 +112,10 @@ window.addEventListener('message', function(e) {
createInput(data[1]);
} else if (data[0] == 'request-getInputValue') {
getInputValue();
+ } else if (data[0] == 'request-monitorEvent') {
+ monitorEvent(data[1]);
+ } else if (data[0] == 'request-waitEvent') {
+ waitEvent(data[1]);
}
});
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js ('k') | content/browser/frame_host/frame_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698