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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/WatchExpressionsSidebarPane.js

Issue 2553043003: [DevTools] Remove methods on Common.Event. (Closed)
Patch Set: rebased Created 4 years 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 /* 1 /*
2 * Copyright (C) IBM Corp. 2009 All rights reserved. 2 * Copyright (C) IBM Corp. 2009 All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 25 matching lines...) Expand all
36 Sources.WatchExpressionsSidebarPane = class extends UI.ThrottledWidget { 36 Sources.WatchExpressionsSidebarPane = class extends UI.ThrottledWidget {
37 constructor() { 37 constructor() {
38 super(); 38 super();
39 this.registerRequiredCSS('components/objectValue.css'); 39 this.registerRequiredCSS('components/objectValue.css');
40 40
41 /** @type {!Array.<!Sources.WatchExpression>} */ 41 /** @type {!Array.<!Sources.WatchExpression>} */
42 this._watchExpressions = []; 42 this._watchExpressions = [];
43 this._watchExpressionsSetting = Common.settings.createLocalSetting('watchExp ressions', []); 43 this._watchExpressionsSetting = Common.settings.createLocalSetting('watchExp ressions', []);
44 44
45 this._addButton = new UI.ToolbarButton(Common.UIString('Add expression'), 'l argeicon-add'); 45 this._addButton = new UI.ToolbarButton(Common.UIString('Add expression'), 'l argeicon-add');
46 this._addButton.addEventListener('click', this._addButtonClicked.bind(this)) ; 46 this._addButton.addEventListener(UI.ToolbarButton.Events.Click, this._addBut tonClicked.bind(this));
47 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg eicon-refresh'); 47 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg eicon-refresh');
48 this._refreshButton.addEventListener('click', this._refreshButtonClicked.bin d(this)); 48 this._refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this.upd ate, this);
49 49
50 this._bodyElement = this.element.createChild('div', 'vbox watch-expressions' ); 50 this._bodyElement = this.element.createChild('div', 'vbox watch-expressions' );
51 this._bodyElement.addEventListener('contextmenu', this._contextMenu.bind(thi s), false); 51 this._bodyElement.addEventListener('contextmenu', this._contextMenu.bind(thi s), false);
52 this._expandController = new Components.ObjectPropertiesSectionExpandControl ler(); 52 this._expandController = new Components.ObjectPropertiesSectionExpandControl ler();
53 53
54 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this.update, this); 54 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this.update, this);
55 UI.context.addFlavorChangeListener(SDK.DebuggerModel.CallFrame, this.update, this); 55 UI.context.addFlavorChangeListener(SDK.DebuggerModel.CallFrame, this.update, this);
56 this._linkifier = new Components.Linkifier(); 56 this._linkifier = new Components.Linkifier();
57 this.update(); 57 this.update();
58 } 58 }
(...skipping 16 matching lines...) Expand all
75 _saveExpressions() { 75 _saveExpressions() {
76 var toSave = []; 76 var toSave = [];
77 for (var i = 0; i < this._watchExpressions.length; i++) { 77 for (var i = 0; i < this._watchExpressions.length; i++) {
78 if (this._watchExpressions[i].expression()) 78 if (this._watchExpressions[i].expression())
79 toSave.push(this._watchExpressions[i].expression()); 79 toSave.push(this._watchExpressions[i].expression());
80 } 80 }
81 81
82 this._watchExpressionsSetting.set(toSave); 82 this._watchExpressionsSetting.set(toSave);
83 } 83 }
84 84
85 /** 85 _addButtonClicked() {
86 * @param {!Common.Event=} event
87 */
88 _addButtonClicked(event) {
89 if (event)
90 event.consume(true);
91 UI.viewManager.showView('sources.watch'); 86 UI.viewManager.showView('sources.watch');
92 this._createWatchExpression(null).startEditing(); 87 this._createWatchExpression(null).startEditing();
93 } 88 }
94 89
95 /** 90 /**
96 * @param {!Common.Event} event
97 */
98 _refreshButtonClicked(event) {
99 event.consume();
100 this.update();
101 }
102
103 /**
104 * @override 91 * @override
105 * @return {!Promise.<?>} 92 * @return {!Promise.<?>}
106 */ 93 */
107 doUpdate() { 94 doUpdate() {
108 this._linkifier.reset(); 95 this._linkifier.reset();
109 this._bodyElement.removeChildren(); 96 this._bodyElement.removeChildren();
110 this._watchExpressions = []; 97 this._watchExpressions = [];
111 this._emptyElement = this._bodyElement.createChild('div', 'gray-info-message '); 98 this._emptyElement = this._bodyElement.createChild('div', 'gray-info-message ');
112 this._emptyElement.textContent = Common.UIString('No Watch Expressions'); 99 this._emptyElement.textContent = Common.UIString('No Watch Expressions');
113 var watchExpressionStrings = this._watchExpressionsSetting.get(); 100 var watchExpressionStrings = this._watchExpressionsSetting.get();
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 InspectorFrontendHost.copyText(this._valueElement.textContent); 417 InspectorFrontendHost.copyText(this._valueElement.textContent);
431 } 418 }
432 }; 419 };
433 420
434 Sources.WatchExpression._watchObjectGroupId = 'watch-group'; 421 Sources.WatchExpression._watchObjectGroupId = 'watch-group';
435 422
436 /** @enum {symbol} */ 423 /** @enum {symbol} */
437 Sources.WatchExpression.Events = { 424 Sources.WatchExpression.Events = {
438 ExpressionUpdated: Symbol('ExpressionUpdated') 425 ExpressionUpdated: Symbol('ExpressionUpdated')
439 }; 426 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698