Index: chrome/browser/resources/print_preview/print_preview_focus_manager.js |
diff --git a/chrome/browser/resources/print_preview/print_preview_focus_manager.js b/chrome/browser/resources/print_preview/print_preview_focus_manager.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fd2408753336c24653555dd3fba21ab88943b87a |
--- /dev/null |
+++ b/chrome/browser/resources/print_preview/print_preview_focus_manager.js |
@@ -0,0 +1,32 @@ |
+// Copyright 2014 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. |
+ |
+cr.define('print_preview', function() { |
+ 'use strict'; |
+ |
+ /** |
+ * FocusManager implementation specialized for Print Preview, which ensures |
+ * that Print Preview itself does not receive focus when an overlay is shown. |
+ * @constructor |
+ */ |
+ function PrintPreviewFocusManager() { |
+ }; |
+ |
+ cr.addSingletonGetter(PrintPreviewFocusManager); |
+ |
+ PrintPreviewFocusManager.prototype = { |
+ __proto__: cr.ui.FocusManager.prototype, |
+ |
+ /** @override */ |
+ getFocusParent: function() { |
+ return document.querySelector('.overlay:not([hidden])') || |
+ document.body; |
+ } |
+ }; |
+ |
+ // Export |
+ return { |
+ PrintPreviewFocusManager: PrintPreviewFocusManager |
+ }; |
+}); |