Chromium Code Reviews| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 if (mainTarget && mainTarget.hasBrowserCapability()) | 48 if (mainTarget && mainTarget.hasBrowserCapability()) |
| 49 WebInspector.targetManager.reloadPage(hard); | 49 WebInspector.targetManager.reloadPage(hard); |
| 50 } | 50 } |
| 51 | 51 |
| 52 _loaded() { | 52 _loaded() { |
| 53 console.timeStamp('Main._loaded'); | 53 console.timeStamp('Main._loaded'); |
| 54 | 54 |
| 55 if (InspectorFrontendHost.isUnderTest()) | 55 if (InspectorFrontendHost.isUnderTest()) |
| 56 self.runtime.useTestBase(); | 56 self.runtime.useTestBase(); |
| 57 Runtime.setPlatform(WebInspector.platform()); | 57 Runtime.setPlatform(WebInspector.platform()); |
| 58 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); | 58 if (this._shouldUseLocalStorage()) |
| 59 WebInspector.InspectorFrontendHostStub.prototype.getPreferences.call(null, this._gotPreferences.bind(this)); | |
| 60 else | |
| 61 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); | |
| 59 } | 62 } |
| 60 | 63 |
| 61 /** | 64 /** |
| 65 * @return {boolean} | |
|
dgozman
2016/11/02 17:31:57
I'd suggest to return InspectorFrontendHostAPI fro
lushnikov
2016/11/02 18:48:59
Done.
| |
| 66 */ | |
| 67 _shouldUseLocalStorage() { | |
| 68 return window.location.toString().startsWith('chrome-devtools://devtools/cus tom/'); | |
| 69 } | |
| 70 | |
| 71 /** | |
| 62 * @param {!Object<string, string>} prefs | 72 * @param {!Object<string, string>} prefs |
| 63 */ | 73 */ |
| 64 _gotPreferences(prefs) { | 74 _gotPreferences(prefs) { |
| 65 console.timeStamp('Main._gotPreferences'); | 75 console.timeStamp('Main._gotPreferences'); |
| 66 this._createSettings(prefs); | 76 this._createSettings(prefs); |
| 67 this._createAppUI(); | 77 this._createAppUI(); |
| 68 } | 78 } |
| 69 | 79 |
| 70 /** | 80 /** |
| 71 * @param {!Object<string, string>} prefs | 81 * @param {!Object<string, string>} prefs |
| 72 * Note: this function is called from testSettings in Tests.js. | 82 * Note: this function is called from testSettings in Tests.js. |
| 73 */ | 83 */ |
| 74 _createSettings(prefs) { | 84 _createSettings(prefs) { |
| 75 this._initializeExperiments(prefs); | 85 this._initializeExperiments(prefs); |
| 76 WebInspector.settings = new WebInspector.Settings(new WebInspector.SettingsS torage( | 86 if (this._shouldUseLocalStorage()) { |
| 77 prefs, InspectorFrontendHost.setPreference, InspectorFrontendHost.remove Preference, | 87 WebInspector.settings = new WebInspector.Settings(new WebInspector.Setting sStorage( |
| 78 InspectorFrontendHost.clearPreferences)); | 88 prefs, WebInspector.InspectorFrontendHostStub.prototype.setPreference, WebInspector.InspectorFrontendHostStub.prototype.removePreference, |
| 89 WebInspector.InspectorFrontendHostStub.prototype.clearPreferences)); | |
| 90 } else { | |
| 91 WebInspector.settings = new WebInspector.Settings(new WebInspector.Setting sStorage( | |
| 92 prefs, InspectorFrontendHost.setPreference, InspectorFrontendHost.remo vePreference, | |
| 93 InspectorFrontendHost.clearPreferences)); | |
| 94 } | |
| 79 | 95 |
| 80 if (!InspectorFrontendHost.isUnderTest()) | 96 if (!InspectorFrontendHost.isUnderTest()) |
| 81 new WebInspector.VersionController().updateVersion(); | 97 new WebInspector.VersionController().updateVersion(); |
| 82 } | 98 } |
| 83 | 99 |
| 84 /** | 100 /** |
| 85 * @param {!Object<string, string>} prefs | 101 * @param {!Object<string, string>} prefs |
| 86 */ | 102 */ |
| 87 _initializeExperiments(prefs) { | 103 _initializeExperiments(prefs) { |
| 88 Runtime.experiments.register('accessibilityInspection', 'Accessibility Inspe ction'); | 104 Runtime.experiments.register('accessibilityInspection', 'Accessibility Inspe ction'); |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1047 * @override | 1063 * @override |
| 1048 * @return {?Element} | 1064 * @return {?Element} |
| 1049 */ | 1065 */ |
| 1050 settingElement() { | 1066 settingElement() { |
| 1051 return WebInspector.SettingsUI.createSettingCheckbox( | 1067 return WebInspector.SettingsUI.createSettingCheckbox( |
| 1052 WebInspector.UIString('Show rulers'), WebInspector.moduleSetting('showMe tricsRulers')); | 1068 WebInspector.UIString('Show rulers'), WebInspector.moduleSetting('showMe tricsRulers')); |
| 1053 } | 1069 } |
| 1054 }; | 1070 }; |
| 1055 | 1071 |
| 1056 new WebInspector.Main(); | 1072 new WebInspector.Main(); |
| OLD | NEW |