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

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(" Emulate offline for domains:"), WebInspector.overridesSupport.settings.emulateNe tworkConditions));
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 var networkDomains = WebInspector.SettingsUI.createSettingInputField("", WebInspector.overridesSupport.settings.networkDomains, false, 0, "", WebInspect or.OverridesSupport.networkDomainsValidator, false);
396 fieldsetElement.appendChild(networkDomains);
397 fieldsetElement.createChild("br");
398 fieldsetElement.createChild("span", "explanation").textContent = WebInsp ector.UIString("Leave empty to emulate offline for all domains");
399 return fieldsetElement;
400 },
401
402 __proto__: WebInspector.OverridesView.Tab.prototype
403 }
404
405
406 /**
407 * @constructor
408 * @extends {WebInspector.OverridesView.Tab}
409 */
378 WebInspector.OverridesView.SensorsTab = function() 410 WebInspector.OverridesView.SensorsTab = function()
379 { 411 {
380 var settings = [WebInspector.overridesSupport.settings.overrideGeolocation, WebInspector.overridesSupport.settings.overrideDeviceOrientation]; 412 var settings = [WebInspector.overridesSupport.settings.overrideGeolocation, WebInspector.overridesSupport.settings.overrideDeviceOrientation];
381 if (!WebInspector.overridesSupport.hasTouchInputs() && !WebInspector.overrid esSupport.responsiveDesignAvailable()) 413 if (!WebInspector.overridesSupport.hasTouchInputs() && !WebInspector.overrid esSupport.responsiveDesignAvailable())
382 settings.push(WebInspector.overridesSupport.settings.emulateTouchEvents) ; 414 settings.push(WebInspector.overridesSupport.settings.emulateTouchEvents) ;
383 WebInspector.OverridesView.Tab.call(this, "sensors", WebInspector.UIString(" Sensors"), settings); 415 WebInspector.OverridesView.Tab.call(this, "sensors", WebInspector.UIString(" Sensors"), settings);
384 416
385 this.element.classList.add("overrides-sensors"); 417 this.element.classList.add("overrides-sensors");
386 this.registerRequiredCSS("accelerometer.css"); 418 this.registerRequiredCSS("accelerometer.css");
387 if (!WebInspector.overridesSupport.hasTouchInputs() && !WebInspector.overrid esSupport.responsiveDesignAvailable()) 419 if (!WebInspector.overridesSupport.hasTouchInputs() && !WebInspector.overrid esSupport.responsiveDesignAvailable())
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 673
642 __proto__ : WebInspector.OverridesView.Tab.prototype 674 __proto__ : WebInspector.OverridesView.Tab.prototype
643 } 675 }
644 676
645 /** @enum {string} */ 677 /** @enum {string} */
646 WebInspector.OverridesView.SensorsTab.DeviceOrientationModificationSource = { 678 WebInspector.OverridesView.SensorsTab.DeviceOrientationModificationSource = {
647 UserInput: "userInput", 679 UserInput: "userInput",
648 UserDrag: "userDrag", 680 UserDrag: "userDrag",
649 ResetButton: "resetButton" 681 ResetButton: "resetButton"
650 } 682 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698