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

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

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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
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 Page = cr.ui.pageManager.Page; 7 var Page = cr.ui.pageManager.Page;
8 var PageManager = cr.ui.pageManager.PageManager; 8 var PageManager = cr.ui.pageManager.PageManager;
9 9
10 ///////////////////////////////////////////////////////////////////////////// 10 /////////////////////////////////////////////////////////////////////////////
11 // CookiesView class: 11 // CookiesView class:
12 12
13 /** 13 /**
14 * Encapsulated handling of the cookies and other site data page. 14 * Encapsulated handling of the cookies and other site data page.
15 * @constructor 15 * @constructor
16 * @extends {cr.ui.pageManager.Page} 16 * @extends {cr.ui.pageManager.Page}
17 */ 17 */
18 function CookiesView(model) { 18 function CookiesView(model) {
19 Page.call(this, 'cookies', 19 Page.call(
20 loadTimeData.getString('cookiesViewPageTabTitle'), 20 this, 'cookies', loadTimeData.getString('cookiesViewPageTabTitle'),
21 'cookies-view-page'); 21 'cookies-view-page');
22 } 22 }
23 23
24 cr.addSingletonGetter(CookiesView); 24 cr.addSingletonGetter(CookiesView);
25 25
26 CookiesView.prototype = { 26 CookiesView.prototype = {
27 __proto__: Page.prototype, 27 __proto__: Page.prototype,
28 28
29 /** 29 /**
30 * 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.
31 * @type {number} 31 * @type {number}
(...skipping 16 matching lines...) Expand all
48 searchBox.addEventListener( 48 searchBox.addEventListener(
49 'search', this.handleSearchQueryChange_.bind(this)); 49 'search', this.handleSearchQueryChange_.bind(this));
50 searchBox.onkeydown = function(e) { 50 searchBox.onkeydown = function(e) {
51 // Prevent the overlay from handling this event. 51 // Prevent the overlay from handling this event.
52 if (e.key == 'Enter') 52 if (e.key == 'Enter')
53 e.stopPropagation(); 53 e.stopPropagation();
54 }; 54 };
55 55
56 this.pageDiv.querySelector('.remove-all-cookies-button').onclick = 56 this.pageDiv.querySelector('.remove-all-cookies-button').onclick =
57 function(e) { 57 function(e) {
58 chrome.send('removeAllCookies'); 58 chrome.send('removeAllCookies');
59 }; 59 };
60 60
61 var cookiesList = this.pageDiv.querySelector('.cookies-list'); 61 var cookiesList = this.pageDiv.querySelector('.cookies-list');
62 options.CookiesList.decorate(cookiesList); 62 options.CookiesList.decorate(cookiesList);
63 63
64 this.addEventListener('visibleChange', this.handleVisibleChange_); 64 this.addEventListener('visibleChange', this.handleVisibleChange_);
65 65
66 this.pageDiv.querySelector('.cookies-view-overlay-confirm').onclick = 66 this.pageDiv.querySelector('.cookies-view-overlay-confirm').onclick =
67 PageManager.closeOverlay.bind(PageManager); 67 PageManager.closeOverlay.bind(PageManager);
68 }, 68 },
69 69
(...skipping 15 matching lines...) Expand all
85 } 85 }
86 }, 86 },
87 87
88 /** 88 /**
89 * Handles search query changes. 89 * Handles search query changes.
90 * @param {!Event} e The event object. 90 * @param {!Event} e The event object.
91 * @private 91 * @private
92 */ 92 */
93 handleSearchQueryChange_: function(e) { 93 handleSearchQueryChange_: function(e) {
94 var stringId = document.querySelector('.cookies-search-box').value ? 94 var stringId = document.querySelector('.cookies-search-box').value ?
95 'remove_all_shown_cookie' : 'remove_all_cookie'; 95 'remove_all_shown_cookie' :
96 'remove_all_cookie';
96 document.querySelector('.remove-all-cookies-button').innerHTML = 97 document.querySelector('.remove-all-cookies-button').innerHTML =
97 loadTimeData.getString(stringId); 98 loadTimeData.getString(stringId);
98 if (this.queryDelayTimerId_) 99 if (this.queryDelayTimerId_)
99 window.clearTimeout(this.queryDelayTimerId_); 100 window.clearTimeout(this.queryDelayTimerId_);
100 101
101 this.queryDelayTimerId_ = window.setTimeout( 102 this.queryDelayTimerId_ =
102 this.searchCookie.bind(this), 500); 103 window.setTimeout(this.searchCookie.bind(this), 500);
103 }, 104 },
104 105
105 initialized_: false, 106 initialized_: false,
106 107
107 /** 108 /**
108 * Handler for Page's visible property change event. 109 * Handler for Page's visible property change event.
109 * @param {Event} e Property change event. 110 * @param {Event} e Property change event.
110 * @private 111 * @private
111 */ 112 */
112 handleVisibleChange_: function(e) { 113 handleVisibleChange_: function(e) {
(...skipping 20 matching lines...) Expand all
133 134
134 CookiesView.onTreeItemRemoved = function(args) { 135 CookiesView.onTreeItemRemoved = function(args) {
135 $('cookies-list').removeByParentId(args[0], args[1], args[2]); 136 $('cookies-list').removeByParentId(args[0], args[1], args[2]);
136 }; 137 };
137 138
138 CookiesView.loadChildren = function(args) { 139 CookiesView.loadChildren = function(args) {
139 $('cookies-list').loadChildren(args[0], args[1]); 140 $('cookies-list').loadChildren(args[0], args[1]);
140 }; 141 };
141 142
142 // Export 143 // Export
143 return { 144 return {CookiesView: CookiesView};
144 CookiesView: CookiesView
145 };
146 145
147 }); 146 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698