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

Side by Side Diff: chrome/browser/resources/net_internals/events_view.js

Issue 7564029: Use javascript strict mode throughout a number of net-internals files. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix one more var Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 * EventsView displays a filtered list of all events sharing a source, and 6 * EventsView displays a filtered list of all events sharing a source, and
7 * a details pane for the selected sources. 7 * a details pane for the selected sources.
8 * 8 *
9 * +----------------------++----------------+ 9 * +----------------------++----------------+
10 * | filter box || | 10 * | filter box || |
11 * +----------------------+| | 11 * +----------------------+| |
12 * | || | 12 * | || |
13 * | || | 13 * | || |
14 * | || | 14 * | || |
15 * | || | 15 * | || |
16 * | source list || details | 16 * | source list || details |
17 * | || view | 17 * | || view |
18 * | || | 18 * | || |
19 * | || | 19 * | || |
20 * | || | 20 * | || |
21 * | || | 21 * | || |
22 * +----------------------++ | 22 * +----------------------++ |
23 * | action bar || | 23 * | action bar || |
24 * +----------------------++----------------+ 24 * +----------------------++----------------+
25 */ 25 */
26 var EventsView = (function() {
27 'use strict';
26 28
27 var EventsView = (function() {
28 // IDs for special HTML elements in events_view.html 29 // IDs for special HTML elements in events_view.html
29 const TBODY_ID = 'events-view-source-list-tbody'; 30 var TBODY_ID = 'events-view-source-list-tbody';
30 const FILTER_INPUT_ID = 'events-view-filter-input'; 31 var FILTER_INPUT_ID = 'events-view-filter-input';
31 const FILTER_COUNT_ID = 'events-view-filter-count'; 32 var FILTER_COUNT_ID = 'events-view-filter-count';
32 const DELETE_SELECTED_ID = 'events-view-delete-selected'; 33 var DELETE_SELECTED_ID = 'events-view-delete-selected';
33 const DELETE_ALL_ID = 'events-view-delete-all'; 34 var DELETE_ALL_ID = 'events-view-delete-all';
34 const SELECT_ALL_ID = 'events-view-select-all'; 35 var SELECT_ALL_ID = 'events-view-select-all';
35 const SORT_BY_ID_ID = 'events-view-sort-by-id'; 36 var SORT_BY_ID_ID = 'events-view-sort-by-id';
36 const SORT_BY_SOURCE_TYPE_ID = 'events-view-sort-by-source'; 37 var SORT_BY_SOURCE_TYPE_ID = 'events-view-sort-by-source';
37 const SORT_BY_DESCRIPTION_ID = 'events-view-sort-by-description'; 38 var SORT_BY_DESCRIPTION_ID = 'events-view-sort-by-description';
38 const TAB_HANDLES_CONTAINER_ID = 'events-view-details-tab-handles'; 39 var TAB_HANDLES_CONTAINER_ID = 'events-view-details-tab-handles';
39 const LOG_TAB_ID = 'events-view-details-log-tab'; 40 var LOG_TAB_ID = 'events-view-details-log-tab';
40 const TIMELINE_TAB_ID = 'events-view-details-timeline-tab'; 41 var TIMELINE_TAB_ID = 'events-view-details-timeline-tab';
41 const DETAILS_LOG_BOX_ID = 'events-view-details-log-box'; 42 var DETAILS_LOG_BOX_ID = 'events-view-details-log-box';
42 const DETAILS_TIMELINE_BOX_ID = 'events-view-details-timeline-box'; 43 var DETAILS_TIMELINE_BOX_ID = 'events-view-details-timeline-box';
43 const TOPBAR_ID = 'events-view-filter-box'; 44 var TOPBAR_ID = 'events-view-filter-box';
44 const MIDDLE_BOX_ID = 'events-view-source-list'; 45 var MIDDLE_BOX_ID = 'events-view-source-list';
45 const BOTTOM_BAR_ID = 'events-view-action-box'; 46 var BOTTOM_BAR_ID = 'events-view-action-box';
46 const SIZER_ID = 'events-view-splitter-box'; 47 var SIZER_ID = 'events-view-splitter-box';
47 48
48 // How soon after updating the filter list the counter should be updated. 49 // How soon after updating the filter list the counter should be updated.
49 const REPAINT_FILTER_COUNTER_TIMEOUT_MS = 0; 50 var REPAINT_FILTER_COUNTER_TIMEOUT_MS = 0;
50 51
51 // We inherit from View. 52 // We inherit from View.
52 var superClass = View; 53 var superClass = View;
53 54
54 /** 55 /*
55 * @constructor 56 * @constructor
56 */ 57 */
57 function EventsView() { 58 function EventsView() {
59 assertFirstConstructorCall(EventsView);
60
58 // Call superclass's constructor. 61 // Call superclass's constructor.
59 superClass.call(this); 62 superClass.call(this);
60 63
61 // Initialize the sub-views. 64 // Initialize the sub-views.
62 var leftPane = new TopMidBottomView(new DivView(TOPBAR_ID), 65 var leftPane = new TopMidBottomView(new DivView(TOPBAR_ID),
63 new DivView(MIDDLE_BOX_ID), 66 new DivView(MIDDLE_BOX_ID),
64 new DivView(BOTTOM_BAR_ID)); 67 new DivView(BOTTOM_BAR_ID));
65 68
66 this.detailsView_ = new DetailsView(TAB_HANDLES_CONTAINER_ID, 69 this.detailsView_ = new DetailsView(TAB_HANDLES_CONTAINER_ID,
67 LOG_TAB_ID, 70 LOG_TAB_ID,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 * |remainingText| - |sourceText| with |directive|:parameter removed, 191 * |remainingText| - |sourceText| with |directive|:parameter removed,
189 and excess whitespace deleted. 192 and excess whitespace deleted.
190 * |parameter| - the parameter itself. 193 * |parameter| - the parameter itself.
191 * 194 *
192 * On failure, returns null. 195 * On failure, returns null.
193 */ 196 */
194 parseDirective_: function(sourceText, directive) { 197 parseDirective_: function(sourceText, directive) {
195 // Adding a leading space allows a single regexp to be used, regardless of 198 // Adding a leading space allows a single regexp to be used, regardless of
196 // whether or not the directive is at the start of the string. 199 // whether or not the directive is at the start of the string.
197 sourceText = ' ' + sourceText; 200 sourceText = ' ' + sourceText;
198 regExp = new RegExp('\\s+' + directive + ':(\\S*)\\s*', 'i'); 201 var regExp = new RegExp('\\s+' + directive + ':(\\S*)\\s*', 'i');
199 matchInfo = regExp.exec(sourceText); 202 var matchInfo = regExp.exec(sourceText);
200 if (matchInfo == null) 203 if (matchInfo == null)
201 return null; 204 return null;
202 205
203 return {'remainingText': sourceText.replace(regExp, ' ').trim(), 206 return {'remainingText': sourceText.replace(regExp, ' ').trim(),
204 'parameter': matchInfo[1]}; 207 'parameter': matchInfo[1]};
205 }, 208 },
206 209
207 /** 210 /**
208 * Just like parseDirective_, except can optionally be a '-' before or 211 * Just like parseDirective_, except can optionally be a '-' before or
209 * the parameter, to negate it. Before is more natural, after 212 * the parameter, to negate it. Before is more natural, after
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 this.filterCount_.innerHTML = ''; 602 this.filterCount_.innerHTML = '';
600 addTextNode(this.filterCount_, 603 addTextNode(this.filterCount_,
601 this.numPostfilter_ + ' of ' + this.numPrefilter_); 604 this.numPostfilter_ + ' of ' + this.numPrefilter_);
602 } 605 }
603 }; // end of prototype. 606 }; // end of prototype.
604 607
605 // ------------------------------------------------------------------------ 608 // ------------------------------------------------------------------------
606 // Helper code for comparisons 609 // Helper code for comparisons
607 // ------------------------------------------------------------------------ 610 // ------------------------------------------------------------------------
608 611
609 COMPARISON_FUNCTION_TABLE = { 612 var COMPARISON_FUNCTION_TABLE = {
610 // sort: and sort:- are allowed 613 // sort: and sort:- are allowed
611 '': compareSourceId, 614 '': compareSourceId,
612 'active': compareActive, 615 'active': compareActive,
613 'desc': compareDescription, 616 'desc': compareDescription,
614 'description': compareDescription, 617 'description': compareDescription,
615 'duration': compareDuration, 618 'duration': compareDuration,
616 'id': compareSourceId, 619 'id': compareSourceId,
617 'source': compareSourceType, 620 'source': compareSourceType,
618 'type': compareSourceType 621 'type': compareSourceType
619 }; 622 };
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 var source1Text = source1.getSourceTypeString(); 689 var source1Text = source1.getSourceTypeString();
687 var source2Text = source2.getSourceTypeString(); 690 var source2Text = source2.getSourceTypeString();
688 var compareResult = source1Text.localeCompare(source2Text); 691 var compareResult = source1Text.localeCompare(source2Text);
689 if (compareResult != 0) 692 if (compareResult != 0)
690 return compareResult; 693 return compareResult;
691 return compareSourceId(source1, source2); 694 return compareSourceId(source1, source2);
692 } 695 }
693 696
694 return EventsView; 697 return EventsView;
695 })(); 698 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/dns_view.js ('k') | chrome/browser/resources/net_internals/export_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698