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

Side by Side Diff: chrome/browser/resources/options2/cookies_view.js

Issue 10636019: Adding Application Data dialog for isolated apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Properly done JavaScript and CSS. Created 8 years, 5 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('options', function() { 5 cr.define('options', function() {
6 6
7 var OptionsPage = options.OptionsPage; 7 var OptionsPage = options.OptionsPage;
8 8
9 ///////////////////////////////////////////////////////////////////////////// 9 /////////////////////////////////////////////////////////////////////////////
10 // CookiesView class: 10 // CookiesView class:
(...skipping 23 matching lines...) Expand all
34 /** 34 /**
35 * The most recent search query, or null if the query is empty. 35 * The most recent search query, or null if the query is empty.
36 * @type {?string} 36 * @type {?string}
37 * @private 37 * @private
38 */ 38 */
39 lastQuery_: null, 39 lastQuery_: null,
40 40
41 initializePage: function() { 41 initializePage: function() {
42 OptionsPage.prototype.initializePage.call(this); 42 OptionsPage.prototype.initializePage.call(this);
43 43
44 $('cookies-search-box').addEventListener('search', 44 this.pageDiv.querySelector('.cookies-search-box').addEventListener(
45 this.handleSearchQueryChange_.bind(this)); 45 'search', this.handleSearchQueryChange_.bind(this));
46 46
47 $('remove-all-cookies-button').onclick = function(e) { 47 this.pageDiv.querySelector('.remove-all-cookies-button').onclick =
48 chrome.send('removeAllCookies'); 48 function(e) {
49 }; 49 chrome.send('removeAllCookies');
50 };
50 51
51 var cookiesList = $('cookies-list'); 52 var cookiesList = this.pageDiv.querySelector('.cookies-list');
52 options.CookiesList.decorate(cookiesList); 53 options.CookiesList.decorate(cookiesList);
53 54
54 this.addEventListener('visibleChange', this.handleVisibleChange_); 55 this.addEventListener('visibleChange', this.handleVisibleChange_);
55 56
56 $('cookies-view-overlay-confirm').onclick = 57 this.pageDiv.querySelector('.cookies-view-overlay-confirm').onclick =
57 OptionsPage.closeOverlay.bind(OptionsPage); 58 OptionsPage.closeOverlay.bind(OptionsPage);
58 }, 59 },
59 60
60 /** 61 /**
61 * Clear search filter when the dialog is displayed. 62 * Clear search filter when the dialog is displayed.
62 * @inheritDoc 63 * @inheritDoc
63 */ 64 */
64 didShowPage: function() { 65 didShowPage: function() {
65 $('cookies-search-box').value = ''; 66 this.pageDiv.querySelector('.cookies-search-box').value = '';
66 }, 67 },
67 68
68 /** 69 /**
69 * Search cookie using text in |cookies-search-box|. 70 * Search cookie using text in |cookies-search-box|.
70 */ 71 */
71 searchCookie: function() { 72 searchCookie: function() {
72 this.queryDelayTimerId_ = 0; 73 this.queryDelayTimerId_ = 0;
73 var filter = $('cookies-search-box').value; 74 var filter = this.pageDiv.querySelector('.cookies-search-box').value;
74 if (this.lastQuery_ != filter) { 75 if (this.lastQuery_ != filter) {
75 this.lastQuery_ = filter; 76 this.lastQuery_ = filter;
76 chrome.send('updateCookieSearchResults', [filter]); 77 chrome.send('updateCookieSearchResults', [filter]);
77 } 78 }
78 }, 79 },
79 80
80 /** 81 /**
81 * Handles search query changes. 82 * Handles search query changes.
82 * @param {!Event} e The event object. 83 * @param {!Event} e The event object.
83 * @private 84 * @private
(...skipping 10 matching lines...) Expand all
94 95
95 /** 96 /**
96 * Handler for OptionsPage's visible property change event. 97 * Handler for OptionsPage's visible property change event.
97 * @param {Event} e Property change event. 98 * @param {Event} e Property change event.
98 * @private 99 * @private
99 */ 100 */
100 handleVisibleChange_: function(e) { 101 handleVisibleChange_: function(e) {
101 if (!this.visible) 102 if (!this.visible)
102 return; 103 return;
103 104
105 // Inform the CookiesViewHandler whether we are operating in regular
106 // cookies dialog or the apps one.
107 chrome.send('setViewContext', [this.isAppContext()]);
108
104 if (!this.initialized_) { 109 if (!this.initialized_) {
105 this.initialized_ = true; 110 this.initialized_ = true;
106 this.searchCookie(); 111 this.searchCookie();
107 } else { 112 } else {
108 $('cookies-list').redraw(); 113 this.pageDiv.querySelector('.cookies-list').redraw();
109 } 114 }
110 115
111 $('cookies-search-box').focus(); 116 this.pageDiv.querySelector('.cookies-search-box').focus();
117 },
118
119 isAppContext: function() {
120 return false;
112 }, 121 },
113 }; 122 };
114 123
115 // CookiesViewHandler callbacks. 124 // CookiesViewHandler callbacks.
116 CookiesView.onTreeItemAdded = function(args) { 125 CookiesView.onTreeItemAdded = function(args) {
117 $('cookies-list').addByParentId(args[0], args[1], args[2]); 126 $('cookies-list').addByParentId(args[0], args[1], args[2]);
118 }; 127 };
119 128
120 CookiesView.onTreeItemRemoved = function(args) { 129 CookiesView.onTreeItemRemoved = function(args) {
121 $('cookies-list').removeByParentId(args[0], args[1], args[2]); 130 $('cookies-list').removeByParentId(args[0], args[1], args[2]);
122 }; 131 };
123 132
124 CookiesView.loadChildren = function(args) { 133 CookiesView.loadChildren = function(args) {
125 $('cookies-list').loadChildren(args[0], args[1]); 134 $('cookies-list').loadChildren(args[0], args[1]);
126 }; 135 };
127 136
128 // Export 137 // Export
129 return { 138 return {
130 CookiesView: CookiesView 139 CookiesView: CookiesView
131 }; 140 };
132 141
133 }); 142 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698