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

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

Issue 11882045: Revert 176910 - Possible breakage of PlatformAppBrowserTest.Messaging (Closed) Base URL: svn://svn.chromium.org/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/bubble_button.js
===================================================================
--- chrome/browser/resources/shared/js/cr/ui/bubble_button.js (revision 176923)
+++ chrome/browser/resources/shared/js/cr/ui/bubble_button.js (working copy)
@@ -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
- };
-});
« no previous file with comments | « chrome/browser/resources/shared/css/bubble_button.css ('k') | chrome/browser/resources/shared_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698