OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('options', function() { | 5 cr.define('options', function() { |
6 ///////////////////////////////////////////////////////////////////////////// | 6 ///////////////////////////////////////////////////////////////////////////// |
7 // OptionsPage class: | 7 // OptionsPage class: |
8 | 8 |
9 /** | 9 /** |
10 * Base class for options page. | 10 * Base class for options page. |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 * Returns the topmost visible page, or null if no page is visible. | 401 * Returns the topmost visible page, or null if no page is visible. |
402 * @return {OptionPage} The topmost visible page. | 402 * @return {OptionPage} The topmost visible page. |
403 */ | 403 */ |
404 OptionsPage.getTopmostVisiblePage = function() { | 404 OptionsPage.getTopmostVisiblePage = function() { |
405 // Check overlays first since they're top-most if visible. | 405 // Check overlays first since they're top-most if visible. |
406 return this.getVisibleOverlay_() || this.getTopmostVisibleNonOverlayPage_(); | 406 return this.getVisibleOverlay_() || this.getTopmostVisibleNonOverlayPage_(); |
407 }; | 407 }; |
408 | 408 |
409 /** | 409 /** |
410 * Returns the currently visible bubble, or null if no bubble is visible. | 410 * Returns the currently visible bubble, or null if no bubble is visible. |
411 * @return {OptionsBubble} The bubble currently being shown. | 411 * @return {AutoCloseBubble} The bubble currently being shown. |
412 */ | 412 */ |
413 OptionsPage.getVisibleBubble = function() { | 413 OptionsPage.getVisibleBubble = function() { |
414 var bubble = OptionsPage.bubble_; | 414 var bubble = OptionsPage.bubble_; |
415 return bubble && !bubble.hidden ? bubble : null; | 415 return bubble && !bubble.hidden ? bubble : null; |
416 }; | 416 }; |
417 | 417 |
418 /** | 418 /** |
419 * Shows an informational bubble displaying |content| and pointing at the | 419 * Shows an informational bubble displaying |content| and pointing at the |
420 * |target| element. If |content| has focusable elements, they join the | 420 * |target| element. If |content| has focusable elements, they join the |
421 * current page's tab order as siblings of |domSibling|. | 421 * current page's tab order as siblings of |domSibling|. |
422 * @param {HTMLDivElement} content The content of the bubble. | 422 * @param {HTMLDivElement} content The content of the bubble. |
423 * @param {HTMLElement} target The element at which the bubble points. | 423 * @param {HTMLElement} target The element at which the bubble points. |
424 * @param {HTMLElement} domSibling The element after which the bubble is added | 424 * @param {HTMLElement} domSibling The element after which the bubble is added |
425 * to the DOM. | 425 * to the DOM. |
426 * @param {cr.ui.ArrowLocation} location The arrow location. | 426 * @param {cr.ui.ArrowLocation} location The arrow location. |
427 */ | 427 */ |
428 OptionsPage.showBubble = function(content, target, domSibling, location) { | 428 OptionsPage.showBubble = function(content, target, domSibling, location) { |
429 OptionsPage.hideBubble(); | 429 OptionsPage.hideBubble(); |
430 | 430 |
431 var bubble = new options.OptionsBubble; | 431 var bubble = new cr.ui.AutoCloseBubble; |
432 bubble.anchorNode = target; | 432 bubble.anchorNode = target; |
433 bubble.domSibling = domSibling; | 433 bubble.domSibling = domSibling; |
434 bubble.arrowLocation = location; | 434 bubble.arrowLocation = location; |
435 bubble.content = content; | 435 bubble.content = content; |
436 bubble.show(); | 436 bubble.show(); |
437 OptionsPage.bubble_ = bubble; | 437 OptionsPage.bubble_ = bubble; |
438 }; | 438 }; |
439 | 439 |
440 /** | 440 /** |
441 * Hides the currently visible bubble, if any. | 441 * Hides the currently visible bubble, if any. |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 canShowPage: function() { | 943 canShowPage: function() { |
944 return true; | 944 return true; |
945 }, | 945 }, |
946 }; | 946 }; |
947 | 947 |
948 // Export | 948 // Export |
949 return { | 949 return { |
950 OptionsPage: OptionsPage | 950 OptionsPage: OptionsPage |
951 }; | 951 }; |
952 }); | 952 }); |
OLD | NEW |