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

Side by Side Diff: Source/devtools/front_end/elements/OverridesView.js

Issue 315003008: [DevTools] UI for network conditions emulation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 30 matching lines...) Expand all
41 41
42 this._tabbedPane = new WebInspector.TabbedPane(); 42 this._tabbedPane = new WebInspector.TabbedPane();
43 this._tabbedPane.shrinkableTabs = false; 43 this._tabbedPane.shrinkableTabs = false;
44 this._tabbedPane.verticalTabLayout = true; 44 this._tabbedPane.verticalTabLayout = true;
45 45
46 if (!WebInspector.overridesSupport.isInspectingDevice()) { 46 if (!WebInspector.overridesSupport.isInspectingDevice()) {
47 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) 47 if (!WebInspector.overridesSupport.responsiveDesignAvailable())
48 new WebInspector.OverridesView.DeviceTab().appendAsTab(this._tabbedP ane); 48 new WebInspector.OverridesView.DeviceTab().appendAsTab(this._tabbedP ane);
49 new WebInspector.OverridesView.ViewportTab().appendAsTab(this._tabbedPan e); 49 new WebInspector.OverridesView.ViewportTab().appendAsTab(this._tabbedPan e);
50 } 50 }
51 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) 51 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) {
52 new WebInspector.OverridesView.UserAgentTab().appendAsTab(this._tabbedPa ne); 52 new WebInspector.OverridesView.UserAgentTab().appendAsTab(this._tabbedPa ne);
53 new WebInspector.OverridesView.NetworkTab().appendAsTab(this._tabbedPane );
54 }
53 new WebInspector.OverridesView.SensorsTab().appendAsTab(this._tabbedPane); 55 new WebInspector.OverridesView.SensorsTab().appendAsTab(this._tabbedPane);
54 56
55 this._lastSelectedTabSetting = WebInspector.settings.createSetting("lastSele ctedEmulateTab", "device"); 57 this._lastSelectedTabSetting = WebInspector.settings.createSetting("lastSele ctedEmulateTab", "device");
56 this._tabbedPane.selectTab(this._lastSelectedTabSetting.get()); 58 this._tabbedPane.selectTab(this._lastSelectedTabSetting.get());
57 this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSele cted, this._tabSelected, this); 59 this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSele cted, this._tabSelected, this);
58 this._tabbedPane.show(this.element); 60 this._tabbedPane.show(this.element);
59 61
60 this._warningFooter = this.element.createChild("div", "overrides-footer"); 62 this._warningFooter = this.element.createChild("div", "overrides-footer");
61 this._overridesWarningUpdated(); 63 this._overridesWarningUpdated();
62 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport .Events.OverridesWarningUpdated, this._overridesWarningUpdated, this); 64 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport .Events.OverridesWarningUpdated, this._overridesWarningUpdated, this);
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 }, 370 },
369 371
370 __proto__: WebInspector.OverridesView.Tab.prototype 372 __proto__: WebInspector.OverridesView.Tab.prototype
371 } 373 }
372 374
373 375
374 /** 376 /**
375 * @constructor 377 * @constructor
376 * @extends {WebInspector.OverridesView.Tab} 378 * @extends {WebInspector.OverridesView.Tab}
377 */ 379 */
380 WebInspector.OverridesView.NetworkTab = function()
381 {
382 WebInspector.OverridesView.Tab.call(this, "network", WebInspector.UIString(" Network"), [WebInspector.overridesSupport.settings.emulateNetworkConditions]);
383 this.element.classList.add("overrides-network");
384 this.element.appendChild(this._createSettingCheckbox(WebInspector.UIString(" Limit network throughput"), WebInspector.overridesSupport.settings.emulateNetwor kConditions));
385 this.element.appendChild(this._createNetworkConditionsElement());
386 }
387
388 WebInspector.OverridesView.NetworkTab.prototype = {
389 /**
390 * @return {!Element}
391 */
392 _createNetworkConditionsElement: function()
393 {
394 var fieldsetElement = WebInspector.SettingsUI.createSettingFieldset(WebI nspector.overridesSupport.settings.emulateNetworkConditions);
395
396 var networkThroughput = WebInspector.overridesSupport.createNetworkThrou ghputSelect(document);
397 fieldsetElement.appendChild(networkThroughput);
398 fieldsetElement.createChild("br");
399
400 var networkDomains = WebInspector.SettingsUI.createSettingInputField("Fo r domains:", WebInspector.overridesSupport.settings.networkConditionsDomains, fa lse, 0, "", WebInspector.OverridesSupport.networkDomainsValidator, false);
401 networkDomains.querySelector("input").placeholder = WebInspector.UIStrin g("Leave empty to limit all domains");
402 fieldsetElement.appendChild(networkDomains);
403
404 return fieldsetElement;
405 },
406
407 __proto__: WebInspector.OverridesView.Tab.prototype
408 }
409
410
411 /**
412 * @constructor
413 * @extends {WebInspector.OverridesView.Tab}
414 */
378 WebInspector.OverridesView.SensorsTab = function() 415 WebInspector.OverridesView.SensorsTab = function()
379 { 416 {
380 var settings = [WebInspector.overridesSupport.settings.overrideGeolocation, WebInspector.overridesSupport.settings.overrideDeviceOrientation]; 417 var settings = [WebInspector.overridesSupport.settings.overrideGeolocation, WebInspector.overridesSupport.settings.overrideDeviceOrientation];
381 if (!WebInspector.overridesSupport.hasTouchInputs() && !WebInspector.overrid esSupport.responsiveDesignAvailable()) 418 if (!WebInspector.overridesSupport.hasTouchInputs() && !WebInspector.overrid esSupport.responsiveDesignAvailable())
382 settings.push(WebInspector.overridesSupport.settings.emulateTouchEvents) ; 419 settings.push(WebInspector.overridesSupport.settings.emulateTouchEvents) ;
383 WebInspector.OverridesView.Tab.call(this, "sensors", WebInspector.UIString(" Sensors"), settings); 420 WebInspector.OverridesView.Tab.call(this, "sensors", WebInspector.UIString(" Sensors"), settings);
384 421
385 this.element.classList.add("overrides-sensors"); 422 this.element.classList.add("overrides-sensors");
386 this.registerRequiredCSS("accelerometer.css"); 423 this.registerRequiredCSS("accelerometer.css");
387 if (!WebInspector.overridesSupport.hasTouchInputs() && !WebInspector.overrid esSupport.responsiveDesignAvailable()) 424 if (!WebInspector.overridesSupport.hasTouchInputs() && !WebInspector.overrid esSupport.responsiveDesignAvailable())
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 678
642 __proto__ : WebInspector.OverridesView.Tab.prototype 679 __proto__ : WebInspector.OverridesView.Tab.prototype
643 } 680 }
644 681
645 /** @enum {string} */ 682 /** @enum {string} */
646 WebInspector.OverridesView.SensorsTab.DeviceOrientationModificationSource = { 683 WebInspector.OverridesView.SensorsTab.DeviceOrientationModificationSource = {
647 UserInput: "userInput", 684 UserInput: "userInput",
648 UserDrag: "userDrag", 685 UserDrag: "userDrag",
649 ResetButton: "resetButton" 686 ResetButton: "resetButton"
650 } 687 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698