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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 cr.define('options', function() {
6
James Hawkins 2011/08/17 03:18:39 Remove blank line.
Greg Billock 2011/08/17 18:49:50 Done.
7 var OptionsPage = options.OptionsPage;
8
9 /////////////////////////////////////////////////////////////////////////////
10 // IntentsView class:
11
12 /**
13 * Encapsulated handling of the Intents data page.
14 * @constructor
15 */
16 function IntentsView(model) {
17 OptionsPage.call(this, 'intents',
18 templateData.intentsViewPageTabTitle,
19 'intents-view-page');
20 }
21
22 cr.addSingletonGetter(IntentsView);
23
24 IntentsView.prototype = {
25 __proto__: OptionsPage.prototype,
26
27 initializePage: function() {
28 OptionsPage.prototype.initializePage.call(this);
29
30 var intentsList = $('intents-list');
31 options.IntentsList.decorate(intentsList);
32 window.addEventListener('resize', this.handleResize_.bind(this));
33
34 this.addEventListener('visibleChange', this.handleVisibleChange_);
35 },
36
37 initialized_: false,
38
39 /**
40 * Handler for OptionsPage's visible property change event.
41 * @param {Event} e Property change event.
42 * @private
43 */
44 handleVisibleChange_: function(e) {
45 if (!this.visible)
46 return;
47
48 // Resize the intents list whenever the options page becomes visible.
49 this.handleResize_(null);
50 if (!this.initialized_) {
51 this.initialized_ = true;
52 chrome.send('loadIntents', []);
53 } else {
54 $('intents-list').redraw();
55 }
56 },
57
58 /**
59 * Handler for when the window changes size. Resizes the intents list to
60 * match the window height.
61 * @param {?Event} e Window resize event, or null if called directly.
62 * @private
63 */
64 handleResize_: function(e) {
65 if (!this.visible)
66 return;
67 var intentsList = $('intents-list');
68 // 25 pixels from the window bottom seems like a visually pleasing amount.
69 var height = window.innerHeight - intentsList.offsetTop - 25;
70 intentsList.style.height = height + 'px';
71 },
72 };
73
74 // IntentsViewHandler callbacks.
75 IntentsView.loadChildren = function(args) {
76 $('intents-list').loadChildren(args[0], args[1]);
77 };
78
79 // Export
80 return {
81 IntentsView: IntentsView
82 };
83
84 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698