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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/common/Settings.js

Issue 2150713002: [Devtools] Refactor NetworkLogViewColumns to be dynamic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added settings Created 4 years, 5 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 392 }
393 393
394 /** 394 /**
395 * @constructor 395 * @constructor
396 */ 396 */
397 WebInspector.VersionController = function() 397 WebInspector.VersionController = function()
398 { 398 {
399 } 399 }
400 400
401 WebInspector.VersionController._currentVersionName = "inspectorVersion"; 401 WebInspector.VersionController._currentVersionName = "inspectorVersion";
402 WebInspector.VersionController.currentVersion = 18; 402 WebInspector.VersionController.currentVersion = 19;
403 403
404 WebInspector.VersionController.prototype = { 404 WebInspector.VersionController.prototype = {
405 updateVersion: function() 405 updateVersion: function()
406 { 406 {
407 var localStorageVersion = window.localStorage ? window.localStorage[WebI nspector.VersionController._currentVersionName] : 0; 407 var localStorageVersion = window.localStorage ? window.localStorage[WebI nspector.VersionController._currentVersionName] : 0;
408 var versionSetting = WebInspector.settings.createSetting(WebInspector.Ve rsionController._currentVersionName, 0); 408 var versionSetting = WebInspector.settings.createSetting(WebInspector.Ve rsionController._currentVersionName, 0);
409 var currentVersion = WebInspector.VersionController.currentVersion; 409 var currentVersion = WebInspector.VersionController.currentVersion;
410 // While localStorage version exists, treat it as the main one. It'll be erased once migrated to prefs. 410 // While localStorage version exists, treat it as the main one. It'll be erased once migrated to prefs.
411 var oldVersion = parseInt(localStorageVersion || "0", 10) || versionSett ing.get(); 411 var oldVersion = parseInt(localStorageVersion || "0", 10) || versionSett ing.get();
412 if (oldVersion === 0) { 412 if (oldVersion === 0) {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 if (!newKey.startsWith("file://")) { 692 if (!newKey.startsWith("file://")) {
693 if (newKey.startsWith("/")) 693 if (newKey.startsWith("/"))
694 newKey = "file://" + newKey; 694 newKey = "file://" + newKey;
695 else 695 else
696 newKey = "file:///" + newKey; 696 newKey = "file:///" + newKey;
697 } 697 }
698 newValue[newKey] = oldValue[oldKey]; 698 newValue[newKey] = oldValue[oldKey];
699 } 699 }
700 setting.set(newValue); 700 setting.set(newValue);
701 }, 701 },
702 _updateVersionFrom18To19: function()
703 {
704 var defaultColumns = {
705 status: true,
706 type: true,
707 initiator: true,
708 size: true,
709 time: true
710 };
711 var visibleColumnSettings = WebInspector.settings.createSetting("network LogColumnsVisibility", defaultColumns);
712 var visibleColumns = visibleColumnSettings.get();
713 visibleColumns.name = true;
714 visibleColumns.timeline = true;
715
716 var configs = {};
717 for (var columnId in visibleColumns) {
718 if (!visibleColumns.hasOwnProperty(columnId))
719 continue;
720 configs[columnId.toLowerCase()] = {
721 visible: visibleColumns[columnId]
722 };
723 }
724 var newSetting = WebInspector.settings.createSetting("networkLogColumns" , {})
dgozman 2016/07/14 05:28:06 semicolons please!
allada 2016/07/14 22:27:07 Done.
725 newSetting.set(configs);
726 visibleColumnSettings.remove()
727 },
702 728
703 _migrateSettingsFromLocalStorage: function() 729 _migrateSettingsFromLocalStorage: function()
704 { 730 {
705 // This step migrates all the settings except for the ones below into th e browser profile. 731 // This step migrates all the settings except for the ones below into th e browser profile.
706 var localSettings = [ "advancedSearchConfig", "breakpoints", "consoleHis tory", "domBreakpoints", "eventListenerBreakpoints", 732 var localSettings = [ "advancedSearchConfig", "breakpoints", "consoleHis tory", "domBreakpoints", "eventListenerBreakpoints",
707 "fileSystemMapping", "lastSelectedSourcesSidebarPa neTab", "previouslyViewedFiles", 733 "fileSystemMapping", "lastSelectedSourcesSidebarPa neTab", "previouslyViewedFiles",
708 "savedURLs", "watchExpressions", "workspaceExclude dFolders", "xhrBreakpoints" ].keySet(); 734 "savedURLs", "watchExpressions", "workspaceExclude dFolders", "xhrBreakpoints" ].keySet();
709 if (!window.localStorage) 735 if (!window.localStorage)
710 return; 736 return;
711 737
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 } 772 }
747 773
748 /** 774 /**
749 * @param {string} settingName 775 * @param {string} settingName
750 * @return {!WebInspector.Setting} 776 * @return {!WebInspector.Setting}
751 */ 777 */
752 WebInspector.settingForTest = function(settingName) 778 WebInspector.settingForTest = function(settingName)
753 { 779 {
754 return WebInspector.settings.settingForTest(settingName); 780 return WebInspector.settings.settingForTest(settingName);
755 } 781 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698