Roll src/third_party/WebKit aa8346d:dbb8a38 (svn 202629:202630)
[chromium-blink-merge.git] / chrome / browser / resources / print_preview / print_preview_focus_manager.js
blobb5d74efdc21becda696c0e1517ffdbe2b0efe5ad
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 cr.define('print_preview', function() {
6 'use strict';
8 /**
9 * FocusManager implementation specialized for Print Preview, which ensures
10 * that Print Preview itself does not receive focus when an overlay is shown.
11 * @constructor
12 * @extends {cr.ui.FocusManager}
14 function PrintPreviewFocusManager() {
17 cr.addSingletonGetter(PrintPreviewFocusManager);
19 PrintPreviewFocusManager.prototype = {
20 __proto__: cr.ui.FocusManager.prototype,
22 /** @override */
23 getFocusParent: function() {
24 var el = document.body;
25 var newEl = null;
26 while (newEl = el.querySelector('.overlay:not([hidden])'))
27 el = newEl;
28 return el;
32 // Export
33 return {
34 PrintPreviewFocusManager: PrintPreviewFocusManager
36 });