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

Unified Diff: chrome/browser/resources/shared/js/cr/ui/focus_outline_manager.js

Issue 11962043: Move webui resources from chrome\browser\resources\shared to ui\webui\resources. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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/browser/resources/shared/js/cr/ui/focus_outline_manager.js
===================================================================
--- chrome/browser/resources/shared/js/cr/ui/focus_outline_manager.js (revision 177292)
+++ chrome/browser/resources/shared/js/cr/ui/focus_outline_manager.js (working copy)
@@ -1,84 +0,0 @@
-// Copyright (c) 2012 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('cr.ui', function() {
-
- /**
- * The class name to set on the document element.
- * @const
- */
- var CLASS_NAME = 'focus-outline-visible';
-
- /**
- * This class sets a CSS class name on the HTML element of |doc| when the user
- * presses the tab key. It removes the class name when the user clicks
- * anywhere.
- *
- * This allows you to write CSS like this:
- *
- * html.focus-outline-visible my-element:focus {
- * outline: 5px auto -webkit-focus-ring-color;
- * }
- *
- * And the outline will only be shown if the user uses the keyboard to get to
- * it.
- *
- * @param {Document} doc The document to attach the focus outline manager to.
- * @constructor
- */
- function FocusOutlineManager(doc) {
- this.classList_ = doc.documentElement.classList;
- var self = this;
- doc.addEventListener('keydown', function(e) {
- if (e.keyCode == 9) // Tab
- self.visible = true;
- }, true);
-
- doc.addEventListener('mousedown', function(e) {
- self.visible = false;
- }, true);
- }
-
- FocusOutlineManager.prototype = {
- /**
- * Whether the focus outline should be visible.
- * @type {boolean}
- */
- set visible(visible) {
- if (visible)
- this.classList_.add(CLASS_NAME);
- else
- this.classList_.remove(CLASS_NAME);
- },
- get visible() {
- this.classList_.contains(CLASS_NAME);
- }
- };
-
- /**
- * Array of Document and FocusOutlineManager pairs.
- * @type {Array}
- */
- var docsToManager = [];
-
- /**
- * Gets a per document sigleton focus outline manager.
- * @param {Document} doc The document to get the |FocusOutlineManager| for.
- * @return {FocusOutlineManager} The per document singleton focus outline
- * manager.
- */
- FocusOutlineManager.forDocument = function(doc) {
- for (var i = 0; i < docsToManager.length; i++) {
- if (doc == docsToManager[i][0])
- return docsToManager[i][1];
- }
- var manager = new FocusOutlineManager(doc);
- docsToManager.push([doc, manager]);
- return manager;
- };
-
- return {
- FocusOutlineManager: FocusOutlineManager
- };
-});
« no previous file with comments | « chrome/browser/resources/shared/js/cr/ui/focus_manager.js ('k') | chrome/browser/resources/shared/js/cr/ui/grid.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698