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

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

Issue 10907148: Implement popup bubbles for the controlled setting indicator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reimplemented on top of newly refactored BubbleBase class. Created 8 years, 3 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/options/options_page.js
diff --git a/chrome/browser/resources/options/options_page.js b/chrome/browser/resources/options/options_page.js
index 0a7d963e4698be8389988511ba345f152cf94419..84eee1cf552c09d41e03962af1abe8e6fbb9e3c7 100644
--- a/chrome/browser/resources/options/options_page.js
+++ b/chrome/browser/resources/options/options_page.js
@@ -27,6 +27,7 @@ cr.define('options', function() {
/**
* This is the absolute difference maintained between standard and
* fixed-width font sizes. Refer http://crbug.com/91922.
+ * @const
*/
OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD = 3;
@@ -82,6 +83,9 @@ cr.define('options', function() {
// If |opt_propertyBag| is non-truthy, homogenize to object.
opt_propertyBag = opt_propertyBag || {};
+ // If a bubble is currently being shown, hide it.
+ this.hideBubble();
+
// Find the currently visible root-level page.
var rootPage = null;
for (var name in this.registeredPages) {
@@ -379,6 +383,42 @@ cr.define('options', function() {
};
/**
+ * Returns the currently visible bubble, or null if no bubble is visible.
+ * @return {Bubble} The bubble currently being shown.
+ */
+ OptionsPage.getVisibleBubble = function() {
+ var bubble = OptionsPage.bubble_;
+ return bubble && !bubble.hidden ? bubble : null;
+ };
+
+ /**
+ * Shows an informational bubble displaying |content| and pointing at the
+ * |anchor| element. If |content| has focusable elements, they join the
+ * current page's tab order as siblings of |anchor|.
+ * @param {HTMLDivElement} content The content of the bubble.
+ * @param {HTMLElement} anchor The element at which the bubble points.
+ */
+ OptionsPage.showBubble = function(content, anchor) {
+ console.log('showBubble');
+ OptionsPage.hideBubble();
+
+ var bubble = new options.Bubble;
+ bubble.anchorNode = anchor;
+ bubble.arrowLocation = cr.ui.ArrowLocation.TOP_END;
+ bubble.content = content;
+ bubble.show();
+ OptionsPage.bubble_ = bubble;
+ };
+
+ /**
+ * Hides the currently visible bubble, if any.
+ */
+ OptionsPage.hideBubble = function() {
+ if (OptionsPage.bubble_)
+ OptionsPage.bubble_.hide();
+ };
+
+ /**
* Updates managed banner visibility state based on the topmost page.
*/
OptionsPage.updateManagedBannerVisibility = function() {

Powered by Google App Engine
This is Rietveld 408576698