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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/screencast/ScreencastView.js

Issue 2122353002: [DevTools] Make resource tree model optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 this._titleElement.style.left = "0"; 90 this._titleElement.style.left = "0";
91 91
92 this._imageElement = new Image(); 92 this._imageElement = new Image();
93 this._isCasting = false; 93 this._isCasting = false;
94 this._context = this._canvasElement.getContext("2d"); 94 this._context = this._canvasElement.getContext("2d");
95 this._checkerboardPattern = this._createCheckerboardPattern(this._contex t); 95 this._checkerboardPattern = this._createCheckerboardPattern(this._contex t);
96 96
97 this._shortcuts = /** !Object.<number, function(Event=):boolean> */ ({}) ; 97 this._shortcuts = /** !Object.<number, function(Event=):boolean> */ ({}) ;
98 this._shortcuts[WebInspector.KeyboardShortcut.makeKey("l", WebInspector. KeyboardShortcut.Modifiers.Ctrl)] = this._focusNavigationBar.bind(this); 98 this._shortcuts[WebInspector.KeyboardShortcut.makeKey("l", WebInspector. KeyboardShortcut.Modifiers.Ctrl)] = this._focusNavigationBar.bind(this);
99 99
100 this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTre eModel.EventTypes.ScreencastFrame, this._screencastFrame, this); 100 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(this._ target);
dgozman 2016/07/14 16:29:29 ditto
eostroukhov-old 2016/07/20 23:46:15 Done.
101 this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTre eModel.EventTypes.ScreencastVisibilityChanged, this._screencastVisibilityChanged , this); 101 if (resourceTreeModel) {
102 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Ev entTypes.ScreencastFrame, this._screencastFrame, this);
103 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Ev entTypes.ScreencastVisibilityChanged, this._screencastVisibilityChanged, this);
104 }
102 105
103 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.E vents.SuspendStateChanged, this._onSuspendStateChange, this); 106 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.E vents.SuspendStateChanged, this._onSuspendStateChange, this);
104 this._updateGlasspane(); 107 this._updateGlasspane();
105 }, 108 },
106 109
107 wasShown: function() 110 wasShown: function()
108 { 111 {
109 this._startCasting(); 112 this._startCasting();
110 }, 113 },
111 114
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 { 737 {
735 var newIndex = this._historyIndex + offset; 738 var newIndex = this._historyIndex + offset;
736 if (newIndex < 0 || newIndex >= this._historyEntries.length) 739 if (newIndex < 0 || newIndex >= this._historyEntries.length)
737 return; 740 return;
738 this._target.pageAgent().navigateToHistoryEntry(this._historyEntries[new Index].id); 741 this._target.pageAgent().navigateToHistoryEntry(this._historyEntries[new Index].id);
739 this._requestNavigationHistory(); 742 this._requestNavigationHistory();
740 }, 743 },
741 744
742 _navigateReload: function() 745 _navigateReload: function()
743 { 746 {
744 this._target.resourceTreeModel.reloadPage(); 747 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(this._ target);
748 if (resourceTreeModel)
749 resourceTreeModel.reloadPage();
745 }, 750 },
746 751
747 _navigationUrlKeyUp: function(event) 752 _navigationUrlKeyUp: function(event)
748 { 753 {
749 if (event.key !== "Enter") 754 if (event.key !== "Enter")
750 return; 755 return;
751 var url = this._navigationUrl.value; 756 var url = this._navigationUrl.value;
752 if (!url) 757 if (!url)
753 return; 758 return;
754 if (!url.match(WebInspector.ScreencastView._SchemeRegex)) 759 if (!url.match(WebInspector.ScreencastView._SchemeRegex))
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 return; 868 return;
864 this._maxDisplayedProgress = progress; 869 this._maxDisplayedProgress = progress;
865 this._displayProgress(progress); 870 this._displayProgress(progress);
866 }, 871 },
867 872
868 _displayProgress: function(progress) 873 _displayProgress: function(progress)
869 { 874 {
870 this._element.style.width = (100 * progress) + "%"; 875 this._element.style.width = (100 * progress) + "%";
871 } 876 }
872 }; 877 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698