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

Side by Side Diff: Source/devtools/front_end/ScreencastView.js

Issue 307623003: [DevTools] Apps implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 6 years, 6 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 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 return; 1013 return;
1014 this._maxDisplayedProgress = progress; 1014 this._maxDisplayedProgress = progress;
1015 this._displayProgress(progress); 1015 this._displayProgress(progress);
1016 }, 1016 },
1017 1017
1018 _displayProgress: function(progress) 1018 _displayProgress: function(progress)
1019 { 1019 {
1020 this._element.style.width = (100 * progress) + "%"; 1020 this._element.style.width = (100 * progress) + "%";
1021 } 1021 }
1022 }; 1022 };
1023
1024 /**
1025 * @constructor
1026 */
1027 WebInspector.ScreencastController = function()
1028 {
1029 var rootView = new WebInspector.RootView();
1030
1031 this._rootSplitView = new WebInspector.SplitView(false, true, "InspectorView .screencastSplitViewState", 300, 300);
1032 this._rootSplitView.show(rootView.element);
1033
1034 WebInspector.inspectorView.show(this._rootSplitView.sidebarElement());
1035 var target = /** @type {!WebInspector.Target} */ (WebInspector.targetManager .activeTarget());
1036 this._screencastView = new WebInspector.ScreencastView(target);
1037 this._screencastView.show(this._rootSplitView.mainElement());
1038
1039 this._onStatusBarButtonStateChanged("disabled");
1040 rootView.attachToBody();
1041
1042 this._initialized = false;
1043 };
1044
1045 WebInspector.ScreencastController.prototype = {
1046 /**
1047 * @param {string} state
1048 */
1049 _onStatusBarButtonStateChanged: function(state)
1050 {
1051 if (state === "disabled") {
1052 this._rootSplitView.toggleResizer(this._rootSplitView.resizerElement (), false);
1053 this._rootSplitView.toggleResizer(WebInspector.inspectorView.topResi zerElement(), false);
1054 this._rootSplitView.hideMain();
1055 return;
1056 }
1057
1058 this._rootSplitView.setVertical(state === "left");
1059 this._rootSplitView.setSecondIsSidebar(true);
1060 this._rootSplitView.toggleResizer(this._rootSplitView.resizerElement(), true);
1061 this._rootSplitView.toggleResizer(WebInspector.inspectorView.topResizerE lement(), state === "top");
1062 this._rootSplitView.showBoth();
1063 },
1064
1065 initialize: function()
1066 {
1067 this._screencastView.initialize();
1068
1069 this._currentScreencastState = WebInspector.settings.createSetting("curr entScreencastState", "");
1070 this._lastScreencastState = WebInspector.settings.createSetting("lastScr eencastState", "");
1071 this._toggleScreencastButton = new WebInspector.StatusBarStatesSettingBu tton(
1072 "screencast-status-bar-item",
1073 ["disabled", "left", "top"],
1074 [WebInspector.UIString("Disable screencast."), WebInspector.UIString ("Switch to portrait screencast."), WebInspector.UIString("Switch to landscape s creencast.")],
1075 this._currentScreencastState,
1076 this._lastScreencastState,
1077 this._onStatusBarButtonStateChanged.bind(this));
1078
1079 if (this._statusBarPlaceholder) {
1080 this._statusBarPlaceholder.parentElement.insertBefore(this._toggleSc reencastButton.element, this._statusBarPlaceholder);
1081 this._statusBarPlaceholder.parentElement.removeChild(this._statusBar Placeholder);
1082 delete this._statusBarPlaceholder;
1083 }
1084
1085 this._initialized = true;
1086 },
1087
1088 /**
1089 * @return {!Element}
1090 */
1091 statusBarItem: function()
1092 {
1093 if (this._initialized)
1094 return this._toggleScreencastButton.element;
1095 this._statusBarPlaceholder = document.createElement("div");
1096 return this._statusBarPlaceholder;
1097 }
1098 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698