summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/shared
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/resources/shared')
-rw-r--r--chrome/browser/resources/shared/css/bubble_button.css20
-rw-r--r--chrome/browser/resources/shared/js/cr/ui/bubble_button.js84
2 files changed, 0 insertions, 104 deletions
diff --git a/chrome/browser/resources/shared/css/bubble_button.css b/chrome/browser/resources/shared/css/bubble_button.css
deleted file mode 100644
index 5f37ed2..0000000
--- a/chrome/browser/resources/shared/css/bubble_button.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (c) 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.
- */
-
-.bubble-button {
- display: inline-block;
- height: 0;
- line-height: 1;
- vertical-align: middle;
- width: 16px;
-}
-
-.bubble-button > div {
- background-size: 16px;
- height: 16px;
- position: relative;
- top: -8px;
- width: 16px;
-}
diff --git a/chrome/browser/resources/shared/js/cr/ui/bubble_button.js b/chrome/browser/resources/shared/js/cr/ui/bubble_button.js
deleted file mode 100644
index 7216a2d..0000000
--- a/chrome/browser/resources/shared/js/cr/ui/bubble_button.js
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) 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.
-
-cr.define('cr.ui', function() {
- /**
- * An image button that brings up an informative bubble when activated by
- * keyboard or mouse.
- * @constructor
- * @extends {HTMLSpanElement}
- */
- var BubbleButton = cr.ui.define('span');
-
- BubbleButton.prototype = {
- __proto__: HTMLSpanElement.prototype,
-
- /**
- * Decorates the base element to show the proper icon.
- */
- decorate: function() {
- this.className = 'bubble-button';
- this.location = cr.ui.ArrowLocation.TOP_END;
- this.image = document.createElement('div');
- this.image.tabIndex = 0;
- this.image.setAttribute('role', 'button');
- this.image.addEventListener('click', this);
- this.image.addEventListener('keydown', this);
- this.image.addEventListener('mousedown', this);
- this.appendChild(this.image);
- },
-
- /**
- * Whether the button is currently showing a bubble.
- * @type {boolean}
- */
- get showingBubble() {
- return this.image.classList.contains('showing-bubble');
- },
- set showingBubble(showing) {
- this.image.classList.toggle('showing-bubble', showing);
- },
-
- /**
- * Handle mouse and keyboard events, allowing the user to open and close an
- * informative bubble.
- * @param {Event} event Mouse or keyboard event.
- */
- handleEvent: function(event) {
- switch (event.type) {
- // Toggle the bubble on left click. Let any other clicks propagate.
- case 'click':
- if (event.button != 0)
- return;
- break;
- // Toggle the bubble when <Return> or <Space> is pressed. Let any other
- // key presses propagate.
- case 'keydown':
- switch (event.keyCode) {
- case 13: // Return.
- case 32: // Space.
- break;
- default:
- return;
- }
- break;
- // Blur focus when a mouse button is pressed, matching the behavior of
- // other Web UI elements.
- case 'mousedown':
- if (document.activeElement)
- document.activeElement.blur();
- event.preventDefault();
- return;
- }
- this.toggleBubble_();
- event.preventDefault();
- event.stopPropagation();
- },
- };
-
- // Export.
- return {
- BubbleButton: BubbleButton
- };
-});