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

Unified Diff: chrome/test/data/extensions/platform_apps/web_view/focus/guest.html

Issue 14272003: <webview>: Focusing <webview> should propagate to BrowserPlugin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved to web_view_interactive_browsertest.cc Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/platform_apps/web_view/focus/guest.html
diff --git a/chrome/test/data/extensions/platform_apps/web_view/focus/guest.html b/chrome/test/data/extensions/platform_apps/web_view/focus/guest.html
new file mode 100644
index 0000000000000000000000000000000000000000..956293278f633906706d1cf9add89a113e5e8811
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/web_view/focus/guest.html
@@ -0,0 +1,44 @@
+<!--
+ * Copyright 2013 The Chromium Authors. All rights reserved. Use of this
+ * source code is governed by a BSD-style license that can be found in the
+ * LICENSE file.
+-->
+<html>
+ <head>
+ <script type="text/javascript">
+ // A guest that monitors focus.
+ // Notifies the embedder about changes in focus via postMessage.
+ // Note that the embedder has to initiate a postMessage first so that
+ // the guest has a reference to the embedder's window.
+
+ // The window reference of the embedder to send post message reply.
+ var embedderWindowChannel = null;
+ var embedderTestName = '';
+
+ var notifyEmbedder = function(msg_array) {
+ embedderWindowChannel.postMessage(JSON.stringify(msg_array), '*');
+ };
+
+ var onPostMessageReceived = function(e) {
+ embedderWindowChannel = e.source;
+ var data = JSON.parse(e.data);
+ if (data[0] == 'create-channel') {
+ embedderTestName = data[1];
+ notifyEmbedder(['channel-created']);
+ }
+ };
+ window.addEventListener('message', onPostMessageReceived, false);
+
+ window.addEventListener('focus', function(e) {
+ notifyEmbedder(['focused', embedderTestName]);
+ });
+
+ window.addEventListener('blur', function(e) {
+ notifyEmbedder(['blurred', embedderTestName]);
+ });
+ </script>
+ </head>
+ <body>
+ <div>This is a guest that monitors focus.</div>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698