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

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

Issue 10636019: Adding Application Data dialog for isolated apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes based on reviews by Thiago and Markus. 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 // AppCookiesView class:
11 11
12 /** 12 /**
13 * Encapsulated handling of the cookies and other site data page. 13 * Encapsulated handling of app cookies and other data page.
14 * This is a copy of the regular CookiesView, customized for
15 * isolated apps.
14 * @constructor 16 * @constructor
15 */ 17 */
16 function CookiesView(model) { 18 function AppCookiesView(model) {
17 OptionsPage.call(this, 'cookies', 19 OptionsPage.call(this, 'app-cookies',
18 loadTimeData.getString('cookiesViewPageTabTitle'), 20 loadTimeData.getString('cookiesViewPageTabTitle'),
19 'cookies-view-page'); 21 'app-cookies-view-page');
20 } 22 }
21 23
22 cr.addSingletonGetter(CookiesView); 24 cr.addSingletonGetter(AppCookiesView);
23 25
24 CookiesView.prototype = { 26 AppCookiesView.prototype = {
25 __proto__: OptionsPage.prototype, 27 __proto__: OptionsPage.prototype,
26 28
27 /** 29 /**
28 * The timer id of the timer set on search query change events. 30 * The timer id of the timer set on search query change events.
29 * @type {number} 31 * @type {number}
30 * @private 32 * @private
31 */ 33 */
32 queryDelayTimerId_: 0, 34 queryDelayTimerId_: 0,
33 35
34 /** 36 /**
35 * The most recent search query, or null if the query is empty. 37 * The most recent search query, or null if the query is empty.
36 * @type {?string} 38 * @type {?string}
37 * @private 39 * @private
38 */ 40 */
39 lastQuery_: null, 41 lastQuery_: null,
40 42
41 initializePage: function() { 43 initializePage: function() {
42 OptionsPage.prototype.initializePage.call(this); 44 OptionsPage.prototype.initializePage.call(this);
43 45
44 $('cookies-search-box').addEventListener('search', 46 $('app-cookies-search-box').addEventListener('search',
45 this.handleSearchQueryChange_.bind(this)); 47 this.handleSearchQueryChange_.bind(this));
46 48
47 $('remove-all-cookies-button').onclick = function(e) { 49 $('remove-all-app-cookies-button').onclick = function(e) {
48 chrome.send('removeAllCookies'); 50 chrome.send('removeAllCookies');
49 }; 51 };
50 52
51 var cookiesList = $('cookies-list'); 53 var cookiesList = $('app-cookies-list');
52 options.CookiesList.decorate(cookiesList); 54 options.CookiesList.decorate(cookiesList);
53 55
54 this.addEventListener('visibleChange', this.handleVisibleChange_); 56 this.addEventListener('visibleChange', this.handleVisibleChange_);
55 57
56 $('cookies-view-overlay-confirm').onclick = 58 $('app-cookies-view-overlay-confirm').onclick =
57 OptionsPage.closeOverlay.bind(OptionsPage); 59 OptionsPage.closeOverlay.bind(OptionsPage);
58 }, 60 },
59 61
60 /** 62 /**
61 * Clear search filter when the dialog is displayed. 63 * Clear search filter when the dialog is displayed.
62 * @inheritDoc 64 * @inheritDoc
63 */ 65 */
64 didShowPage: function() { 66 didShowPage: function() {
65 $('cookies-search-box').value = ''; 67 $('app-cookies-search-box').value = '';
66 }, 68 },
67 69
68 /** 70 /**
69 * Search cookie using text in |cookies-search-box|. 71 * Search cookie using text in |cookies-search-box|.
70 */ 72 */
71 searchCookie: function() { 73 searchCookie: function() {
72 this.queryDelayTimerId_ = 0; 74 this.queryDelayTimerId_ = 0;
73 var filter = $('cookies-search-box').value; 75 var filter = $('app-cookies-search-box').value;
74 if (this.lastQuery_ != filter) { 76 if (this.lastQuery_ != filter) {
75 this.lastQuery_ = filter; 77 this.lastQuery_ = filter;
76 chrome.send('updateCookieSearchResults', [filter]); 78 chrome.send('updateCookieSearchResults', [filter]);
77 } 79 }
78 }, 80 },
79 81
80 /** 82 /**
81 * Handles search query changes. 83 * Handles search query changes.
82 * @param {!Event} e The event object. 84 * @param {!Event} e The event object.
83 * @private 85 * @private
(...skipping 10 matching lines...) Expand all
94 96
95 /** 97 /**
96 * Handler for OptionsPage's visible property change event. 98 * Handler for OptionsPage's visible property change event.
97 * @param {Event} e Property change event. 99 * @param {Event} e Property change event.
98 * @private 100 * @private
99 */ 101 */
100 handleVisibleChange_: function(e) { 102 handleVisibleChange_: function(e) {
101 if (!this.visible) 103 if (!this.visible)
102 return; 104 return;
103 105
106 // Inform the CookiesViewHandler that this is in the context of apps
107 // cookies dialog.
108 chrome.send('setViewContext', [true]);
109
104 if (!this.initialized_) { 110 if (!this.initialized_) {
105 this.initialized_ = true; 111 this.initialized_ = true;
106 this.searchCookie(); 112 this.searchCookie();
107 } else { 113 } else {
108 $('cookies-list').redraw(); 114 $('app-cookies-list').redraw();
109 } 115 }
110 116
111 $('cookies-search-box').focus(); 117 $('app-cookies-search-box').focus();
112 }, 118 },
113 }; 119 };
114 120
115 // CookiesViewHandler callbacks. 121 // CookiesViewHandler callbacks.
116 CookiesView.onTreeItemAdded = function(args) { 122 AppCookiesView.onTreeItemAdded = function(args) {
117 $('cookies-list').addByParentId(args[0], args[1], args[2]); 123 $('app-cookies-list').addByParentId(args[0], args[1], args[2]);
118 }; 124 };
119 125
120 CookiesView.onTreeItemRemoved = function(args) { 126 AppCookiesView.onTreeItemRemoved = function(args) {
121 $('cookies-list').removeByParentId(args[0], args[1], args[2]); 127 $('app-cookies-list').removeByParentId(args[0], args[1], args[2]);
122 }; 128 };
123 129
124 CookiesView.loadChildren = function(args) { 130 AppCookiesView.loadChildren = function(args) {
125 $('cookies-list').loadChildren(args[0], args[1]); 131 $('app-cookies-list').loadChildren(args[0], args[1]);
126 }; 132 };
127 133
128 // Export 134 // Export
129 return { 135 return {
130 CookiesView: CookiesView 136 AppCookiesView: AppCookiesView
131 }; 137 };
132 138
133 }); 139 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698