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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 try { | 83 try { |
| 84 var settings = JSON.parse(window.decodeURI(settingsParam)); | 84 var settings = JSON.parse(window.decodeURI(settingsParam)); |
| 85 for (var key in settings) | 85 for (var key in settings) |
| 86 prefs[key] = settings[key]; | 86 prefs[key] = settings[key]; |
| 87 } catch(e) { | 87 } catch(e) { |
| 88 // Ignore malformed settings. | 88 // Ignore malformed settings. |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 this._initializeExperiments(prefs); | 92 this._initializeExperiments(prefs); |
| 93 | 93 WebInspector.settings = new WebInspector.Settings(new WebInspector.Setti ngsStorage(prefs, InspectorFrontendHost.setPreference, InspectorFrontendHost.rem ovePreference)); |
|
dgozman
2015/11/16 22:43:47
Pass clearPreferences for efficiency.
| |
| 94 /** | |
| 95 * @param {!Array<{name: string}>} changes | |
| 96 */ | |
| 97 function trackPrefsObject(changes) | |
| 98 { | |
| 99 if (!Object.keys(prefs).length) { | |
| 100 InspectorFrontendHost.clearPreferences(); | |
| 101 return; | |
| 102 } | |
| 103 | |
| 104 for (var change of changes) { | |
| 105 var name = change.name; | |
| 106 if (name in prefs) | |
| 107 InspectorFrontendHost.setPreference(name, prefs[name]); | |
| 108 else | |
| 109 InspectorFrontendHost.removePreference(name); | |
| 110 } | |
| 111 } | |
| 112 | |
| 113 Object.observe(prefs, trackPrefsObject); | |
| 114 WebInspector.settings = new WebInspector.Settings(prefs); | |
| 115 | 94 |
| 116 if (!InspectorFrontendHost.isUnderTest()) | 95 if (!InspectorFrontendHost.isUnderTest()) |
| 117 new WebInspector.VersionController().updateVersion(); | 96 new WebInspector.VersionController().updateVersion(); |
| 118 }, | 97 }, |
| 119 | 98 |
| 120 /** | 99 /** |
| 121 * @param {!Object<string, string>} prefs | 100 * @param {!Object<string, string>} prefs |
| 122 */ | 101 */ |
| 123 _initializeExperiments: function(prefs) | 102 _initializeExperiments: function(prefs) |
| 124 { | 103 { |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1084 */ | 1063 */ |
| 1085 willHide: function() | 1064 willHide: function() |
| 1086 { | 1065 { |
| 1087 this._hideCallback.call(null); | 1066 this._hideCallback.call(null); |
| 1088 }, | 1067 }, |
| 1089 | 1068 |
| 1090 __proto__: WebInspector.VBox.prototype | 1069 __proto__: WebInspector.VBox.prototype |
| 1091 } | 1070 } |
| 1092 | 1071 |
| 1093 new WebInspector.Main(); | 1072 new WebInspector.Main(); |
| OLD | NEW |