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

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

Issue 6480039: chrome://settings - Provide method for pages to prevent themselves being shown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: other cases Created 9 years, 10 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/alert_overlay.js
diff --git a/chrome/browser/resources/options/alert_overlay.js b/chrome/browser/resources/options/alert_overlay.js
index e8ecced70c7d5397956ccc01fdceea85b7b6b777..5e107b777a5ac5b4b90d4c40ebee58ee966ac97f 100644
--- a/chrome/browser/resources/options/alert_overlay.js
+++ b/chrome/browser/resources/options/alert_overlay.js
@@ -21,6 +21,13 @@ cr.define('options', function() {
__proto__: OptionsPage.prototype,
/**
+ * Whether the page can be shown. Used to make sure the page is only
+ * shown via AlertOverlay.Show(), and not via the address bar.
+ * @private
+ */
+ canShow_: false,
+
+ /**
* Initialize the page.
*/
initializePage: function() {
@@ -59,7 +66,19 @@ cr.define('options', function() {
if (this.cancelCallback != undefined) {
this.cancelCallback.call();
}
- }
+ },
+
+ /**
+ * The page is getting hidden. Don't let it be shown again.
+ */
+ willHidePage: function() {
+ canShow_ = false;
+ },
+
+ /** @inheritDoc */
+ canShowPage: function() {
+ return this.canShow_;
+ },
};
/**
@@ -108,9 +127,13 @@ cr.define('options', function() {
$('alertOverlayCancel').style.display = 'none';
}
- AlertOverlay.getInstance().okCallback = okCallback;
- AlertOverlay.getInstance().cancelCallback = cancelCallback;
+ var alertOverlay = AlertOverlay.getInstance();
+ alertOverlay.okCallback = okCallback;
+ alertOverlay.cancelCallback = cancelCallback;
+ alertOverlay.canShow_ = true;
+ // Intentionally don't show the URL in the location bar as we don't want
stuartmorgan 2011/02/12 01:09:06 Fix the double space.
Evan Stade 2011/02/12 03:06:42 Done.
+ // people trying to navigate here by hand.
OptionsPage.showPageByName('alertOverlay', false);
}

Powered by Google App Engine
This is Rietveld 408576698