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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2483333003: Revert of DevTools: isolate settings of custom devtoools front-end. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 this._preferencesProvider().getPreferences(this._gotPreferences.bind(this)); 58 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this));
59 } 59 }
60 60
61 /** 61 /**
62 * @return {!InspectorFrontendHostAPI}
63 */
64 _preferencesProvider() {
65 if (this._preferencesProviderInstance)
66 return this._preferencesProviderInstance;
67 var isCustomFrontend = window.location.toString().startsWith('chrome-devtool s://devtools/custom/');
68 this._preferencesProviderInstance = isCustomFrontend ? new WebInspector.Insp ectorFrontendHostStub() : InspectorFrontendHost;
69 return this._preferencesProviderInstance;
70 }
71
72 /**
73 * @param {!Object<string, string>} prefs 62 * @param {!Object<string, string>} prefs
74 */ 63 */
75 _gotPreferences(prefs) { 64 _gotPreferences(prefs) {
76 console.timeStamp('Main._gotPreferences'); 65 console.timeStamp('Main._gotPreferences');
77 this._createSettings(prefs); 66 this._createSettings(prefs);
78 this._createAppUI(); 67 this._createAppUI();
79 } 68 }
80 69
81 /** 70 /**
82 * @param {!Object<string, string>} prefs 71 * @param {!Object<string, string>} prefs
83 * Note: this function is called from testSettings in Tests.js. 72 * Note: this function is called from testSettings in Tests.js.
84 */ 73 */
85 _createSettings(prefs) { 74 _createSettings(prefs) {
86 this._initializeExperiments(prefs); 75 this._initializeExperiments(prefs);
87 var preferencesProvider = this._preferencesProvider();
88 WebInspector.settings = new WebInspector.Settings(new WebInspector.SettingsS torage( 76 WebInspector.settings = new WebInspector.Settings(new WebInspector.SettingsS torage(
89 prefs, preferencesProvider.setPreference.bind(preferencesProvider), prefer encesProvider.removePreference.bind(preferencesProvider), 77 prefs, InspectorFrontendHost.setPreference, InspectorFrontendHost.remove Preference,
90 preferencesProvider.clearPreferences.bind(preferencesProvider))); 78 InspectorFrontendHost.clearPreferences));
91 79
92 if (!InspectorFrontendHost.isUnderTest()) 80 if (!InspectorFrontendHost.isUnderTest())
93 new WebInspector.VersionController().updateVersion(); 81 new WebInspector.VersionController().updateVersion();
94 } 82 }
95 83
96 /** 84 /**
97 * @param {!Object<string, string>} prefs 85 * @param {!Object<string, string>} prefs
98 */ 86 */
99 _initializeExperiments(prefs) { 87 _initializeExperiments(prefs) {
100 Runtime.experiments.register('accessibilityInspection', 'Accessibility Inspe ction'); 88 Runtime.experiments.register('accessibilityInspection', 'Accessibility Inspe ction');
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 * @override 1047 * @override
1060 * @return {?Element} 1048 * @return {?Element}
1061 */ 1049 */
1062 settingElement() { 1050 settingElement() {
1063 return WebInspector.SettingsUI.createSettingCheckbox( 1051 return WebInspector.SettingsUI.createSettingCheckbox(
1064 WebInspector.UIString('Show rulers'), WebInspector.moduleSetting('showMe tricsRulers')); 1052 WebInspector.UIString('Show rulers'), WebInspector.moduleSetting('showMe tricsRulers'));
1065 } 1053 }
1066 }; 1054 };
1067 1055
1068 new WebInspector.Main(); 1056 new WebInspector.Main();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698