OLD | NEW |
---|---|
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 * @extends {WebInspector.App} | 7 * @extends {WebInspector.App} |
8 */ | 8 */ |
9 WebInspector.ScreencastApp = function() | 9 WebInspector.ScreencastApp = function() |
10 { | 10 { |
11 WebInspector.App.call(this); | 11 WebInspector.App.call(this); |
12 | 12 |
13 var currentScreencastState = WebInspector.settings.createSetting("currentScr eencastState", ""); | |
14 var lastScreencastState = WebInspector.settings.createSetting("lastScreencas tState", ""); | 13 var lastScreencastState = WebInspector.settings.createSetting("lastScreencas tState", ""); |
14 this._currentScreencastState = WebInspector.settings.createSetting("currentS creencastState", ""); | |
dgozman
2014/06/06 13:13:06
We should initialize both these settings with "dis
apavlov
2014/06/06 13:15:32
Done.
| |
15 this._toggleScreencastButton = new WebInspector.StatusBarStatesSettingButton ( | 15 this._toggleScreencastButton = new WebInspector.StatusBarStatesSettingButton ( |
16 "screencast-status-bar-item", | 16 "screencast-status-bar-item", |
17 ["disabled", "left", "top"], | 17 ["disabled", "left", "top"], |
18 [WebInspector.UIString("Disable screencast."), WebInspector.UIString("Sw itch to portrait screencast."), WebInspector.UIString("Switch to landscape scree ncast.")], | 18 [WebInspector.UIString("Disable screencast."), WebInspector.UIString("Sw itch to portrait screencast."), WebInspector.UIString("Switch to landscape scree ncast.")], |
19 currentScreencastState.get(), | 19 this._currentScreencastState.get(), |
20 currentScreencastState, | 20 this._currentScreencastState, |
21 lastScreencastState, | 21 lastScreencastState, |
22 this._onStatusBarButtonStateChanged.bind(this)); | 22 this._onStatusBarButtonStateChanged.bind(this)); |
23 }; | 23 }; |
24 | 24 |
25 WebInspector.ScreencastApp.prototype = { | 25 WebInspector.ScreencastApp.prototype = { |
26 createRootView: function() | 26 createRootView: function() |
27 { | 27 { |
28 var rootView = new WebInspector.RootView(); | 28 var rootView = new WebInspector.RootView(); |
29 | 29 |
30 this._rootSplitView = new WebInspector.SplitView(false, true, "Inspector View.screencastSplitViewState", 300, 300); | 30 this._rootSplitView = new WebInspector.SplitView(false, true, "Inspector View.screencastSplitViewState", 300, 300); |
31 this._rootSplitView.show(rootView.element); | 31 this._rootSplitView.show(rootView.element); |
32 | 32 |
33 WebInspector.inspectorView.show(this._rootSplitView.sidebarElement()); | 33 WebInspector.inspectorView.show(this._rootSplitView.sidebarElement()); |
34 var target = /** @type {!WebInspector.Target} */ (WebInspector.targetMan ager.activeTarget()); | 34 var target = /** @type {!WebInspector.Target} */ (WebInspector.targetMan ager.activeTarget()); |
35 this._screencastView = new WebInspector.ScreencastView(target); | 35 this._screencastView = new WebInspector.ScreencastView(target); |
36 this._screencastView.show(this._rootSplitView.mainElement()); | 36 this._screencastView.show(this._rootSplitView.mainElement()); |
37 | 37 |
38 this._onStatusBarButtonStateChanged("disabled"); | 38 this._onStatusBarButtonStateChanged(this._currentScreencastState.get()); |
39 rootView.attachToBody(); | 39 rootView.attachToBody(); |
40 }, | 40 }, |
41 | 41 |
42 presentUI: function() | 42 presentUI: function() |
43 { | 43 { |
44 WebInspector.App.prototype.presentUI.call(this); | 44 WebInspector.App.prototype.presentUI.call(this); |
45 this._screencastView.initialize(); | 45 this._screencastView.initialize(); |
46 }, | 46 }, |
47 | 47 |
48 /** | 48 /** |
49 * @param {string} state | 49 * @param {string} state |
50 */ | 50 */ |
51 _onStatusBarButtonStateChanged: function(state) | 51 _onStatusBarButtonStateChanged: function(state) |
52 { | 52 { |
53 if (!this._rootSplitView) | |
54 return; | |
53 if (state === "disabled") { | 55 if (state === "disabled") { |
54 this._rootSplitView.toggleResizer(this._rootSplitView.resizerElement (), false); | 56 this._rootSplitView.toggleResizer(this._rootSplitView.resizerElement (), false); |
55 this._rootSplitView.toggleResizer(WebInspector.inspectorView.topResi zerElement(), false); | 57 this._rootSplitView.toggleResizer(WebInspector.inspectorView.topResi zerElement(), false); |
56 this._rootSplitView.hideMain(); | 58 this._rootSplitView.hideMain(); |
57 return; | 59 return; |
58 } | 60 } |
59 | 61 |
60 this._rootSplitView.setVertical(state === "left"); | 62 this._rootSplitView.setVertical(state === "left"); |
61 this._rootSplitView.setSecondIsSidebar(true); | 63 this._rootSplitView.setSecondIsSidebar(true); |
62 this._rootSplitView.toggleResizer(this._rootSplitView.resizerElement(), true); | 64 this._rootSplitView.toggleResizer(this._rootSplitView.resizerElement(), true); |
(...skipping 16 matching lines...) Expand all Loading... | |
79 /** | 81 /** |
80 * @return {?WebInspector.StatusBarButton} | 82 * @return {?WebInspector.StatusBarButton} |
81 */ | 83 */ |
82 button: function() | 84 button: function() |
83 { | 85 { |
84 if (!(WebInspector.app instanceof WebInspector.ScreencastApp)) | 86 if (!(WebInspector.app instanceof WebInspector.ScreencastApp)) |
85 return null; | 87 return null; |
86 return /** @type {!WebInspector.ScreencastApp} */ (WebInspector.app)._to ggleScreencastButton; | 88 return /** @type {!WebInspector.ScreencastApp} */ (WebInspector.app)._to ggleScreencastButton; |
87 } | 89 } |
88 } | 90 } |
OLD | NEW |