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

Side by Side Diff: Source/devtools/front_end/screencast/ScreencastApp.js

Issue 1113813002: [DevTools] Rename View to Widget. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 5 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 * @constructor 6 * @constructor
7 * @implements {WebInspector.App} 7 * @implements {WebInspector.App}
8 * @implements {WebInspector.TargetManager.Observer} 8 * @implements {WebInspector.TargetManager.Observer}
9 */ 9 */
10 WebInspector.ScreencastApp = function() 10 WebInspector.ScreencastApp = function()
11 { 11 {
12 this._enabledSetting = WebInspector.settings.createSetting("screencastEnable d", true); 12 this._enabledSetting = WebInspector.settings.createSetting("screencastEnable d", true);
13 this._toggleButton = new WebInspector.ToolbarButton(WebInspector.UIString("T oggle screencast."), "screencast-toolbar-item"); 13 this._toggleButton = new WebInspector.ToolbarButton(WebInspector.UIString("T oggle screencast."), "screencast-toolbar-item");
14 this._toggleButton.setToggled(this._enabledSetting.get()); 14 this._toggleButton.setToggled(this._enabledSetting.get());
15 this._toggleButton.addEventListener("click", this._toggleButtonClicked, this ); 15 this._toggleButton.addEventListener("click", this._toggleButtonClicked, this );
16 WebInspector.targetManager.observeTargets(this); 16 WebInspector.targetManager.observeTargets(this);
17 }; 17 };
18 18
19 WebInspector.ScreencastApp.prototype = { 19 WebInspector.ScreencastApp.prototype = {
20 /** 20 /**
21 * @param {!Document} document 21 * @param {!Document} document
22 * @override 22 * @override
23 */ 23 */
24 presentUI: function(document) 24 presentUI: function(document)
25 { 25 {
26 var rootView = new WebInspector.RootView(); 26 var rootView = new WebInspector.RootView();
27 27
28 this._rootSplitView = new WebInspector.SplitView(false, true, "Inspector View.screencastSplitViewState", 300, 300); 28 this._rootSplitWidget = new WebInspector.SplitWidget(false, true, "Inspe ctorView.screencastSplitViewState", 300, 300);
29 this._rootSplitView.setVertical(true); 29 this._rootSplitWidget.setVertical(true);
30 this._rootSplitView.setSecondIsSidebar(true); 30 this._rootSplitWidget.setSecondIsSidebar(true);
31 this._rootSplitView.show(rootView.element); 31 this._rootSplitWidget.show(rootView.element);
32 this._rootSplitView.hideMain(); 32 this._rootSplitWidget.hideMain();
33 33
34 this._rootSplitView.setSidebarView(WebInspector.inspectorView); 34 this._rootSplitWidget.setSidebarWidget(WebInspector.inspectorView);
35 WebInspector.inspectorView.showInitialPanel(); 35 WebInspector.inspectorView.showInitialPanel();
36 rootView.attachToDocument(document); 36 rootView.attachToDocument(document);
37 }, 37 },
38 38
39 /** 39 /**
40 * @override 40 * @override
41 * @param {!WebInspector.Target} target 41 * @param {!WebInspector.Target} target
42 */ 42 */
43 targetAdded: function(target) 43 targetAdded: function(target)
44 { 44 {
45 if (this._target) 45 if (this._target)
46 return; 46 return;
47 this._target = target; 47 this._target = target;
48 if (target.hasCapability(WebInspector.Target.Capabilities.CanScreencast) ) { 48 if (target.hasCapability(WebInspector.Target.Capabilities.CanScreencast) ) {
49 this._screencastView = new WebInspector.ScreencastView(target); 49 this._screencastView = new WebInspector.ScreencastView(target);
50 this._rootSplitView.setMainView(this._screencastView); 50 this._rootSplitWidget.setMainWidget(this._screencastView);
51 this._screencastView.initialize(); 51 this._screencastView.initialize();
52 } else { 52 } else {
53 this._toggleButton.setEnabled(false); 53 this._toggleButton.setEnabled(false);
54 } 54 }
55 this._onScreencastEnabledChanged(); 55 this._onScreencastEnabledChanged();
56 }, 56 },
57 57
58 /** 58 /**
59 * @override 59 * @override
60 * @param {!WebInspector.Target} target 60 * @param {!WebInspector.Target} target
(...skipping 13 matching lines...) Expand all
74 74
75 _toggleButtonClicked: function() 75 _toggleButtonClicked: function()
76 { 76 {
77 var enabled = !this._toggleButton.toggled(); 77 var enabled = !this._toggleButton.toggled();
78 this._enabledSetting.set(enabled); 78 this._enabledSetting.set(enabled);
79 this._onScreencastEnabledChanged(); 79 this._onScreencastEnabledChanged();
80 }, 80 },
81 81
82 _onScreencastEnabledChanged: function() 82 _onScreencastEnabledChanged: function()
83 { 83 {
84 if (!this._rootSplitView) 84 if (!this._rootSplitWidget)
85 return; 85 return;
86 var enabled = this._enabledSetting.get() && this._screencastView; 86 var enabled = this._enabledSetting.get() && this._screencastView;
87 this._toggleButton.setToggled(enabled); 87 this._toggleButton.setToggled(enabled);
88 if (enabled) 88 if (enabled)
89 this._rootSplitView.showBoth(); 89 this._rootSplitWidget.showBoth();
90 else 90 else
91 this._rootSplitView.hideMain(); 91 this._rootSplitWidget.hideMain();
92 } 92 }
93 }; 93 };
94 94
95 95
96 /** @type {!WebInspector.ScreencastApp} */ 96 /** @type {!WebInspector.ScreencastApp} */
97 WebInspector.ScreencastApp._appInstance; 97 WebInspector.ScreencastApp._appInstance;
98 98
99 /** 99 /**
100 * @return {!WebInspector.ScreencastApp} 100 * @return {!WebInspector.ScreencastApp}
101 */ 101 */
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 WebInspector.ScreencastAppProvider.prototype = { 136 WebInspector.ScreencastAppProvider.prototype = {
137 /** 137 /**
138 * @override 138 * @override
139 * @return {!WebInspector.App} 139 * @return {!WebInspector.App}
140 */ 140 */
141 createApp: function() 141 createApp: function()
142 { 142 {
143 return WebInspector.ScreencastApp._instance(); 143 return WebInspector.ScreencastApp._instance();
144 } 144 }
145 }; 145 };
OLDNEW
« no previous file with comments | « Source/devtools/front_end/resources/ResourcesPanel.js ('k') | Source/devtools/front_end/source_frame/SourceFrame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698