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

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

Issue 2474563002: DevTools: isolate settings of custom devtoools front-end. (Closed)
Patch Set: DevTools: custom devtools front-end should not share settings 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 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); 58 this._preferencesProvider().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 /**
62 * @param {!Object<string, string>} prefs 73 * @param {!Object<string, string>} prefs
63 */ 74 */
64 _gotPreferences(prefs) { 75 _gotPreferences(prefs) {
65 console.timeStamp('Main._gotPreferences'); 76 console.timeStamp('Main._gotPreferences');
66 this._createSettings(prefs); 77 this._createSettings(prefs);
67 this._createAppUI(); 78 this._createAppUI();
68 } 79 }
69 80
70 /** 81 /**
71 * @param {!Object<string, string>} prefs 82 * @param {!Object<string, string>} prefs
72 * Note: this function is called from testSettings in Tests.js. 83 * Note: this function is called from testSettings in Tests.js.
73 */ 84 */
74 _createSettings(prefs) { 85 _createSettings(prefs) {
75 this._initializeExperiments(prefs); 86 this._initializeExperiments(prefs);
87 var preferencesProvider = this._preferencesProvider();
76 WebInspector.settings = new WebInspector.Settings(new WebInspector.SettingsS torage( 88 WebInspector.settings = new WebInspector.Settings(new WebInspector.SettingsS torage(
77 prefs, InspectorFrontendHost.setPreference, InspectorFrontendHost.remove Preference, 89 prefs, preferencesProvider.setPreference, preferencesProvider.removePrefer ence,
dgozman 2016/11/02 19:47:58 Don't you have to bind here?
lushnikov 2016/11/02 20:00:59 It's not required, but let's bind to be on the saf
78 InspectorFrontendHost.clearPreferences)); 90 preferencesProvider.clearPreferences));
79 91
80 if (!InspectorFrontendHost.isUnderTest()) 92 if (!InspectorFrontendHost.isUnderTest())
81 new WebInspector.VersionController().updateVersion(); 93 new WebInspector.VersionController().updateVersion();
82 } 94 }
83 95
84 /** 96 /**
85 * @param {!Object<string, string>} prefs 97 * @param {!Object<string, string>} prefs
86 */ 98 */
87 _initializeExperiments(prefs) { 99 _initializeExperiments(prefs) {
88 Runtime.experiments.register('accessibilityInspection', 'Accessibility Inspe ction'); 100 Runtime.experiments.register('accessibilityInspection', 'Accessibility Inspe ction');
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 * @override 1059 * @override
1048 * @return {?Element} 1060 * @return {?Element}
1049 */ 1061 */
1050 settingElement() { 1062 settingElement() {
1051 return WebInspector.SettingsUI.createSettingCheckbox( 1063 return WebInspector.SettingsUI.createSettingCheckbox(
1052 WebInspector.UIString('Show rulers'), WebInspector.moduleSetting('showMe tricsRulers')); 1064 WebInspector.UIString('Show rulers'), WebInspector.moduleSetting('showMe tricsRulers'));
1053 } 1065 }
1054 }; 1066 };
1055 1067
1056 new WebInspector.Main(); 1068 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