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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!--
2 * Copyright 2013 The Chromium Authors. All rights reserved. Use of this
3 * source code is governed by a BSD-style license that can be found in the
4 * LICENSE file.
5 -->
6 <html>
7 <head>
8 <script type="text/javascript">
9 // A guest that monitors focus.
10 // Notifies the embedder about changes in focus via postMessage.
11 // Note that the embedder has to initiate a postMessage first so that
12 // the guest has a reference to the embedder's window.
13
14 // The window reference of the embedder to send post message reply.
15 var embedderWindowChannel = null;
16 var embedderTestName = '';
17
18 var notifyEmbedder = function(msg_array) {
19 embedderWindowChannel.postMessage(JSON.stringify(msg_array), '*');
20 };
21
22 var onPostMessageReceived = function(e) {
23 embedderWindowChannel = e.source;
24 var data = JSON.parse(e.data);
25 if (data[0] == 'create-channel') {
26 embedderTestName = data[1];
27 notifyEmbedder(['channel-created']);
28 }
29 };
30 window.addEventListener('message', onPostMessageReceived, false);
31
32 window.addEventListener('focus', function(e) {
33 notifyEmbedder(['focused', embedderTestName]);
34 });
35
36 window.addEventListener('blur', function(e) {
37 notifyEmbedder(['blurred', embedderTestName]);
38 });
39 </script>
40 </head>
41 <body>
42 <div>This is a guest that monitors focus.</div>
43 </body>
44 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698