| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @implements {InspectorAgent.Dispatcher} | 33 * @implements {InspectorAgent.Dispatcher} |
| 34 * @implements {WebInspector.Console.UIDelegate} | 34 * @implements {WebInspector.Console.UIDelegate} |
| 35 * @suppressGlobalPropertiesCheck | 35 * @suppressGlobalPropertiesCheck |
| 36 */ | 36 */ |
| 37 WebInspector.Main = function() | 37 WebInspector.Main = function() |
| 38 { | 38 { |
| 39 WebInspector.console.setUIDelegate(this); | 39 WebInspector.console.setUIDelegate(this); |
| 40 WebInspector.Main._instanceForTest = this; |
| 40 runOnWindowLoad(this._loaded.bind(this)); | 41 runOnWindowLoad(this._loaded.bind(this)); |
| 41 } | 42 } |
| 42 | 43 |
| 43 WebInspector.Main.prototype = { | 44 WebInspector.Main.prototype = { |
| 44 /** | 45 /** |
| 45 * @override | 46 * @override |
| 46 * @return {!Promise.<undefined>} | 47 * @return {!Promise.<undefined>} |
| 47 */ | 48 */ |
| 48 showConsole: function() | 49 showConsole: function() |
| 49 { | 50 { |
| 50 return WebInspector.Revealer.revealPromise(WebInspector.console); | 51 return WebInspector.Revealer.revealPromise(WebInspector.console); |
| 51 }, | 52 }, |
| 52 | 53 |
| 53 _loaded: function() | 54 _loaded: function() |
| 54 { | 55 { |
| 55 console.timeStamp("Main._loaded"); | 56 console.timeStamp("Main._loaded"); |
| 56 | 57 |
| 57 if (InspectorFrontendHost.isUnderTest()) | 58 if (InspectorFrontendHost.isUnderTest()) |
| 58 self.runtime.useTestBase(); | 59 self.runtime.useTestBase(); |
| 59 InspectorFrontendHost.getPreferences(this._createSettings.bind(this)); | 60 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); |
| 60 }, | 61 }, |
| 61 | 62 |
| 62 /** | 63 /** |
| 63 * @param {!Object<string, string>} prefs | 64 * @param {!Object<string, string>} prefs |
| 64 */ | 65 */ |
| 66 _gotPreferences: function(prefs) |
| 67 { |
| 68 console.timeStamp("Main._gotPreferences"); |
| 69 this._createSettings(prefs); |
| 70 this._createAppUI(); |
| 71 }, |
| 72 |
| 73 /** |
| 74 * @param {!Object<string, string>} prefs |
| 75 * Note: this function is called from testSettings in Tests.js. |
| 76 */ |
| 65 _createSettings: function(prefs) | 77 _createSettings: function(prefs) |
| 66 { | 78 { |
| 67 // Patch settings from the URL param (for tests). | 79 // Patch settings from the URL param (for tests). |
| 68 var settingsParam = Runtime.queryParam("settings"); | 80 var settingsParam = Runtime.queryParam("settings"); |
| 69 if (settingsParam) { | 81 if (settingsParam) { |
| 70 try { | 82 try { |
| 71 var settings = JSON.parse(window.decodeURI(settingsParam)); | 83 var settings = JSON.parse(window.decodeURI(settingsParam)); |
| 72 for (var key in settings) | 84 for (var key in settings) |
| 73 prefs[key] = settings[key]; | 85 prefs[key] = settings[key]; |
| 74 } catch(e) { | 86 } catch(e) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 95 else | 107 else |
| 96 InspectorFrontendHost.removePreference(name); | 108 InspectorFrontendHost.removePreference(name); |
| 97 } | 109 } |
| 98 } | 110 } |
| 99 | 111 |
| 100 Object.observe(prefs, trackPrefsObject); | 112 Object.observe(prefs, trackPrefsObject); |
| 101 WebInspector.settings = new WebInspector.Settings(prefs); | 113 WebInspector.settings = new WebInspector.Settings(prefs); |
| 102 | 114 |
| 103 if (!InspectorFrontendHost.isUnderTest()) | 115 if (!InspectorFrontendHost.isUnderTest()) |
| 104 new WebInspector.VersionController().updateVersion(); | 116 new WebInspector.VersionController().updateVersion(); |
| 105 | |
| 106 this._createAppUI(); | |
| 107 }, | 117 }, |
| 108 | 118 |
| 109 /** | 119 /** |
| 110 * @param {!Object<string, string>} prefs | 120 * @param {!Object<string, string>} prefs |
| 111 */ | 121 */ |
| 112 _initializeExperiments: function(prefs) | 122 _initializeExperiments: function(prefs) |
| 113 { | 123 { |
| 114 Runtime.experiments.register("accessibilityInspection", "Accessibility I
nspection"); | 124 Runtime.experiments.register("accessibilityInspection", "Accessibility I
nspection"); |
| 115 Runtime.experiments.register("animationInspection", "Animation Inspectio
n"); | 125 Runtime.experiments.register("animationInspection", "Animation Inspectio
n"); |
| 116 Runtime.experiments.register("applyCustomStylesheet", "Allow custom UI t
hemes"); | 126 Runtime.experiments.register("applyCustomStylesheet", "Allow custom UI t
hemes"); |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 p.classList.add("help-section"); | 849 p.classList.add("help-section"); |
| 840 p.textContent = WebInspector.UIString("Inspected worker has terminated. Once
it restarts we will attach to it automatically."); | 850 p.textContent = WebInspector.UIString("Inspected worker has terminated. Once
it restarts we will attach to it automatically."); |
| 841 } | 851 } |
| 842 | 852 |
| 843 WebInspector.WorkerTerminatedScreen.prototype = { | 853 WebInspector.WorkerTerminatedScreen.prototype = { |
| 844 | 854 |
| 845 __proto__: WebInspector.HelpScreen.prototype | 855 __proto__: WebInspector.HelpScreen.prototype |
| 846 } | 856 } |
| 847 | 857 |
| 848 new WebInspector.Main(); | 858 new WebInspector.Main(); |
| OLD | NEW |