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

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

Issue 426723004: options: Remove a bunch of useless: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
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 var OptionsPage = options.OptionsPage; 6 var OptionsPage = options.OptionsPage;
7 7
8 ///////////////////////////////////////////////////////////////////////////// 8 /////////////////////////////////////////////////////////////////////////////
9 // CertificateManagerTab class: 9 // CertificateManagerTab class:
10 10
11 /** 11 /**
12 * blah 12 * blah
13 * @param {!string} id The id of this tab. 13 * @param {!string} id The id of this tab.
14 * @param {boolean} isKiosk True if dialog is shown during CrOS kiosk launch. 14 * @param {boolean} isKiosk True if dialog is shown during CrOS kiosk launch.
15 */ 15 */
16 function CertificateManagerTab(id, isKiosk) { 16 function CertificateManagerTab(id, isKiosk) {
17 this.tree = $(id + '-tree'); 17 this.tree = $(id + '-tree');
18 18
19 options.CertificatesTree.decorate(this.tree); 19 options.CertificatesTree.decorate(this.tree);
20 this.tree.addEventListener('change', 20 this.tree.addEventListener('change',
21 this.handleCertificatesTreeChange_.bind(this)); 21 this.handleCertificatesTreeChange_.bind(this));
22 22
23 var tree = this.tree; 23 var tree = this.tree;
24 24
25 this.viewButton = $(id + '-view'); 25 this.viewButton = $(id + '-view');
26 this.viewButton.onclick = function(e) { 26 this.viewButton.onclick = function(e) {
27 var selected = tree.selectedItem; 27 var selected = tree.selectedItem;
28 chrome.send('viewCertificate', [selected.data.id]); 28 chrome.send('viewCertificate', [selected.data.id]);
29 } 29 };
30 30
31 this.editButton = $(id + '-edit'); 31 this.editButton = $(id + '-edit');
32 if (this.editButton !== null) { 32 if (this.editButton !== null) {
33 if (id == 'serverCertsTab') { 33 if (id == 'serverCertsTab') {
34 this.editButton.onclick = function(e) { 34 this.editButton.onclick = function(e) {
35 var selected = tree.selectedItem; 35 var selected = tree.selectedItem;
36 chrome.send('editServerCertificate', [selected.data.id]); 36 chrome.send('editServerCertificate', [selected.data.id]);
37 } 37 };
38 } else if (id == 'caCertsTab') { 38 } else if (id == 'caCertsTab') {
39 this.editButton.onclick = function(e) { 39 this.editButton.onclick = function(e) {
40 var data = tree.selectedItem.data; 40 var data = tree.selectedItem.data;
41 CertificateEditCaTrustOverlay.show(data.id, data.name); 41 CertificateEditCaTrustOverlay.show(data.id, data.name);
42 } 42 };
43 } 43 }
44 } 44 }
45 45
46 this.backupButton = $(id + '-backup'); 46 this.backupButton = $(id + '-backup');
47 if (this.backupButton !== null) { 47 if (this.backupButton !== null) {
48 if (id == 'personalCertsTab' && isKiosk) { 48 if (id == 'personalCertsTab' && isKiosk) {
49 this.backupButton.hidden = true; 49 this.backupButton.hidden = true;
50 } else { 50 } else {
51 this.backupButton.onclick = function(e) { 51 this.backupButton.onclick = function(e) {
52 var selected = tree.selectedItem; 52 var selected = tree.selectedItem;
53 chrome.send('exportPersonalCertificate', [selected.data.id]); 53 chrome.send('exportPersonalCertificate', [selected.data.id]);
54 } 54 };
55 } 55 }
56 } 56 }
57 57
58 this.backupAllButton = $(id + '-backup-all'); 58 this.backupAllButton = $(id + '-backup-all');
59 if (this.backupAllButton !== null) { 59 if (this.backupAllButton !== null) {
60 if (id == 'personalCertsTab' && isKiosk) { 60 if (id == 'personalCertsTab' && isKiosk) {
61 this.backupAllButton.hidden = true; 61 this.backupAllButton.hidden = true;
62 } else { 62 } else {
63 this.backupAllButton.onclick = function(e) { 63 this.backupAllButton.onclick = function(e) {
64 chrome.send('exportAllPersonalCertificates'); 64 chrome.send('exportAllPersonalCertificates');
65 } 65 };
66 } 66 }
67 } 67 }
68 68
69 this.importButton = $(id + '-import'); 69 this.importButton = $(id + '-import');
70 if (this.importButton !== null) { 70 if (this.importButton !== null) {
71 if (id == 'personalCertsTab') { 71 if (id == 'personalCertsTab') {
72 if (isKiosk) { 72 if (isKiosk) {
73 this.importButton.hidden = true; 73 this.importButton.hidden = true;
74 } else { 74 } else {
75 this.importButton.onclick = function(e) { 75 this.importButton.onclick = function(e) {
76 chrome.send('importPersonalCertificate', [false]); 76 chrome.send('importPersonalCertificate', [false]);
77 } 77 };
78 } 78 }
79 } else if (id == 'serverCertsTab') { 79 } else if (id == 'serverCertsTab') {
80 this.importButton.onclick = function(e) { 80 this.importButton.onclick = function(e) {
81 chrome.send('importServerCertificate'); 81 chrome.send('importServerCertificate');
82 } 82 };
83 } else if (id == 'caCertsTab') { 83 } else if (id == 'caCertsTab') {
84 this.importButton.onclick = function(e) { 84 this.importButton.onclick = function(e) {
85 chrome.send('importCaCertificate'); 85 chrome.send('importCaCertificate');
86 } 86 };
87 } 87 }
88 } 88 }
89 89
90 this.importAndBindButton = $(id + '-import-and-bind'); 90 this.importAndBindButton = $(id + '-import-and-bind');
91 if (this.importAndBindButton !== null) { 91 if (this.importAndBindButton !== null) {
92 if (id == 'personalCertsTab') { 92 if (id == 'personalCertsTab') {
93 this.importAndBindButton.onclick = function(e) { 93 this.importAndBindButton.onclick = function(e) {
94 chrome.send('importPersonalCertificate', [true]); 94 chrome.send('importPersonalCertificate', [true]);
95 } 95 };
96 } 96 }
97 } 97 }
98 98
99 this.exportButton = $(id + '-export'); 99 this.exportButton = $(id + '-export');
100 if (this.exportButton !== null) { 100 if (this.exportButton !== null) {
101 if (id == 'personalCertsTab' && isKiosk) { 101 if (id == 'personalCertsTab' && isKiosk) {
102 this.exportButton.hidden = true; 102 this.exportButton.hidden = true;
103 } else { 103 } else {
104 this.exportButton.onclick = function(e) { 104 this.exportButton.onclick = function(e) {
105 var selected = tree.selectedItem; 105 var selected = tree.selectedItem;
106 chrome.send('exportCertificate', [selected.data.id]); 106 chrome.send('exportCertificate', [selected.data.id]);
107 } 107 };
108 } 108 }
109 } 109 }
110 110
111 this.deleteButton = $(id + '-delete'); 111 this.deleteButton = $(id + '-delete');
112 this.deleteButton.onclick = function(e) { 112 this.deleteButton.onclick = function(e) {
113 var data = tree.selectedItem.data; 113 var data = tree.selectedItem.data;
114 AlertOverlay.show( 114 AlertOverlay.show(
115 loadTimeData.getStringF(id + 'DeleteConfirm', data.name), 115 loadTimeData.getStringF(id + 'DeleteConfirm', data.name),
116 loadTimeData.getString(id + 'DeleteImpact'), 116 loadTimeData.getString(id + 'DeleteImpact'),
117 loadTimeData.getString('ok'), 117 loadTimeData.getString('ok'),
118 loadTimeData.getString('cancel'), 118 loadTimeData.getString('cancel'),
119 function() { 119 function() {
120 tree.selectedItem = null; 120 tree.selectedItem = null;
121 chrome.send('deleteCertificate', [data.id]); 121 chrome.send('deleteCertificate', [data.id]);
122 }); 122 });
123 } 123 };
124 } 124 }
125 125
126 CertificateManagerTab.prototype = { 126 CertificateManagerTab.prototype = {
127
128 /** 127 /**
129 * Update button state. 128 * Update button state.
130 * @private 129 * @private
131 * @param {!Object} data The data of the selected item. 130 * @param {!Object} data The data of the selected item.
132 */ 131 */
133 updateButtonState: function(data) { 132 updateButtonState: function(data) {
134 var isCert = !!data && data.isCert; 133 var isCert = !!data && data.isCert;
135 var readOnly = !!data && data.readonly; 134 var readOnly = !!data && data.readonly;
136 var extractable = !!data && data.extractable; 135 var extractable = !!data && data.extractable;
137 var hasChildren = this.tree.items.length > 0; 136 var hasChildren = this.tree.items.length > 0;
(...skipping 10 matching lines...) Expand all
148 this.deleteButton.disabled = !isCert || readOnly || isPolicy; 147 this.deleteButton.disabled = !isCert || readOnly || isPolicy;
149 }, 148 },
150 149
151 /** 150 /**
152 * Handles certificate tree selection change. 151 * Handles certificate tree selection change.
153 * @private 152 * @private
154 * @param {!Event} e The change event object. 153 * @param {!Event} e The change event object.
155 */ 154 */
156 handleCertificatesTreeChange_: function(e) { 155 handleCertificatesTreeChange_: function(e) {
157 var data = null; 156 var data = null;
158 if (this.tree.selectedItem) { 157 if (this.tree.selectedItem)
159 data = this.tree.selectedItem.data; 158 data = this.tree.selectedItem.data;
160 }
161 159
162 this.updateButtonState(data); 160 this.updateButtonState(data);
163 }, 161 },
164 }; 162 };
165 163
166 ///////////////////////////////////////////////////////////////////////////// 164 /////////////////////////////////////////////////////////////////////////////
167 // CertificateManager class: 165 // CertificateManager class:
168 166
169 /** 167 /**
170 * Encapsulated handling of ChromeOS accounts options page. 168 * Encapsulated handling of ChromeOS accounts options page.
171 * @constructor 169 * @constructor
172 */ 170 */
173 function CertificateManager(model) { 171 function CertificateManager(model) {
174 OptionsPage.call(this, 'certificates', 172 OptionsPage.call(this, 'certificates',
175 loadTimeData.getString('certificateManagerPageTabTitle'), 173 loadTimeData.getString('certificateManagerPageTabTitle'),
176 'certificateManagerPage'); 174 'certificateManagerPage');
177 } 175 }
178 176
179 cr.addSingletonGetter(CertificateManager); 177 cr.addSingletonGetter(CertificateManager);
180 178
181 CertificateManager.prototype = { 179 CertificateManager.prototype = {
182 __proto__: OptionsPage.prototype, 180 __proto__: OptionsPage.prototype,
183 181
182 /** @override */
184 initializePage: function(isKiosk) { 183 initializePage: function(isKiosk) {
185 OptionsPage.prototype.initializePage.call(this); 184 OptionsPage.prototype.initializePage.call(this);
186 185
187 this.personalTab = new CertificateManagerTab('personalCertsTab', 186 this.personalTab = new CertificateManagerTab('personalCertsTab',
188 !!isKiosk); 187 !!isKiosk);
189 this.serverTab = new CertificateManagerTab('serverCertsTab', !!isKiosk); 188 this.serverTab = new CertificateManagerTab('serverCertsTab', !!isKiosk);
190 this.caTab = new CertificateManagerTab('caCertsTab', !!isKiosk); 189 this.caTab = new CertificateManagerTab('caCertsTab', !!isKiosk);
191 this.otherTab = new CertificateManagerTab('otherCertsTab', !!isKiosk); 190 this.otherTab = new CertificateManagerTab('otherCertsTab', !!isKiosk);
192 191
193 this.addEventListener('visibleChange', this.handleVisibleChange_); 192 this.addEventListener('visibleChange', this.handleVisibleChange_);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 $('serverCertsTab-import').disabled = false; 235 $('serverCertsTab-import').disabled = false;
237 $('caCertsTab-import').disabled = false; 236 $('caCertsTab-import').disabled = false;
238 }; 237 };
239 238
240 // Export 239 // Export
241 return { 240 return {
242 CertificateManagerTab: CertificateManagerTab, 241 CertificateManagerTab: CertificateManagerTab,
243 CertificateManager: CertificateManager 242 CertificateManager: CertificateManager
244 }; 243 };
245 }); 244 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698