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

Side by Side Diff: chrome/browser/resources/options/intents_view.js

Issue 7717016: Revert 97955 - First pass on intents options UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
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 var OptionsPage = options.OptionsPage;
7
8 /////////////////////////////////////////////////////////////////////////////
9 // IntentsView class:
10
11 /**
12 * Encapsulated handling of the Intents data page.
13 * @constructor
14 */
15 function IntentsView(model) {
16 OptionsPage.call(this, 'intents',
17 templateData.intentsViewPageTabTitle,
18 'intents-view-page');
19 }
20
21 cr.addSingletonGetter(IntentsView);
22
23 IntentsView.prototype = {
24 __proto__: OptionsPage.prototype,
25
26 initializePage: function() {
27 OptionsPage.prototype.initializePage.call(this);
28
29 var intentsList = $('intents-list');
30 options.IntentsList.decorate(intentsList);
31 window.addEventListener('resize', this.handleResize_.bind(this));
32
33 this.addEventListener('visibleChange', this.handleVisibleChange_);
34 },
35
36 initialized_: false,
37
38 /**
39 * Handler for OptionsPage's visible property change event.
40 * @param {Event} e Property change event.
41 * @private
42 */
43 handleVisibleChange_: function(e) {
44 if (!this.visible)
45 return;
46
47 // Resize the intents list whenever the options page becomes visible.
48 this.handleResize_(null);
49 if (!this.initialized_) {
50 this.initialized_ = true;
51 chrome.send('loadIntents');
52 } else {
53 $('intents-list').redraw();
54 }
55 },
56
57 /**
58 * Handler for when the window changes size. Resizes the intents list to
59 * match the window height.
60 * @param {?Event} e Window resize event, or null if called directly.
61 * @private
62 */
63 handleResize_: function(e) {
64 if (!this.visible)
65 return;
66 var intentsList = $('intents-list');
67 // 25 pixels from the window bottom seems like a visually pleasing amount.
68 var height = window.innerHeight - intentsList.offsetTop - 25;
69 intentsList.style.height = height + 'px';
70 },
71 };
72
73 // IntentsViewHandler callbacks.
74 IntentsView.loadChildren = function(args) {
75 $('intents-list').loadChildren(args[0], args[1]);
76 };
77
78 // Export
79 return {
80 IntentsView: IntentsView
81 };
82
83 });
OLDNEW
« 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