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

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: 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
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..15d0c89494396f6e5345c3815a18cd5770590bb0
--- /dev/null
+++ b/chrome/browser/resources/options/intents_view.js
@@ -0,0 +1,84 @@
+// 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() {
+
James Hawkins 2011/08/17 03:18:39 Remove blank line.
Greg Billock 2011/08/17 18:49:50 Done.
+ 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
+ };
+
+});

Powered by Google App Engine
This is Rietveld 408576698