OLD | NEW |
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 /** | 5 /** |
6 * This view displays options for exporting the captured data. | 6 * This view displays options for exporting the captured data. |
7 */ | 7 */ |
8 var ExportView = (function() { | 8 var ExportView = (function() { |
9 'use strict'; | 9 'use strict'; |
10 | 10 |
11 // We inherit from DivView. | 11 // We inherit from DivView. |
12 var superClass = DivView; | 12 var superClass = DivView; |
13 | 13 |
14 /** | 14 /** |
15 * @constructor | 15 * @constructor |
16 */ | 16 */ |
17 function ExportView() { | 17 function ExportView() { |
18 assertFirstConstructorCall(ExportView); | 18 assertFirstConstructorCall(ExportView); |
19 | 19 |
20 // Call superclass's constructor. | 20 // Call superclass's constructor. |
21 superClass.call(this, ExportView.MAIN_BOX_ID); | 21 superClass.call(this, ExportView.MAIN_BOX_ID); |
22 | 22 |
| 23 this.deprecatedNoticeUI_ = $(ExportView.DEPRECATED_NOTICE_UI_ID); |
| 24 this.showDeprecatedUIButton_ = $(ExportView.SHOW_DEPRECATED_UI_BUTTON_ID); |
| 25 this.showDeprecatedUIButton_.onclick = this.onShowDeprecatedUI_.bind(this); |
| 26 this.deprecatedExportUI_ = $(ExportView.DEPRECATED_EXPORT_UI_ID); |
| 27 |
23 var privacyStrippingCheckbox = $(ExportView.PRIVACY_STRIPPING_CHECKBOX_ID); | 28 var privacyStrippingCheckbox = $(ExportView.PRIVACY_STRIPPING_CHECKBOX_ID); |
24 privacyStrippingCheckbox.onclick = | 29 privacyStrippingCheckbox.onclick = |
25 this.onSetPrivacyStripping_.bind(this, privacyStrippingCheckbox); | 30 this.onSetPrivacyStripping_.bind(this, privacyStrippingCheckbox); |
26 | 31 |
27 this.saveFileButton_ = $(ExportView.SAVE_FILE_BUTTON_ID); | 32 this.saveFileButton_ = $(ExportView.SAVE_FILE_BUTTON_ID); |
28 this.saveFileButton_.onclick = this.onSaveFile_.bind(this); | 33 this.saveFileButton_.onclick = this.onSaveFile_.bind(this); |
29 this.saveStatusText_ = $(ExportView.SAVE_STATUS_TEXT_ID); | 34 this.saveStatusText_ = $(ExportView.SAVE_STATUS_TEXT_ID); |
30 this.isSaving_ = false; | 35 this.isSaving_ = false; |
31 | 36 |
32 this.userCommentsTextArea_ = $(ExportView.USER_COMMENTS_TEXT_AREA_ID); | 37 this.userCommentsTextArea_ = $(ExportView.USER_COMMENTS_TEXT_AREA_ID); |
33 this.updateSaveFileButton_(); | 38 this.updateSaveFileButton_(); |
34 this.userCommentsTextArea_.onkeyup = this.onUserCommentsUpdated_.bind(this); | 39 this.userCommentsTextArea_.onkeyup = this.onUserCommentsUpdated_.bind(this); |
35 | 40 |
36 // Track blob for previous log dump so it can be revoked when a new dump is | 41 // Track blob for previous log dump so it can be revoked when a new dump is |
37 // saved. | 42 // saved. |
38 this.lastBlobURL_ = null; | 43 this.lastBlobURL_ = null; |
39 | 44 |
40 // Cached copy of the last loaded log dump, for use when exporting. | 45 // Cached copy of the last loaded log dump, for use when exporting. |
41 this.loadedLogDump_ = null; | 46 this.loadedLogDump_ = null; |
42 } | 47 } |
43 | 48 |
44 ExportView.TAB_ID = 'tab-handle-export'; | 49 ExportView.TAB_ID = 'tab-handle-export'; |
45 ExportView.TAB_NAME = 'Export'; | 50 ExportView.TAB_NAME = 'Export'; |
46 ExportView.TAB_HASH = '#export'; | 51 ExportView.TAB_HASH = '#export'; |
47 | 52 |
48 // IDs for special HTML elements in export_view.html | 53 // IDs for special HTML elements in export_view.html |
| 54 ExportView.DEPRECATED_NOTICE_UI_ID = 'export-view-deprecated-notice'; |
| 55 ExportView.SHOW_DEPRECATED_UI_BUTTON_ID = 'export-view-show-deprecated-ui'; |
| 56 ExportView.DEPRECATED_EXPORT_UI_ID = 'export-view-ui-deprecated'; |
| 57 |
49 ExportView.MAIN_BOX_ID = 'export-view-tab-content'; | 58 ExportView.MAIN_BOX_ID = 'export-view-tab-content'; |
50 ExportView.DOWNLOAD_ANCHOR_ID = 'export-view-download-anchor'; | 59 ExportView.DOWNLOAD_ANCHOR_ID = 'export-view-download-anchor'; |
51 ExportView.SAVE_FILE_BUTTON_ID = 'export-view-save-log-file'; | 60 ExportView.SAVE_FILE_BUTTON_ID = 'export-view-save-log-file'; |
52 ExportView.SAVE_STATUS_TEXT_ID = 'export-view-save-status-text'; | 61 ExportView.SAVE_STATUS_TEXT_ID = 'export-view-save-status-text'; |
53 ExportView.PRIVACY_STRIPPING_CHECKBOX_ID = | 62 ExportView.PRIVACY_STRIPPING_CHECKBOX_ID = |
54 'export-view-privacy-stripping-checkbox'; | 63 'export-view-privacy-stripping-checkbox'; |
55 ExportView.USER_COMMENTS_TEXT_AREA_ID = 'export-view-user-comments'; | 64 ExportView.USER_COMMENTS_TEXT_AREA_ID = 'export-view-user-comments'; |
56 ExportView.PRIVACY_WARNING_ID = 'export-view-privacy-warning'; | 65 ExportView.PRIVACY_WARNING_ID = 'export-view-privacy-warning'; |
57 | 66 |
58 cr.addSingletonGetter(ExportView); | 67 cr.addSingletonGetter(ExportView); |
59 | 68 |
60 ExportView.prototype = { | 69 ExportView.prototype = { |
61 // Inherit the superclass's methods. | 70 // Inherit the superclass's methods. |
62 __proto__: superClass.prototype, | 71 __proto__: superClass.prototype, |
63 | 72 |
64 /** | 73 /** |
| 74 * Hides the export-view deprecation warning message and shows the |
| 75 * deprecated export-view UI. |
| 76 */ |
| 77 onShowDeprecatedUI_: function() { |
| 78 setNodeDisplay(this.deprecatedNoticeUI_, false); |
| 79 setNodeDisplay(this.deprecatedExportUI_, true); |
| 80 }, |
| 81 |
| 82 /** |
65 * Depending on the value of the checkbox, enables or disables stripping | 83 * Depending on the value of the checkbox, enables or disables stripping |
66 * cookies and passwords from log dumps and displayed events. | 84 * cookies and passwords from log dumps and displayed events. |
67 */ | 85 */ |
68 onSetPrivacyStripping_: function(privacyStrippingCheckbox) { | 86 onSetPrivacyStripping_: function(privacyStrippingCheckbox) { |
69 SourceTracker.getInstance().setPrivacyStripping( | 87 SourceTracker.getInstance().setPrivacyStripping( |
70 privacyStrippingCheckbox.checked); | 88 privacyStrippingCheckbox.checked); |
71 }, | 89 }, |
72 | 90 |
73 /** | 91 /** |
74 * When loading a log dump, cache it for future export and continue showing | 92 * When loading a log dump, cache it for future export and continue showing |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 var downloadAnchor = $(ExportView.DOWNLOAD_ANCHOR_ID); | 193 var downloadAnchor = $(ExportView.DOWNLOAD_ANCHOR_ID); |
176 downloadAnchor.href = this.lastBlobURL_; | 194 downloadAnchor.href = this.lastBlobURL_; |
177 downloadAnchor.click(); | 195 downloadAnchor.click(); |
178 | 196 |
179 this.setSaveFileStatus('Dump successful', false); | 197 this.setSaveFileStatus('Dump successful', false); |
180 } | 198 } |
181 }; | 199 }; |
182 | 200 |
183 return ExportView; | 201 return ExportView; |
184 })(); | 202 })(); |
OLD | NEW |