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

Unified Diff: chrome/browser/resources/options/options_bubble.js

Issue 11854012: Rename options.OptionsBubble to cr.ui.AutoCloseBubble (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove obsoleted CSS declaration. 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
« no previous file with comments | « no previous file | chrome/browser/resources/options/options_bundle.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/options_bubble.js
diff --git a/chrome/browser/resources/options/options_bubble.js b/chrome/browser/resources/options/options_bubble.js
deleted file mode 100644
index faa7cbbb9412ce1634bc3e1ac27ddbc8406c8890..0000000000000000000000000000000000000000
--- a/chrome/browser/resources/options/options_bubble.js
+++ /dev/null
@@ -1,112 +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('options', function() {
- var BubbleBase = cr.ui.BubbleBase;
-
- var OptionsBubble = cr.ui.define('div');
-
- OptionsBubble.prototype = {
- // Set up the prototype chain.
- __proto__: BubbleBase.prototype,
-
- /**
- * Initialization function for the cr.ui framework.
- */
- decorate: function() {
- BubbleBase.prototype.decorate.call(this);
- this.classList.add('options-bubble');
- },
-
- /**
- * Set the DOM sibling node, i.e. the node as whose sibling the bubble
- * should join the DOM to ensure that focusable elements inside the bubble
- * follow the target element in the document's tab order. Only available
- * when the bubble is not being shown.
- * @param {HTMLElement} node The new DOM sibling node.
- */
- set domSibling(node) {
- if (!this.hidden)
- return;
-
- this.domSibling_ = node;
- },
-
- /**
- * Show the bubble.
- */
- show: function() {
- if (!this.hidden)
- return;
-
- BubbleBase.prototype.show.call(this);
- this.domSibling_.showingBubble = true;
-
- var doc = this.ownerDocument;
- this.eventTracker_.add(doc, 'mousewheel', this, true);
- this.eventTracker_.add(doc, 'scroll', this, true);
- this.eventTracker_.add(doc, 'elementFocused', this, true);
- this.eventTracker_.add(window, 'resize', this);
- },
-
- /**
- * Hide the bubble.
- */
- hide: function() {
- BubbleBase.prototype.hide.call(this);
- this.domSibling_.showingBubble = false;
- },
-
- /**
- * Handle events, closing the bubble when the user clicks or moves the focus
- * outside the bubble and its target element, scrolls the underlying
- * document or resizes the window.
- * @param {Event} event The event.
- */
- handleEvent: function(event) {
- BubbleBase.prototype.handleEvent.call(this, event);
-
- switch (event.type) {
- // Close the bubble when the user clicks outside it, except if it is a
- // left-click on the bubble's target element (allowing the target to
- // handle the event and close the bubble itself).
- case 'mousedown':
- if (event.button == 0 && this.anchorNode_.contains(event.target))
- break;
- // Close the bubble when the underlying document is scrolled.
- case 'mousewheel':
- case 'scroll':
- if (this.contains(event.target))
- break;
- // Close the bubble when the window is resized.
- case 'resize':
- this.hide();
- break;
- // Close the bubble when the focus moves to an element that is not the
- // bubble target and is not inside the bubble.
- case 'elementFocused':
- if (!this.anchorNode_.contains(event.target) &&
- !this.contains(event.target)) {
- this.hide();
- }
- break;
- }
- },
-
- /**
- * Attach the bubble to the document's DOM, making it a sibling of the
- * |domSibling_| so that focusable elements inside the bubble follow the
- * target element in the document's tab order.
- * @private
- */
- attachToDOM_: function() {
- var parent = this.domSibling_.parentNode;
- parent.insertBefore(this, this.domSibling_.nextSibling);
- },
- };
-
- return {
- OptionsBubble: OptionsBubble
- };
-});
« no previous file with comments | « no previous file | chrome/browser/resources/options/options_bundle.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698