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

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

Issue 7624012: First pass on intents options UI. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Init values right. Created 9 years, 4 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 | « chrome/browser/resources/options/intents_view.html ('k') | chrome/browser/resources/options/options.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/intents_view.js
diff --git a/chrome/browser/resources/options/intents_view.js b/chrome/browser/resources/options/intents_view.js
new file mode 100644
index 0000000000000000000000000000000000000000..afc7d68f0037757395bf502fad0ff9dc9c94d526
--- /dev/null
+++ b/chrome/browser/resources/options/intents_view.js
@@ -0,0 +1,83 @@
+// Copyright (c) 2011 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 OptionsPage = options.OptionsPage;
+
+ /////////////////////////////////////////////////////////////////////////////
+ // IntentsView class:
+
+ /**
+ * Encapsulated handling of the Intents data page.
+ * @constructor
+ */
+ function IntentsView(model) {
+ OptionsPage.call(this, 'intents',
+ templateData.intentsViewPageTabTitle,
+ 'intents-view-page');
+ }
+
+ cr.addSingletonGetter(IntentsView);
+
+ IntentsView.prototype = {
+ __proto__: OptionsPage.prototype,
+
+ initializePage: function() {
+ OptionsPage.prototype.initializePage.call(this);
+
+ var intentsList = $('intents-list');
+ options.IntentsList.decorate(intentsList);
+ window.addEventListener('resize', this.handleResize_.bind(this));
+
+ this.addEventListener('visibleChange', this.handleVisibleChange_);
+ },
+
+ initialized_: false,
+
+ /**
+ * Handler for OptionsPage's visible property change event.
+ * @param {Event} e Property change event.
+ * @private
+ */
+ handleVisibleChange_: function(e) {
+ if (!this.visible)
+ return;
+
+ // Resize the intents list whenever the options page becomes visible.
+ this.handleResize_(null);
+ if (!this.initialized_) {
+ this.initialized_ = true;
+ chrome.send('loadIntents');
+ } else {
+ $('intents-list').redraw();
+ }
+ },
+
+ /**
+ * Handler for when the window changes size. Resizes the intents list to
+ * match the window height.
+ * @param {?Event} e Window resize event, or null if called directly.
+ * @private
+ */
+ handleResize_: function(e) {
+ if (!this.visible)
+ return;
+ var intentsList = $('intents-list');
+ // 25 pixels from the window bottom seems like a visually pleasing amount.
+ var height = window.innerHeight - intentsList.offsetTop - 25;
+ intentsList.style.height = height + 'px';
+ },
+ };
+
+ // IntentsViewHandler callbacks.
+ IntentsView.loadChildren = function(args) {
+ $('intents-list').loadChildren(args[0], args[1]);
+ };
+
+ // Export
+ return {
+ IntentsView: IntentsView
+ };
+
+});
« no previous file with comments | « chrome/browser/resources/options/intents_view.html ('k') | chrome/browser/resources/options/options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698