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

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: comment update 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..eb1fb8e80aeb09095beeeb413a2b975bfd78d037 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;
Vitaly Pavlenko 2014/10/01 23:29:53 This should be this.canShow_ = false; right?
Evan Stade 2014/10/13 16:21:55 yes
+ },
+
+ /** @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
+ // people trying to navigate here by hand.
OptionsPage.showPageByName('alertOverlay', false);
}
« no previous file with comments | « chrome/browser/resources/options/add_startup_page_overlay.js ('k') | chrome/browser/resources/options/browser_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698