diff options
Diffstat (limited to 'chromium/chrome/browser/resources/net_internals')
39 files changed, 551 insertions, 2186 deletions
diff --git a/chromium/chrome/browser/resources/net_internals/bandwidth_view.html b/chromium/chrome/browser/resources/net_internals/bandwidth_view.html index db30bebe9a2..01e804e558e 100644 --- a/chromium/chrome/browser/resources/net_internals/bandwidth_view.html +++ b/chromium/chrome/browser/resources/net_internals/bandwidth_view.html @@ -1,6 +1,45 @@ <!-- Bandwidth info --> +<style> +.data-reduction-proxy-view-events-details { + background-color: rgb(220,220,220); +} +table.borderless-table, +.borderless-table th, +.borderless-table td { + border: 0px; + padding-left: 4px; + padding-right: 4px; +} +</style> <div id=bandwidth-view-tab-content class=content-box> - <table class="styled-table"> + <h2>Data Reduction Proxy Status</h2> + <ul id=data-reduction-proxy-view-status> + <li>Status: <span id="data-reduction-proxy-enabled"></span></li> + <li>Proxy configuration: <span id="data-reduction-proxy-config"></span></li> + <li>Probe status: <span id="data-reduction-proxy-probe-status"></span></li> + <li id="data-reduction-proxy-bypass-state-container">Bypass details: + <span id="data-reduction-proxy-bypass-state-details"></span></li> + </ul> + <a href="#proxy">View current proxy configuration</a> + + <h4>Recent events</h4> + <div id=data-reduction-proxy-view-events-content> + <table class="styled-table"> + <thead> + <tr> + <th>Time</th> + <th>Action</th> + </tr> + <tr> + <th colspan=2>Details</th> + </tr> + </thead> + <tbody id=data-reduction-proxy-view-events-tbody> + </tbody> + </table> + </div> + <h4>Bandwidth Savings</h4> + <table class="styled-table" id="bandwidth-stats-table"> <thead> <tr> <th></th> diff --git a/chromium/chrome/browser/resources/net_internals/bandwidth_view.js b/chromium/chrome/browser/resources/net_internals/bandwidth_view.js index 9f0e4e61cb9..067151c22c0 100644 --- a/chromium/chrome/browser/resources/net_internals/bandwidth_view.js +++ b/chromium/chrome/browser/resources/net_internals/bandwidth_view.js @@ -21,6 +21,12 @@ var BandwidthView = (function() { g_browser.addSessionNetworkStatsObserver(this, true); g_browser.addHistoricNetworkStatsObserver(this, true); + // Register to receive data reduction proxy info. + g_browser.addDataReductionProxyInfoObserver(this, true); + + // Register to receive bad proxy info. + g_browser.addBadProxiesObserver(this, true); + this.sessionNetworkStats_ = null; this.historicNetworkStats_ = null; } @@ -31,6 +37,15 @@ var BandwidthView = (function() { // IDs for special HTML elements in bandwidth_view.html BandwidthView.MAIN_BOX_ID = 'bandwidth-view-tab-content'; + BandwidthView.ENABLED_ID = 'data-reduction-proxy-enabled'; + BandwidthView.PROXY_CONFIG_ID = 'data-reduction-proxy-config'; + BandwidthView.PROBE_STATUS_ID = 'data-reduction-proxy-probe-status'; + BandwidthView.BYPASS_STATE_CONTAINER_ID = + 'data-reduction-proxy-bypass-state-container'; + BandwidthView.BYPASS_STATE_ID = 'data-reduction-proxy-bypass-state-details'; + BandwidthView.EVENTS_TBODY_ID = 'data-reduction-proxy-view-events-tbody'; + BandwidthView.EVENTS_UL = 'data-reduction-proxy-view-events-list'; + BandwidthView.STATS_BOX_ID = 'bandwidth-stats-table'; cr.addSingletonGetter(BandwidthView); @@ -38,10 +53,15 @@ var BandwidthView = (function() { // Inherit the superclass's methods. __proto__: superClass.prototype, + data_reduction_proxy_config_: null, + last_bypass_: null, + bad_proxy_config_: null, + onLoadLogFinish: function(data) { - // Even though this information is included in log dumps, there's no real - // reason to display it when debugging a loaded log file. - return false; + return this.onBadProxiesChanged(data.badProxies) && + this.onDataReductionProxyInfoChanged(data.dataReductionProxyInfo) && + (this.onSessionNetworkStatsChanged(data.sessionNetworkStats) || + this.onHistoricNetworkStatsChanged(data.historicNetworkStats)); }, /** @@ -62,6 +82,72 @@ var BandwidthView = (function() { }, /** + * Updates the UI based on receiving changes in information about the + * data reduction proxy summary. + */ + onDataReductionProxyInfoChanged: function(info) { + $(BandwidthView.EVENTS_TBODY_ID).innerHTML = ''; + + if (!info) + return false; + + if (info.enabled) { + $(BandwidthView.ENABLED_ID).innerText = 'Enabled'; + $(BandwidthView.PROBE_STATUS_ID).innerText = + info.probe != null ? info.probe : 'N/A'; + this.last_bypass_ = info.last_bypass; + this.data_reduction_proxy_config_ = info.proxy_config.params; + } else { + $(BandwidthView.ENABLED_ID).innerText = 'Disabled'; + $(BandwidthView.PROBE_STATUS_ID).innerText = 'N/A'; + this.data_reduction_proxy_config_ = null; + } + + this.updateDataReductionProxyConfig_(); + + for (var eventIndex = info.events.length - 1; eventIndex >= 0; + --eventIndex) { + var event = info.events[eventIndex]; + var headerRow = addNode($(BandwidthView.EVENTS_TBODY_ID), 'tr'); + var detailsRow = addNode($(BandwidthView.EVENTS_TBODY_ID), 'tr'); + + var timeCell = addNode(headerRow, 'td'); + var actionCell = addNode(headerRow, 'td'); + var detailsCell = addNode(detailsRow, 'td'); + detailsCell.colSpan = 2; + detailsCell.className = 'data-reduction-proxy-view-events-details'; + var eventTime = timeutil.convertTimeTicksToDate(event.time); + timeutil.addNodeWithDate(timeCell, eventTime); + this.buildEventRow_(event, actionCell, detailsCell); + } + + return true; + }, + + /** + * Updates the UI based on receiving changes in information about bad + * proxy servers. + */ + onBadProxiesChanged: function(badProxies) { + if (!badProxies) + return false; + + var newBadProxies = []; + if (badProxies.length == 0) { + this.last_bypass_ = null; + } else { + for (var i = 0; i < badProxies.length; ++i) { + var entry = badProxies[i]; + newBadProxies[entry.proxy_uri] = entry.bad_until; + } + } + this.bad_proxy_config_ = newBadProxies; + this.updateDataReductionProxyConfig_(); + + return true; + }, + + /** * Update the bandwidth usage table. Returns false on failure. */ updateBandwidthUsageTable_: function() { @@ -103,8 +189,145 @@ var BandwidthView = (function() { }); var input = new JsEvalContext({rows: rows}); - jstProcess(input, $(BandwidthView.MAIN_BOX_ID)); + jstProcess(input, $(BandwidthView.STATS_BOX_ID)); return true; + }, + + /** + * Renders a Data Reduction Proxy event into the event tbody + */ + buildEventRow_: function(event, actionCell, detailsCell) { + if (event.type == EventType.DATA_REDUCTION_PROXY_ENABLED && + event.params.enabled == 0) { + addTextNode(actionCell, 'DISABLED'); + } else { + var actionText = + EventTypeNames[event.type].replace('DATA_REDUCTION_PROXY_', ''); + if (event.phase == EventPhase.PHASE_BEGIN || + event.phase == EventPhase.PHASE_END) { + actionText = actionText + ' (' + + getKeyWithValue(EventPhase, event.phase) + .replace('PHASE_', '') + ')'; + } + + addTextNode(actionCell, actionText); + this.createEventTable_(event.params, detailsCell); + } + }, + + /** + * Updates the data reduction proxy summary block. + */ + updateDataReductionProxyConfig_: function() { + $(BandwidthView.PROXY_CONFIG_ID).innerHTML = ''; + $(BandwidthView.BYPASS_STATE_ID).innerHTML = ''; + setNodeDisplay($(BandwidthView.BYPASS_STATE_CONTAINER_ID), false); + + if (this.data_reduction_proxy_config_) { + var hasBypassedProxy = false; + var now = timeutil.getCurrentTimeTicks(); + + if (this.last_bypass_ && + this.hasTimePassedLogTime_(+this.last_bypass_.params.expiration)) { + // Best effort on iterating the config to search for a bad proxy. + // A server could exist in a string member of + // data_reduction_proxy_config_ or within an array of servers in an + // array member of data_reduction_proxy_config_. As such, search + // through all string members and string arrays. + for (var key in this.data_reduction_proxy_config_) { + var value = this.data_reduction_proxy_config_[key]; + if (typeof value == 'string') { + if (this.isMarkedAsBad_(value)) { + hasBypassedProxy = true; + break; + } + } else if (value instanceof Array) { + for (var index = 1; index < value.length; index++) { + if (this.isMarkedAsBad_(value[index])) { + hasBypassedProxy = true; + } + } + + if (hasBypassedProxy) { + break; + } + } + } + } + + if (hasBypassedProxy) { + this.createEventTable_(this.last_bypass_.params, + $(BandwidthView.BYPASS_STATE_ID)); + } + + this.createEventTable_(this.data_reduction_proxy_config_, + $(BandwidthView.PROXY_CONFIG_ID)); + setNodeDisplay($(BandwidthView.BYPASS_STATE_CONTAINER_ID), + hasBypassedProxy); + } + }, + + /** + * Checks to see if a proxy server is in marked as bad. + */ + isMarkedAsBad_: function(proxy) { + for (var entry in this.bad_proxy_config_) { + if (entry == proxy && + this.hasTimePassedLogTime_(this.bad_proxy_config_[entry])) { + return true; + } + } + + return false; + }, + + /** + * Checks to see if a given time in ticks has passed the time of the + * the log. For real time viewing, this is "now", but for loaded logs, it + * is the time at which the logs were taken. + */ + hasTimePassedLogTime_: function(timeTicks) { + var logTime; + if (MainView.isViewingLoadedLog() && ClientInfo.numericDate) { + logTime = ClientInfo.numericDate; + } else { + logTime = timeutil.getCurrentTime(); + } + + return timeutil.convertTimeTicksToTime(timeTicks) > logTime; + }, + + /** + * Creates a table of the object obj. Certain keys are special cased for + * ease of readability. + */ + createEventTable_: function(obj, parentNode) { + if (Object.keys(obj).length > 0) { + var tableNode = addNode(parentNode, 'table'); + tableNode.className = 'borderless-table'; + for (var key in obj) { + var value = obj[key]; + if (value != null && value.toString() != '') { + if (key == 'net_error') { + if (value == 0) { + value = 'OK'; + } else { + value = netErrorToString(value); + } + } else if (key == 'bypass_type') { + value = getKeyWithValue(DataReductionProxyBypassEventType, value); + } else if (key == 'bypass_action_type') { + value = getKeyWithValue(DataReductionProxyBypassActionType, + value); + } else if (key == 'expiration') { + value = timeutil.convertTimeTicksToDate(value); + } + var tableRow = addNode(tableNode, 'tr'); + addNodeWithText(tableRow, 'td', key); + addNodeWithText(tableRow, 'td', value); + } + } + } } }; diff --git a/chromium/chrome/browser/resources/net_internals/browser_bridge.js b/chromium/chrome/browser/resources/net_internals/browser_bridge.js index 09ce829b447..2b976a4cd48 100644 --- a/chromium/chrome/browser/resources/net_internals/browser_bridge.js +++ b/chromium/chrome/browser/resources/net_internals/browser_bridge.js @@ -52,6 +52,7 @@ var BrowserBridge = (function() { this.addNetInfoPollableDataHelper('spdyAlternateProtocolMappings', 'onSpdyAlternateProtocolMappingsChanged'); this.addNetInfoPollableDataHelper('quicInfo', 'onQuicInfoChanged'); + this.addNetInfoPollableDataHelper('sdchInfo', 'onSdchInfoChanged'); this.addNetInfoPollableDataHelper('httpCacheInfo', 'onHttpCacheInfoChanged'); @@ -73,11 +74,9 @@ var BrowserBridge = (function() { this.pollableDataHelpers_.extensionInfo = new PollableDataHelper('onExtensionInfoChanged', this.sendGetExtensionInfo.bind(this)); - if (cr.isChromeOS) { - this.pollableDataHelpers_.systemLog = - new PollableDataHelper('onSystemLogChanged', - this.getSystemLog.bind(this, 'syslog')); - } + this.pollableDataHelpers_.dataReductionProxyInfo = + new PollableDataHelper('onDataReductionProxyInfoChanged', + this.sendGetDataReductionProxyInfo.bind(this)); // Setting this to true will cause messages from the browser to be ignored, // and no messages will be sent to the browser, either. Intended for use @@ -208,20 +207,16 @@ var BrowserBridge = (function() { this.send('getExtensionInfo'); }, - enableIPv6: function() { - this.send('enableIPv6'); - }, - - setLogLevel: function(logLevel) { - this.send('setLogLevel', ['' + logLevel]); + sendGetDataReductionProxyInfo: function() { + this.send('getDataReductionProxyInfo'); }, - refreshSystemLogs: function() { - this.send('refreshSystemLogs'); + enableIPv6: function() { + this.send('enableIPv6'); }, - getSystemLog: function(log_key, cellId) { - this.send('getSystemLog', [log_key, cellId]); + setCaptureMode: function(captureMode) { + this.send('setCaptureMode', ['' + captureMode]); }, importONCFile: function(fileContent, passcode) { @@ -353,8 +348,9 @@ var BrowserBridge = (function() { this.pollableDataHelpers_.extensionInfo.update(extensionInfo); }, - getSystemLogCallback: function(systemLog) { - this.pollableDataHelpers_.systemLog.update(systemLog); + receivedDataReductionProxyInfo: function(dataReductionProxyInfo) { + this.pollableDataHelpers_.dataReductionProxyInfo.update( + dataReductionProxyInfo); }, //-------------------------------------------------------------------------- @@ -618,16 +614,25 @@ var BrowserBridge = (function() { }, /** - * Adds a listener of system log information. |observer| will be called + * Adds a listener of the data reduction proxy info. |observer| will be + * called back when data is received, through: + * + * observer.onDataReductionProxyInfoChanged(dataReductionProxyInfo) + */ + addDataReductionProxyInfoObserver: function(observer, ignoreWhenUnchanged) { + this.pollableDataHelpers_.dataReductionProxyInfo.addObserver( + observer, ignoreWhenUnchanged); + }, + + /** + * Adds a listener of SDCH information. |observer| will be called * back when data is received, through: * - * observer.onSystemLogChanged(systemLogInfo) + * observer.onSdchInfoChanged(sdchInfo) */ - addSystemLogObserver: function(observer, ignoreWhenUnchanged) { - if (this.pollableDataHelpers_.systemLog) { - this.pollableDataHelpers_.systemLog.addObserver( - observer, ignoreWhenUnchanged); - } + addSdchInfoObserver: function(observer, ignoreWhenUnchanged) { + this.pollableDataHelpers_.sdchInfo.addObserver( + observer, ignoreWhenUnchanged); }, /** diff --git a/chromium/chrome/browser/resources/net_internals/capture_view.js b/chromium/chrome/browser/resources/net_internals/capture_view.js index 4b0a20f60b2..244dc1ced89 100644 --- a/chromium/chrome/browser/resources/net_internals/capture_view.js +++ b/chromium/chrome/browser/resources/net_internals/capture_view.js @@ -85,7 +85,7 @@ var CaptureView = (function() { var byteLoggingCheckbox = $(CaptureView.BYTE_LOGGING_CHECKBOX_ID); if (byteLoggingCheckbox.checked) { - g_browser.setLogLevel(LogLevelType.LOG_ALL); + g_browser.setCaptureMode('IncludeSocketBytes'); // Once we enable byte logging, all bets are off on what gets captured. // Have the export view warn that the "strip cookies" option is @@ -97,7 +97,7 @@ var CaptureView = (function() { // reload. ExportView.getInstance().showPrivacyWarning(); } else { - g_browser.setLogLevel(LogLevelType.LOG_ALL_BUT_BYTES); + g_browser.setCaptureMode('IncludeCookiesAndCredentials'); } }, diff --git a/chromium/chrome/browser/resources/net_internals/chromeos_view.html b/chromium/chrome/browser/resources/net_internals/chromeos_view.html index 8d221ed294e..5bce68eb52b 100644 --- a/chromium/chrome/browser/resources/net_internals/chromeos_view.html +++ b/chromium/chrome/browser/resources/net_internals/chromeos_view.html @@ -1,7 +1,9 @@ <div id="chromeos-view-tab-content" class=content-box> <h4 style='margin-top:0'>Import ONC file</h4> <div id="chromeos-view-import-div"> - <input type="file" id="chromeos-view-import-onc"> + <label>Import ONC File + <input type="file" id="chromeos-view-import-onc"> + </label> </div> <div id="chromeos-view-password-div" hidden> This onc file appears to be encrypted. Please provide the decryption key: diff --git a/chromium/chrome/browser/resources/net_internals/cros_log_analyzer_view.html b/chromium/chrome/browser/resources/net_internals/cros_log_analyzer_view.html deleted file mode 100644 index 19c76ffe51b..00000000000 --- a/chromium/chrome/browser/resources/net_internals/cros_log_analyzer_view.html +++ /dev/null @@ -1,57 +0,0 @@ -<!-- Log Analyzer --> -<div id="cros-log-analyzer-tab-content" class="content-box"> - <div id="cros-log-analyzer-header"> - Network Log - </div> - <div id='cros-log-analyzer-search-container' - class='cros-log-analyzer-container'> - <label> - Search: - <input type='text' id='cros-log-analyzer-search-input'> - </label> - <span id='cros-log-analyzer-save-btn'>Save</span> - </div> - <table id="cros-log-analyzer-log-header-table" - class="cros-log-analyzer-container"> - <tr> - <td class="cros-log-analyzer-td-level">Level</td> - <td class="cros-log-analyzer-td-time">Time</td> - <td class="cros-log-analyzer-td-pname">Process</td> - <td class="cros-log-analyzer-td-pid">PID</td> - <td class="cros-log-analyzer-td-description">Description</td> - </tr> - </table> - <div id="cros-log-analyzer-log-content"> - <table id="cros-log-analyzer-log-table"> - </table> - </div> - <div id='cros-log-analyzer-marker-container'> - </div> - <div id='cros-log-analyzer-filter-container' - class='cros-log-analyzer-container'> - <div id='cros-log-analyzer-filter-pname'> - </div> - <div id='cros-log-analyzer-filter-level'> - Level: - <span class="cros-log-analyzer-filter-level-block"> - <input type='checkbox' id='checkbox-error' checked=true> - <label for="checkbox-error">Error</label> - </span> - <span class="cros-log-analyzer-filter-level-block"> - <input type='checkbox' id='checkbox-warning' checked=true> - <label for="checkbox-warning">Warning</label> - </span> - <span class="cros-log-analyzer-filter-level-block"> - <input type='checkbox' id='checkbox-info' checked=true> - <label for="checkbox-info">Info</label> - </span> - <span class="cros-log-analyzer-filter-level-block"> - <input type='checkbox' id='checkbox-unknown' checked=true> - <label for="checkbox-unknown">Unknown</label> - </span> - </div> - </div> - <div id="cros-log-analyzer-visualizer-container"> - <div id="cros-log-analyzer-visualizer-tracking-layer"></div> - </div> -</div> diff --git a/chromium/chrome/browser/resources/net_internals/cros_log_entry.js b/chromium/chrome/browser/resources/net_internals/cros_log_entry.js deleted file mode 100644 index 70822a060cf..00000000000 --- a/chromium/chrome/browser/resources/net_internals/cros_log_entry.js +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * This class stores information of one single entry of log - */ - -var CrosLogEntry = function() { - - /** - * @constructor - */ - function CrosLogEntry() { - // The entry is visible by default - this.visibility = true; - } - - CrosLogEntry.prototype = { - //------------------------------------------------------------------------ - // Log input text parser - // Parses network log into tokens like time, name, pid - // and description. - //-------------------------------------------------------------------------- - tokenizeNetworkLog: function(NetworkLogEntry) { - var tokens = NetworkLogEntry.split(' '); - var timeTokens = tokens[0].split(/[\s|\:|\-|T|\.]/); - - // List of all parameters for Date Object - var year = timeTokens[0]; - var month = timeTokens[1]; - var day = timeTokens[2]; - var hour = timeTokens[3]; - var minute = timeTokens[4]; - var second = timeTokens[5]; - var millisecond = (parseInt(timeTokens[6]) / 1000).toFixed(0); - this.time = new Date(year, month, day, hour, minute, - second, millisecond); - - // Parses for process name and ID. - var process = tokens[2]; - if (hasProcessID(process)) { - var processTokens = process.split(/[\[|\]]/); - this.processName = processTokens[0]; - this.processID = processTokens[1]; - } else { - this.processName = process.split(/\:/)[0]; - this.processID = 'Unknown'; - } - - // Gets level of the log: error|warning|info|unknown if failed. - this.level = hasLevelInfo(tokens[3]); - - // Treats the rest of the entry as description. - var descriptionStartPoint = NetworkLogEntry.indexOf(tokens[2]) + - tokens[2].length; - this.description = NetworkLogEntry.substr(descriptionStartPoint); - }, - - // Represents the Date object as a string. - getTime: function() { - return this.time.getMonth() + '/' + this.time.getDate() + - ' ' + this.time.getHours() + ':' + this.time.getMinutes() + - ':' + this.time.getSeconds() + ':' + this.time.getMilliseconds(); - } - }; - - /** - * Helper function - * Takes a token as input and searches for '['. - * We assume if the token contains '[' it contains a process ID. - * - * @param {string} token A token from log - * @return {boolean} true if '[' is found - */ - var hasProcessID = function(token) { - return token != undefined && token.indexOf('[') != -1; - } - - /** - * Helper function - * Checks if the input token contains level information. - * - * @param {string} token A token from log - * @return {string} Level found in the token - */ - var hasLevelInfo = function(token) { - if (token == undefined) - return 'Unknown'; - if (token.toLowerCase().indexOf('err') != -1) { - return 'Error'; - } else if (token.toLowerCase().indexOf('warn') != -1) { - return 'Warning'; - } else if (token.toLowerCase().indexOf('info') != -1) { - return 'Info'; - } else { - return 'Unknown'; - } - } - - return CrosLogEntry; -}(); diff --git a/chromium/chrome/browser/resources/net_internals/cros_log_marker.js b/chromium/chrome/browser/resources/net_internals/cros_log_marker.js deleted file mode 100644 index d67a00c8dfb..00000000000 --- a/chromium/chrome/browser/resources/net_internals/cros_log_marker.js +++ /dev/null @@ -1,395 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -/** - * This class stores the filter queries as history and highlight the log text - * to increase the readability of the log - * - * - Enable / Disable highlights - * - Highlights text with multiple colors - * - Resolve hghlight conficts (A text highlighted by multiple colors) so that - * the latest added highlight always has highest priority to display. - * - */ -var CrosLogMarker = (function() { - 'use strict'; - - // Special classes (defined in log_visualizer_view.css) - var LOG_MARKER_HIGHLIGHT_CLASS = 'cros-log-visualizer-marker-highlight'; - var LOG_MARKER_CONTAINER_ID = 'cros-log-visualizer-marker-container'; - var LOG_MARKER_HISTORY_ENTRY_CLASS = - 'cros-log-visualizer-marker-history-entry'; - var LOG_MARKER_HISTORY_COLOR_TAG_CLASS = - 'cros-log-visualizer-marker-history-color-tag'; - - /** - * Colors used for highlighting. (Current we support 6 colors) - * TODO(shinfan): Add more supoorted colors. - */ - var COLOR_USAGE_SET = { - 'Crimson': false, - 'DeepSkyBlue': false, - 'DarkSeaGreen': false, - 'GoldenRod': false, - 'IndianRed': false, - 'Orange': false - }; - var COLOR_NUMBER = Object.keys(COLOR_USAGE_SET).length; - - - /** - * CrosHighlightTag represents a single highlight tag in text. - */ - var CrosHighlightTag = (function() { - /** - * @constructor - */ - function CrosHighlightTag(color, field, range, priority) { - this.color = color; - this.field = field; - this.range = range; - this.priority = priority; - this.enabled = true; - } - - return CrosHighlightTag; - })(); - - /** - * @constructor - * @param {CrosLogVisualizerView} logVisualizerView A reference to - * CrosLogVisualizerView. - */ - function CrosLogMarker(logVisualizerView) { - this.container = $(LOG_MARKER_CONTAINER_ID); - // Stores highlight objects for each entry. - this.entryHighlights = []; - // Stores all the filter queries. - this.markHistory = {}; - // Object references from CrosLogVisualizerView. - this.logEntries = logVisualizerView.logEntries; - this.logVisualizerView = logVisualizerView; - // Counts how many highlights are created. - this.markCount = 0; - for (var i = 0; i < this.logEntries.length; i++) { - this.entryHighlights.push([]); - } - } - - CrosLogMarker.prototype = { - /** - * Saves the query to the mark history and highlights the text - * based on the query. - */ - addMarkHistory: function(query) { - // Increases the counter - this.markCount += 1; - - // Find an avaiable color. - var color = this.pickColor(); - if (!color) { - // If all colors are occupied. - alert('You can only add at most ' + COLOR_NUMBER + 'markers.'); - return; - } - - // Updates HTML elements. - var historyEntry = addNode(this.container, 'div'); - historyEntry.className = LOG_MARKER_HISTORY_ENTRY_CLASS; - - // A color tag that indicats the color used. - var colorTag = addNode(historyEntry, 'div'); - colorTag.className = LOG_MARKER_HISTORY_COLOR_TAG_CLASS; - colorTag.style.background = color; - - // Displays the query text. - var queryText = addNodeWithText(historyEntry, 'p', query); - queryText.style.color = color; - - // Adds a button to remove the marker. - var removeBtn = addNodeWithText(historyEntry, 'a', 'Remove'); - removeBtn.addEventListener( - 'click', this.onRemoveBtnClicked_.bind(this, historyEntry, color)); - - // A checkbox that lets user enable and disable the marker. - var enableCheckbox = addNode(historyEntry, 'input'); - enableCheckbox.type = 'checkbox'; - enableCheckbox.checked = true; - enableCheckbox.color = color; - enableCheckbox.addEventListener('change', - this.onEnableCheckboxChange_.bind(this, enableCheckbox), false); - - // Searches log text for matched patterns and highlights them. - this.patternMatch(query, color); - }, - - /** - * Search the text for matched strings - */ - patternMatch: function(query, color) { - var pattern = new RegExp(query, 'i'); - for (var i = 0; i < this.logEntries.length; i++) { - var entry = this.logEntries[i]; - // Search description of each log entry - // TODO(shinfan): Add more search fields - var positions = this.findPositions( - pattern, entry.description); - for (var j = 0; j < positions.length; j++) { - var pos = positions[j]; - this.mark(entry, pos, 'description', color); - } - this.sortHighlightsByStartPosition_(this.entryHighlights[i]); - } - }, - - /** - * Highlights the text. - * @param {CrosLogEntry} entry The log entry to be highlighted - * @param {int|Array} position [start, end] - * @param {string} field The field of entry to be highlighted - * @param {string} color color used for highlighting - */ - mark: function(entry, position, field, color) { - // Creates the highlight object - var tag = new CrosHighlightTag(color, field, position, this.markCount); - // Add the highlight into entryHighlights - this.entryHighlights[entry.rowNum].push(tag); - }, - - /** - * Find the highlight objects that covers the given position - * @param {CrosHighlightTag|Array} highlights highlights of a log entry - * @param {int} position The target index - * @param {string} field The target field - * @return {CrosHighlightTag|Array} Highlights that cover the position - */ - getHighlight: function(highlights, index, field) { - var res = []; - for (var j = 0; j < highlights.length; j++) { - var highlight = highlights[j]; - if (highlight.range[0] <= index && - highlight.range[1] > index && - highlight.field == field && - highlight.enabled) { - res.push(highlight); - } - } - /** - * Sorts the result by priority so that the highlight with - * highest priority comes first. - */ - this.sortHighlightsByPriority_(res); - return res; - }, - - /** - * This function highlights the entry by going through the text from left - * to right and searching for "key" positions. - * A "key" position is a position that one (or more) highlight - * starts or ends. We only care about "key" positions because this is where - * the text highlight status changes. - * At each key position, the function decides if the text between this - * position and previous position need to be highlighted and resolves - * highlight conflicts. - * - * @param {CrosLogEntry} entry The entry going to be highlighted. - * @param {string} field The specified field of the entry. - * @param {DOMElement} parent Parent node. - */ - getHighlightedEntry: function(entry, field, parent) { - var rowNum = entry.rowNum; - // Get the original text content of the entry (without any highlights). - var content = this.logEntries[rowNum][field]; - var index = 0; - while (index < content.length) { - var nextIndex = this.getNextIndex( - this.entryHighlights[rowNum], index, field, content); - // Searches for highlights that have the position in range. - var highlights = this.getHighlight( - this.entryHighlights[rowNum], index, field); - var text = content.substr(index, nextIndex - index); - if (highlights.length > 0) { - // Always picks the highlight with highest priority. - this.addSpan(text, highlights[0].color, parent); - } else { - addNodeWithText(parent, 'span', text); - } - index = nextIndex; - } - }, - - /** - * A helper function that is used by this.getHightlightedEntry - * It returns the first index where a highlight begins or ends from - * the given index. - * @param {CrosHighlightTag|Array} highlights An array of highlights - * of a log entry. - * @param {int} index The start position. - * @param {string} field The specified field of entry. - * Other fields are ignored. - * @param {string} content The text content of the log entry. - * @return {int} The first index where a highlight begins or ends. - */ - getNextIndex: function(highlights, index, field, content) { - var minGap = Infinity; - var res = -1; - for (var i = 0; i < highlights.length; i++) { - if (highlights[i].field != field || !highlights[i].enabled) - continue; - // Distance between current index and the start index of highlight. - var gap1 = highlights[i].range[0] - index; - // Distance between current index and the end index of highlight. - var gap2 = highlights[i].range[1] - index; - if (gap1 > 0 && gap1 < minGap) { - minGap = gap1; - res = highlights[i].range[0]; - } - if (gap2 > 0 && gap2 < minGap) { - minGap = gap2; - res = highlights[i].range[1]; - } - } - // Returns |res| if found. Otherwise returns the end position of the text. - return res > 0 ? res : content.length; - }, - - /** - * A helper function that is used by this.getHightlightedEntry. - * It adds the HTML label to the text. - */ - addSpan: function(text, color, parent) { - var span = addNodeWithText(parent, 'span', text); - span.style.color = color; - span.className = LOG_MARKER_HIGHLIGHT_CLASS; - }, - - /** - * A helper function that is used by this.getHightlightedEntry. - * It adds the HTML label to the text. - */ - pickColor: function() { - for (var color in COLOR_USAGE_SET) { - if (!COLOR_USAGE_SET[color]) { - COLOR_USAGE_SET[color] = true; - return color; - } - } - return false; - }, - - /** - * A event handler that enables and disables the corresponding marker. - * @private - */ - onEnableCheckboxChange_: function(checkbox) { - for (var i = 0; i < this.entryHighlights.length; i++) { - for (var j = 0; j < this.entryHighlights[i].length; j++) { - if (this.entryHighlights[i][j].color == checkbox.color) { - this.entryHighlights[i][j].enabled = checkbox.checked; - } - } - } - this.refreshLogTable(); - }, - - /** - * A event handlier that removes the marker from history. - * @private - */ - onRemoveBtnClicked_: function(entry, color) { - entry.parentNode.removeChild(entry); - COLOR_USAGE_SET[color] = false; - for (var i = 0; i < this.entryHighlights.length; i++) { - var highlights = this.entryHighlights[i]; - while (true) { - var index = this.findHighlightByColor_(highlights, color); - if (index == -1) - break; - highlights.splice(index, 1); - } - } - this.refreshLogTable(); - }, - - /** - * A helper function that returns the index of first highlight that - * has the target color. Otherwise returns -1. - * @private - */ - findHighlightByColor_: function(highlights, color) { - for (var i = 0; i < highlights.length; i++) { - if (highlights[i].color == color) - return i; - } - return -1; - }, - - /** - * Refresh the log table in the CrosLogVisualizerView. - */ - refreshLogTable: function() { - this.logVisualizerView.populateTable(); - this.logVisualizerView.filterLog(); - }, - - /** - * A pattern can appear multiple times in a string. - * Returns positions of all the appearance. - */ - findPositions: function(pattern, str) { - var res = []; - str = str.toLowerCase(); - var match = str.match(pattern); - if (!match) - return res; - for (var i = 0; i < match.length; i++) { - var index = 0; - while (true) { - var start = str.indexOf(match[i].toLowerCase(), index); - if (start == -1) - break; - var end = start + match[i].length; - res.push([start, end]); - index = end + 1; - } - } - return res; - }, - - /** - * A helper function used in sorting highlights by start position. - * @param {HighlightTag} h1, h2 Two highlight tags in the array. - * @private - */ - compareStartPosition_: function(h1, h2) { - return h1.range[0] - h2.range[0]; - }, - - /** - * A helper function used in sorting highlights by priority. - * @param {HighlightTag} h1, h2 Two highlight tags in the array. - * @private - */ - comparePriority_: function(h1, h2) { - return h2.priority - h1.priority; - }, - - /** - * A helper function that sorts the highlights array by start position. - * @private - */ - sortHighlightsByStartPosition_: function(highlights) { - highlights.sort(this.compareStartPosition_); - }, - - /** - * A helper function that sorts the highlights array by priority. - * @private - */ - sortHighlightsByPriority_: function(highlights) { - highlights.sort(this.comparePriority_); - } - }; - - return CrosLogMarker; -})(); diff --git a/chromium/chrome/browser/resources/net_internals/cros_log_visualizer.js b/chromium/chrome/browser/resources/net_internals/cros_log_visualizer.js deleted file mode 100644 index 73db4c367c4..00000000000 --- a/chromium/chrome/browser/resources/net_internals/cros_log_visualizer.js +++ /dev/null @@ -1,376 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * This visualizer displays the log in a timeline graph - * - * - Use HTML5 canvas - * - Can zoom in result by select time range - * - Display different levels of logs in different layers of canvases - * - */ -var CrosLogVisualizer = (function() { - 'use strict'; - - // HTML attributes of canvas - var LOG_VISUALIZER_CANVAS_CLASS = 'cros-log-visualizer-visualizer-canvas'; - var LOG_VISUALIZER_CANVAS_WIDTH = 980; - var LOG_VISUALIZER_CANVAS_HEIGHT = 100; - - // Special HTML classes - var LOG_VISUALIZER_TIMELINE_ID = 'cros-log-visualizer-visualizer-timeline'; - var LOG_VISUALIZER_TIME_DISPLAY_CLASS = - 'cros-log-visualizer-visualizer-time-display'; - var LOG_VISUALIZER_RESET_BTN_ID = - 'cros-log-visualizer-visualizer-reset-btn'; - var LOG_VISUALIZER_TRACKING_LAYER_ID = - 'cros-log-visualizer-visualizer-tracking-layer'; - - /** - * Event level list - * This list is used for intialization of canvases. And the canvas - * with lowest priority should be created first. Hence the list is - * sorted in decreasing order. - */ - var LOG_EVENT_LEVEL_PRIORITY_LIST = { - 'Unknown': 4, - 'Warning': 2, - 'Info': 3, - 'Error': 1 - }; - - // Color mapping of different levels - var LOG_EVENT_COLORS_LIST = { - 'Error': '#FF99A3', - 'Warning': '#FAE5C3', - 'Info': '#C3E3FA', - 'Unknown': 'gray' - }; - - /** - * @constructor - */ - function CrosLogVisualizer(logVisualizer, containerID) { - /** - * Pass the LogVisualizer in as a reference so the visualizer can - * synchrous with the log filter. - */ - this.logVisualizer = logVisualizer; - - // If the data is initialized - this.dataIntialized = false; - // Stores all the log entries as events - this.events = []; - // A front layer that handles control events - this.trackingLayer = this.createTrackingLayer(); - - // References to HTML elements - this.container = document.getElementById(containerID); - this.timeline = this.createTimeline(); - this.timeDisplay = this.createTimeDisplay(); - this.btnReset = this.createBtnReset(); - // Canvases - this.canvases = {}; - for (var level in LOG_EVENT_LEVEL_PRIORITY_LIST) { - this.canvases[level] = this.createCanvas(); - this.container.appendChild(this.canvases[level]); - } - - // Append all the elements to the container - this.container.appendChild(this.timeline); - this.container.appendChild(this.timeDisplay); - this.container.appendChild(this.trackingLayer); - this.container.appendChild(this.btnReset); - - this.container.addEventListener('webkitAnimationEnd', function() { - this.container.classList.remove('cros-log-visualizer-flash'); - }.bind(this), false); - } - - CrosLogVisualizer.prototype = { - /** - * Called during the initialization of the View. Create a overlay - * DIV on top of the canvas that handles the mouse events - */ - createTrackingLayer: function() { - var trackingLayer = document.createElement('div'); - trackingLayer.setAttribute('id', LOG_VISUALIZER_TRACKING_LAYER_ID); - trackingLayer.addEventListener('mousemove', this.onHovered_.bind(this)); - trackingLayer.addEventListener('mousedown', this.onMouseDown_.bind(this)); - trackingLayer.addEventListener('mouseup', this.onMouseUp_.bind(this)); - return trackingLayer; - }, - - /** - * This function is called during the initialization of the view. - * It creates the timeline that moves along with the mouse on canvas. - * When user click, a rectangle can be dragged out to select the range - * to zoom. - */ - createTimeline: function() { - var timeline = document.createElement('div'); - timeline.setAttribute('id', LOG_VISUALIZER_TIMELINE_ID); - timeline.style.height = LOG_VISUALIZER_CANVAS_HEIGHT + 'px'; - timeline.addEventListener('mousedown', function(event) { return false; }); - return timeline; - }, - - /** - * This function is called during the initialization of the view. - * It creates a time display that moves with the timeline - */ - createTimeDisplay: function() { - var timeDisplay = document.createElement('p'); - timeDisplay.className = LOG_VISUALIZER_TIME_DISPLAY_CLASS; - timeDisplay.style.top = LOG_VISUALIZER_CANVAS_HEIGHT + 'px'; - return timeDisplay; - }, - - /** - * Called during the initialization of the View. Create a button that - * resets the canvas to initial status (without zoom) - */ - createBtnReset: function() { - var btnReset = document.createElement('input'); - btnReset.setAttribute('type', 'button'); - btnReset.setAttribute('value', 'Reset'); - btnReset.setAttribute('id', LOG_VISUALIZER_RESET_BTN_ID); - btnReset.addEventListener('click', this.reset.bind(this)); - return btnReset; - }, - - /** - * Called during the initialization of the View. Create a empty canvas - * that visualizes log when the data is ready - */ - createCanvas: function() { - var canvas = document.createElement('canvas'); - canvas.width = LOG_VISUALIZER_CANVAS_WIDTH; - canvas.height = LOG_VISUALIZER_CANVAS_HEIGHT; - canvas.className = LOG_VISUALIZER_CANVAS_CLASS; - return canvas; - }, - - /** - * Returns the context of corresponding canvas based on level - */ - getContext: function(level) { - return this.canvases[level].getContext('2d'); - }, - - /** - * Erases everything from all the canvases - */ - clearCanvas: function() { - for (var level in LOG_EVENT_LEVEL_PRIORITY_LIST) { - var ctx = this.getContext(level); - ctx.clearRect(0, 0, LOG_VISUALIZER_CANVAS_WIDTH, - LOG_VISUALIZER_CANVAS_HEIGHT); - } - }, - - /** - * Initializes the parameters needed for drawing: - * - lower/upperBound: Time range (Events out of range will be skipped) - * - totalDuration: The length of time range - * - unitDuration: The unit time length per pixel - */ - initialize: function() { - if (this.events.length == 0) - return; - this.dragMode = false; - this.dataIntialized = true; - this.events.sort(this.compareTime); - this.lowerBound = this.events[0].time; - this.upperBound = this.events[this.events.length - 1].time; - this.totalDuration = Math.abs(this.upperBound.getTime() - - this.lowerBound.getTime()); - this.unitDuration = this.totalDuration / LOG_VISUALIZER_CANVAS_WIDTH; - }, - - /** - * CSS3 fadeIn/fadeOut effects - */ - flashEffect: function() { - this.container.classList.add('cros-log-visualizer-flash'); - }, - - /** - * Reset the canvas to the initial time range - * Redraw everything on the canvas - * Fade in/out effects while redrawing - */ - reset: function() { - // Reset all the parameters as initial - this.initialize(); - // Reset the visibility of the entries in the log table - this.logVisualizer.filterLog(); - this.flashEffect(); - }, - - /** - * A wrapper function for drawing - */ - drawEvents: function() { - if (this.events.length == 0) - return; - for (var i in this.events) { - this.drawEvent(this.events[i]); - } - }, - - /** - * The main function that handles drawing on the canvas. - * Every event is represented as a vertical line. - */ - drawEvent: function(event) { - if (!event.visibility) { - // Skip hidden events - return; - } - var ctx = this.getContext(event.level); - ctx.beginPath(); - // Get the x-coordinate of the line - var startPosition = this.getPosition(event.time); - if (startPosition != this.old) { - this.old = startPosition; - } - ctx.rect(startPosition, 0, 2, LOG_VISUALIZER_CANVAS_HEIGHT); - // Get the color of the line - ctx.fillStyle = LOG_EVENT_COLORS_LIST[event.level]; - ctx.fill(); - ctx.closePath(); - }, - - /** - * This function is called every time the graph is zoomed. - * It recalculates all the parameters based on the distance and direction - * of dragging. - */ - reCalculate: function() { - if (this.dragDistance >= 0) { - // if user drags to right - this.upperBound = new Date((this.timelineLeft + this.dragDistance) * - this.unitDuration + this.lowerBound.getTime()); - this.lowerBound = new Date(this.timelineLeft * this.unitDuration + - this.lowerBound.getTime()); - } else { - // if user drags to left - this.upperBound = new Date(this.timelineLeft * this.unitDuration + - this.lowerBound.getTime()); - this.lowerBound = new Date((this.timelineLeft + this.dragDistance) * - this.unitDuration + this.lowerBound.getTime()); - } - this.totalDuration = this.upperBound.getTime() - - this.lowerBound.getTime(); - this.unitDuration = this.totalDuration / LOG_VISUALIZER_CANVAS_WIDTH; - }, - - /** - * Check if the time of a event is out of bound - */ - isOutOfBound: function(event) { - return event.time.getTime() < this.lowerBound.getTime() || - event.time.getTime() > this.upperBound.getTime(); - }, - - /** - * This function returns the offset on x-coordinate of canvas based on - * the time - */ - getPosition: function(time) { - return (time.getTime() - this.lowerBound.getTime()) / this.unitDuration; - }, - - /** - * This function updates the events array and refresh the canvas. - */ - updateEvents: function(newEvents) { - this.events.length = 0; - for (var i in newEvents) { - this.events.push(newEvents[i]); - } - if (!this.dataIntialized) { - this.initialize(); - } - this.clearCanvas(); - this.drawEvents(); - }, - - /** - * This is a helper function that returns the time object based on the - * offset of x-coordinate on the canvs. - */ - getOffsetTime: function(offset) { - return new Date(this.lowerBound.getTime() + offset * this.unitDuration); - }, - - /** - * This function is triggered when the hovering event is detected - * When the mouse is hovering we have two control mode: - * - If it is in drag mode, we need to resize the width of the timeline - * - If not, we need to move the timeline and time display to the - * x-coordinate position of the mouse - */ - onHovered_: function(event) { - var offsetX = event.offsetX; - if (this.lastOffsetX == offsetX) { - // If the mouse does not move, we just skip the event - return; - } - - if (this.dragMode == true) { - // If the mouse is in drag mode - this.dragDistance = offsetX - this.timelineLeft; - if (this.dragDistance >= 0) { - // If the mouse is moving right - this.timeline.style.width = this.dragDistance + 'px'; - } else { - // If the mouse is moving left - this.timeline.style.width = -this.dragDistance + 'px'; - this.timeline.style.left = offsetX + 'px'; - } - } else { - // If the mouse is not in drag mode we just move the timeline - this.timeline.style.width = '2px'; - this.timeline.style.left = offsetX + 'px'; - } - - // update time display - this.timeDisplay.style.left = offsetX + 'px'; - this.timeDisplay.textContent = - this.getOffsetTime(offsetX).toTimeString().substr(0, 8); - // update the last offset - this.lastOffsetX = offsetX; - }, - - /** - * This function is the handler for the onMouseDown event on the canvas - */ - onMouseDown_: function(event) { - // Enter drag mode which let user choose a time range to zoom in - this.dragMode = true; - this.timelineLeft = event.offsetX; - // Create a duration display to indicate the duration of range. - this.timeDurationDisplay = this.createTimeDisplay(); - this.container.appendChild(this.timeDurationDisplay); - }, - - /** - * This function is the handler for the onMouseUp event on the canvas - */ - onMouseUp_: function(event) { - // Remove the duration display - this.container.removeChild(this.timeDurationDisplay); - // End the drag mode - this.dragMode = false; - // Recalculate the pamameter based on the range user select - this.reCalculate(); - // Filter the log table and hide the entries that are not in the range - this.logVisualizer.filterLog(); - }, - }; - - return CrosLogVisualizer; -})(); diff --git a/chromium/chrome/browser/resources/net_internals/cros_log_visualizer_view.css b/chromium/chrome/browser/resources/net_internals/cros_log_visualizer_view.css deleted file mode 100644 index 8f49da37a8f..00000000000 --- a/chromium/chrome/browser/resources/net_internals/cros_log_visualizer_view.css +++ /dev/null @@ -1,234 +0,0 @@ - /* Copyright 2013 The Chromium Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - #cros-log-visualizer-header { - margin-bottom: 20px; - } - -.cros-log-visualizer-container { - background-color: rgb(242, 242, 242); - border: 1px solid rgb(220, 220, 220); -} - -#cros-log-visualizer-log-content { - border: 1px solid rgb(220, 220, 220); - font-size: 11px; - height: 300px; - line-height: 18px; - margin-bottom: -1px; - overflow: scroll; - padding: 10px; - width: 1000px; - } - -#cros-log-visualizer-filter-container { - font-size: 12px; - margin-bottom: 5px; - padding: 5px 10px; - width: 1000px; -} - -#cros-log-visualizer-filter-container p { - margin: 10px 0; -} - -#cros-log-visualizer-log-table { - table-layout: fixed; - width: 950px; -} - -#cros-log-visualizer-log-table td { - overflow: hidden; - table-layout: fixed; - word-wrap: break-word; -} - -.cros-log-visualizer-td-time { - width: 100px; -} - -#cros-log-visualizer-log-header-table { - font-size: 12px; - font-weight: bold; - margin-bottom: -1px; - text-align: center; - width: 1000px; -} - -.cros-log-visualizer-td-pname { - text-align: center; - width: 120px; -} - -.cros-log-visualizer-td-level { - width: 70px; -} - -.cros-log-visualizer-td-level p { - border: 1px solid; - border-radius: 5px; - margin: 0 3px; - text-align: center; - width: 58px; -} - -.cros-log-visualizer-td-level-error { - background-color: rgb(255, 153, 163); - color: rgb(238, 0, 0); -} - -.cros-log-visualizer-td-level-info { - background-color: rgb(195, 227, 250); - color: rgb(10, 147, 245); - width: 120px; -} - -.cros-log-visualizer-td-level-warning { - background-color: rgb(250, 229, 195); - color: darkorange; -} - -.cros-log-visualizer-td-level-unknown { - color: gray; -} - -.cros-log-visualizer-td-pid { - width: 60px; -} - -#cros-log-visualizer-filter-pname { - border-bottom: 1px solid rgb(209, 209, 209); - padding: 5px 0 10px 0; -} - -#cros-log-visualizer-filter-level { - padding: 5px 0 10px 0; -} - -#cros-log-visualizer-search-container { - -webkit-margin-start: 760px; - border-radius: 5px; - font-size: 12px; - margin-bottom: 5px; - margin-left: 720px; - margin-top: -40px; - padding: 5px; - width: 280px; -} - -#cros-log-visualizer-search-container input { - border: 1px solid rgb(220, 220, 220); -} - -#cros-log-visualizer-visualizer-container { - border: 1px solid rgb(211, 211, 211); - height: 100px; - position: relative; - width: 1002px; -} - -#cros-log-visualizer-visualizer-timeline { - background: gray; - opacity: 0.5; - position: absolute; - top: 0; - width: 2px; -} - -.cros-log-visualizer-visualizer-time-display { - font-size: 10px; - position: absolute; - width: 50px; -} - -#cros-log-visualizer-visualizer-reset-btn { - border: 1px solid rgb(211, 211, 211); - border-radius: 2px; - position: absolute; - right: 5px; - top: 5px; -} - -#cros-log-visualizer-visualizer-tracking-layer { - background: none; - height: 100%; - left: 0; - position: absolute; - top: 0; - width: 100%; -} - -.cros-log-visualizer-visualizer-canvas { - left: 0; - position: absolute; - top: 0; -} - -.cros-log-visualizer-flash { - -webkit-animation: fade 1s linear 1; -} - -#cros-log-visualizer-marker-container { - background-color: rgb(242, 242, 242); - border: 1px solid rgb(211, 211, 211); - left: 1030px; - min-height: 320px; - padding: 10px; - position: absolute; - top: 63px; - width: 200px; -} - -.cros-log-visualizer-marker-history-entry { - display: -webkit-flex; - height: 20px; -} - - -.cros-log-visualizer-marker-history-entry * { - display: block; -} - -.cros-log-visualizer-marker-history-entry p { - font-size: 13px; - height: 15px; - margin: 0; - width: 98px; -} - -.cros-log-visualizer-marker-history-entry a { - color: grey; - font-size: 11px; -} - -.cros-log-visualizer-marker-history-color-tag { - border-radius: 10px; - height: 10px; - margin: 4px; - width: 10px; -} - -.cros-log-visualizer-marker-highlight { - font-weight: bold; -} - -#cros-log-visualizer-save-btn { - background-color: rgb(211, 211, 211); -} - -@-webkit-keyframes fade { - 0% - { - opacity: 1; - } - 50% - { - opacity: 0; - } - 100% - { - opacity: 1; - } -} diff --git a/chromium/chrome/browser/resources/net_internals/cros_log_visualizer_view.html b/chromium/chrome/browser/resources/net_internals/cros_log_visualizer_view.html deleted file mode 100644 index ee6aa32dff8..00000000000 --- a/chromium/chrome/browser/resources/net_internals/cros_log_visualizer_view.html +++ /dev/null @@ -1,56 +0,0 @@ -<!-- Log Visualizer --> -<div id="cros-log-visualizer-tab-content" class="content-box"> - <div id="cros-log-visualizer-header"> - Network Log - </div> - <div id='cros-log-visualizer-search-container' - class='cros-log-visualizer-container'> - Search: - <input type='text' placeholder="Enter your keyword" - id='cros-log-visualizer-search-input'> - <span id='cros-log-visualizer-save-btn'>Save</span> - </div> - <table id="cros-log-visualizer-log-header-table" - class="cros-log-visualizer-container"> - <tr> - <td class="cros-log-visualizer-td-level">Level</td> - <td class="cros-log-visualizer-td-time">Time</td> - <td class="cros-log-visualizer-td-pname">Process</td> - <td class="cros-log-visualizer-td-pid">PID</td> - <td class="cros-log-visualizer-td-description">Description</td> - </tr> - </table> - <div id="cros-log-visualizer-log-content"> - <table id="cros-log-visualizer-log-table"> - </table> - </div> - <div id='cros-log-visualizer-marker-container'> - </div> - <div id='cros-log-visualizer-filter-container' - class='cros-log-visualizer-container'> - <div id='cros-log-visualizer-filter-pname'> - </div> - <div id='cros-log-visualizer-filter-level'> - Level: - <span class="cros-log-visualizer-filter-level-block"> - <input type='checkbox' id='checkbox-error' checked=true> - <label for="checkbox-error">Error</label> - </span> - <span class="cros-log-visualizer-filter-level-block"> - <input type='checkbox' id='checkbox-warning' checked=true> - <label for="checkbox-warning">Warning</label> - </span> - <span class="cros-log-visualizer-filter-level-block"> - <input type='checkbox' id='checkbox-info' checked=true> - <label for="checkbox-info">Info</label> - </span> - <span class="cros-log-visualizer-filter-level-block"> - <input type='checkbox' id='checkbox-unknown' checked=true> - <label for="checkbox-unknown">Unknown</label> - </span> - </div> - </div> - <div id="cros-log-visualizer-visualizer-container"> - <div id="cros-log-visualizer-visualizer-tracking-layer"></div> - </div> -</div> diff --git a/chromium/chrome/browser/resources/net_internals/cros_log_visualizer_view.js b/chromium/chrome/browser/resources/net_internals/cros_log_visualizer_view.js deleted file mode 100644 index 6a0bf4840f3..00000000000 --- a/chromium/chrome/browser/resources/net_internals/cros_log_visualizer_view.js +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * This view displays the log messages from various resources in an - * interactive log visualizer - * - * - Filter checkboxes - * - Filter text inputs - * - Display the log by different sections: time|level|process|description - * - */ -var CrosLogVisualizerView = (function() { - 'use strict'; - - // Inherits from DivView. - var superClass = DivView; - - // Special classes (defined in log_visualizer_view.css) - var LOG_CONTAINER_CLASSNAME = 'cros-log-visualizer-container'; - var LOG_FILTER_PNAME_BLOCK_CLASSNAME = - 'cros-log-visualizer-filter-pname-block'; - var LOG_CELL_HEADER_CLASSNAME = 'cros-log-visualizer-td-head'; - var LOG_CELL_TIME_CLASSNAME = 'cros-log-visualizer-td-time'; - var LOG_CELL_PNAME_CLASSNAME = 'cros-log-visualizer-td-pname'; - var LOG_CELL_PID_CLASSNAME = 'cros-log-visualizer-td-pid'; - var LOG_CELL_DESCRIPTION_CLASSNAME = 'cros-log-visualizer-td-description'; - var LOG_CELL_LEVEL_CLASSNAME = 'cros-log-visualizer-td-level'; - var LOG_CELL_LEVEL_CLASSNAME_LIST = { - 'Error': 'cros-log-visualizer-td-level-error', - 'Warning': 'cros-log-visualizer-td-level-warning', - 'Info': 'cros-log-visualizer-td-level-info', - 'Unknown': 'cros-log-visualizer-td-level-unknown' - }; - - /** - * @constructor - */ - function CrosLogVisualizerView() { - assertFirstConstructorCall(CrosLogVisualizerView); - - // Call superclass's constructor. - superClass.call(this, CrosLogVisualizerView.MAIN_BOX_ID); - - // Stores log entry objects - this.logEntries = []; - // Stores current search query - this.currentQuery = ''; - // Stores raw text data of log - this.logData = ''; - // Stores all the unique process names - this.pNames = []; - // References to special HTML elements in log_visualizer_view.html - this.pNameCheckboxes = {}; - this.levelCheckboxes = {}; - this.tableEntries = []; - - this.initialize(); - } - - CrosLogVisualizerView.TAB_ID = 'tab-handle-cros-log-visualizer'; - CrosLogVisualizerView.TAB_NAME = 'Log Visualizer'; - CrosLogVisualizerView.TAB_HASH = '#visualizer'; - - // IDs for special HTML elements in log_visualizer_view.html - CrosLogVisualizerView.MAIN_BOX_ID = 'cros-log-visualizer-tab-content'; - CrosLogVisualizerView.LOG_TABLE_ID = 'cros-log-visualizer-log-table'; - CrosLogVisualizerView.LOG_FILTER_PNAME_ID = - 'cros-log-visualizer-filter-pname'; - CrosLogVisualizerView.LOG_SEARCH_INPUT_ID = - 'cros-log-visualizer-search-input'; - CrosLogVisualizerView.LOG_SEARCH_SAVE_BTN_ID = 'cros-log-visualizer-save-btn'; - CrosLogVisualizerView.LOG_VISUALIZER_CONTAINER_ID = - 'cros-log-visualizer-visualizer-container'; - - cr.addSingletonGetter(CrosLogVisualizerView); - - /** - * Contains types of logs we are interested in - */ - var LOGS_LIST = { - 'NETWORK_LOG': 1, - 'SYSTEM_LOG': 2 - }; - - /** - * Contains headers of the log table - */ - var TABLE_HEADERS_LIST = ['Level', 'Time', 'Process', 'PID', 'Description']; - - CrosLogVisualizerView.prototype = { - // Inherit the superclass's methods. - __proto__: superClass.prototype, - - /** - * Called during the initialization of the View. Adds the system log - * listener into Browser_Bridge so that the system log can be retrieved. - */ - initialize: function() { - g_browser.addSystemLogObserver(this); - $(CrosLogVisualizerView.LOG_SEARCH_INPUT_ID).addEventListener('keyup', - this.onSearchQueryChange_.bind(this)); - $(CrosLogVisualizerView.LOG_SEARCH_SAVE_BTN_ID).addEventListener( - 'click', this.onSaveBtnClicked_.bind(this)); - }, - - /** - * Called when the save button is clicked. Saves the current filter query - * to the mark history. And highlights the matched text with colors. - */ - onSaveBtnClicked_: function() { - this.marker.addMarkHistory(this.currentQuery); - // Clears the filter query - $(CrosLogVisualizerView.LOG_SEARCH_INPUT_ID).value = ''; - this.currentQuery = ''; - // Refresh the table - this.populateTable(); - this.filterLog(); - }, - - onSearchQueryChange_: function() { - var inputField = $(CrosLogVisualizerView.LOG_SEARCH_INPUT_ID); - this.currentQuery = inputField.value; - this.filterLog(); - }, - - /** - * Creates the log table where each row represents a entry of log. - * This function is called if and only if the log is received from system - * level. - */ - populateTable: function() { - var logTable = $(CrosLogVisualizerView.LOG_TABLE_ID); - logTable.innerHTML = ''; - this.tableEntries.length = 0; - // Create entries - for (var i = 0; i < this.logEntries.length; i++) { - this.logEntries[i].rowNum = i; - var row = this.createTableRow(this.logEntries[i]); - logTable.appendChild(row); - } - }, - - /** - * Creates the single row of the table where each row is a representation - * of the logEntry object. - */ - createTableRow: function(entry) { - var row = document.createElement('tr'); - for (var i = 0; i < 5; i++) { - // Creates rows - addNode(row, 'td'); - } - var cells = row.childNodes; - // Level cell - cells[0].className = LOG_CELL_LEVEL_CLASSNAME; - var levelTag = addNodeWithText(cells[0], 'p', entry.level); - levelTag.className = LOG_CELL_LEVEL_CLASSNAME_LIST[entry.level]; - - // Time cell - cells[1].className = LOG_CELL_TIME_CLASSNAME; - cells[1].textContent = entry.getTime(); - - // Process name cell - cells[2].className = LOG_CELL_PNAME_CLASSNAME; - this.marker.getHighlightedEntry(entry, 'processName', cells[2]); - - // Process ID cell - cells[3].className = LOG_CELL_PID_CLASSNAME; - this.marker.getHighlightedEntry(entry, 'processID', cells[3]); - - // Description cell - cells[4].className = LOG_CELL_DESCRIPTION_CLASSNAME; - this.marker.getHighlightedEntry(entry, 'description', cells[4]); - - // Add the row into this.tableEntries for future reference - this.tableEntries.push(row); - return row; - }, - - /** - * Regenerates the table and filter. - */ - refresh: function() { - this.createFilter(); - this.createLogMaker(); - this.populateTable(); - this.createVisualizer(); - }, - - /** - * Uses the search query to match the pattern in different fields of entry. - */ - patternMatch: function(entry, pattern) { - return entry.processID.match(pattern) || - entry.processName.match(pattern) || - entry.level.match(pattern) || - entry.description.match(pattern); - }, - - /** - * Filters the log to show/hide the rows in the table. - * Each logEntry instance has a visibility property. This function - * shows or hides the row only based on this property. - */ - filterLog: function() { - // Supports regular expression - var pattern = new RegExp(this.currentQuery, 'i'); - for (var i = 0; i < this.logEntries.length; i++) { - var entry = this.logEntries[i]; - // Filters the result by pname and level - var pNameCheckbox = this.pNameCheckboxes[entry.processName]; - var levelCheckbox = this.levelCheckboxes[entry.level]; - entry.visibility = pNameCheckbox.checked && levelCheckbox.checked && - !this.visualizer.isOutOfBound(entry); - if (this.currentQuery) { - // If the search query is not empty, filter the result by query - entry.visibility = entry.visibility && - this.patternMatch(entry, pattern); - } - // Changes style of HTML row based on the visibility of logEntry - if (entry.visibility) { - this.tableEntries[i].style.display = 'table-row'; - } else { - this.tableEntries[i].style.display = 'none'; - } - } - this.filterVisualizer(); - }, - - /** - * Initializes filter tags and checkboxes. There are two types of filters: - * Level and Process. Level filters are static that we have only 4 levels - * in total but process filters are dynamically changing based on the log. - * The filter layout looks like: - * |-----------------------------------------------------------------| - * | | - * | Section of process filter | - * | | - * |-----------------------------------------------------------------| - * | | - * | Section of level filter | - * | | - * |-----------------------------------------------------------------| - */ - createFilter: function() { - this.createFilterByPName(); - this.levelCheckboxes = { - 'Error': $('checkbox-error'), - 'Warning': $('checkbox-warning'), - 'Info': $('checkbox-info'), - 'Unknown': $('checkbox-unknown') - }; - - for (var level in this.levelCheckboxes) { - this.levelCheckboxes[level].addEventListener( - 'change', this.onFilterChange_.bind(this)); - } - }, - - /** - * Helper function of createFilter(). Create filter section of - * process filters. - */ - createFilterByPName: function() { - var filterContainerDiv = $(CrosLogVisualizerView.LOG_FILTER_PNAME_ID); - filterContainerDiv.innerHTML = 'Process: '; - for (var i = 0; i < this.pNames.length; i++) { - var pNameBlock = this.createPNameBlock(this.pNames[i]); - filterContainerDiv.appendChild(pNameBlock); - } - }, - - /** - * Helper function of createFilterByPName(). Create a single filter block in - * the section of process filters. - */ - createPNameBlock: function(pName) { - var block = document.createElement('span'); - block.className = LOG_FILTER_PNAME_BLOCK_CLASSNAME; - - var tag = document.createElement('label'); - var span = document.createElement('span'); - span.textContent = pName; - - var checkbox = document.createElement('input'); - checkbox.type = 'checkbox'; - checkbox.name = pName; - checkbox.value = pName; - checkbox.checked = true; - checkbox.addEventListener('change', this.onFilterChange_.bind(this)); - this.pNameCheckboxes[pName] = checkbox; - - tag.appendChild(checkbox); - tag.appendChild(span); - block.appendChild(tag); - - return block; - }, - - /** - * Click handler for filter checkboxes. Everytime a checkbox is clicked, - * the visibility of related logEntries are changed. - */ - onFilterChange_: function() { - this.filterLog(); - }, - - /** - * Creates a visualizer that visualizes the logs as a timeline graph - * during the initialization of the View. - */ - createVisualizer: function() { - this.visualizer = new CrosLogVisualizer(this, - CrosLogVisualizerView.LOG_VISUALIZER_CONTAINER_ID); - this.visualizer.updateEvents(this.logEntries); - }, - - /** - * Sync the visibility of log entries with the visualizer. - */ - filterVisualizer: function() { - this.visualizer.updateEvents(this.logEntries); - }, - - /** - * Called during the initialization. It creates the log marker that - * highlights log text. - */ - createLogMaker: function() { - this.marker = new CrosLogMarker(this); - }, - - /** - * Given a row text line of log, a logEntry instance is initialized and used - * for parsing. After the text is parsed, we put the instance into - * logEntries which is an array for storing. This function is called when - * the data is received from Browser Bridge. - */ - addLogEntry: function(logType, textEntry) { - var newEntry = new CrosLogEntry(); - if (logType == LOGS_LIST.NETWORK_LOG) { - newEntry.tokenizeNetworkLog(textEntry); - } else { - //TODO(shinfan): Add more if cases here - } - this.logEntries.push(newEntry); - - // Record pname - var pName = newEntry.processName; - if (this.pNames.indexOf(pName) == -1) { - this.pNames.push(pName); - } - }, - - /* - * Asynchronous call back function from Browser Bridge. - */ - onSystemLogChanged: function(callback) { - if (callback.log == this.logData) return; - this.logData = callback.log; - // Clear the old array by setting length to zero - this.logEntries.length = 0; - var entries = callback.log.split('\n'); - for (var i = 1; i < entries.length; i++) { - this.addLogEntry(LOGS_LIST.NETWORK_LOG, entries[i]); - } - this.refresh(); - } - }; - - return CrosLogVisualizerView; -})(); diff --git a/chromium/chrome/browser/resources/net_internals/dns_view.html b/chromium/chrome/browser/resources/net_internals/dns_view.html index 37c61a79557..69b94f745ff 100644 --- a/chromium/chrome/browser/resources/net_internals/dns_view.html +++ b/chromium/chrome/browser/resources/net_internals/dns_view.html @@ -1,7 +1,7 @@ <!-- Host resolver info --> <div id=dns-view-tab-content class=content-box> <ul style='margin-top: 0'> - <li><a href='#events&q=type:HOST_RESOLVER_IMPL_REQUEST,HOST_RESOLVER_IMPL_JOB%20is:active'>View pending lookups</a></li> + <li><a href='#events&q=type:HOST_RESOLVER_IMPL_JOB%20is:active'>View pending lookups</a></li> <li>Default address family: <span id=dns-view-default-family></span> <span id=dns-view-ipv6-disabled class=warning-text style="display: none;"> (IPv6 disabled) diff --git a/chromium/chrome/browser/resources/net_internals/dns_view.js b/chromium/chrome/browser/resources/net_internals/dns_view.js index 806668f3232..ce507efa167 100644 --- a/chromium/chrome/browser/resources/net_internals/dns_view.js +++ b/chromium/chrome/browser/resources/net_internals/dns_view.js @@ -202,7 +202,7 @@ var DnsView = (function() { * Takes a last of strings and adds them all to a DOM node, displaying them * on separate lines. * @param {DomNode} node The parent node. - * @param {Array.<string>} list List of strings to add to the node. + * @param {Array<string>} list List of strings to add to the node. */ function addListToNode_(node, list) { for (var i = 0; i < list.length; ++i) diff --git a/chromium/chrome/browser/resources/net_internals/events_view.css b/chromium/chrome/browser/resources/net_internals/events_view.css index 58a327ae431..80b4d65cc62 100644 --- a/chromium/chrome/browser/resources/net_internals/events_view.css +++ b/chromium/chrome/browser/resources/net_internals/events_view.css @@ -6,8 +6,6 @@ #events-view-filter-box { background: #efefef; border-bottom: 1px solid #aaa; - font-family: sans-serif; - font-size: 75%; overflow: hidden; padding: 5px; white-space: nowrap; @@ -42,7 +40,6 @@ #events-view-source-list-table td { border-bottom: 1px solid #afafaf; border-left: 1px solid #afafaf; - font-size: 75%; padding: 3px; text-overflow: ellipsis; white-space: nowrap; diff --git a/chromium/chrome/browser/resources/net_internals/hsts_view.js b/chromium/chrome/browser/resources/net_internals/hsts_view.js index 76e1dd1eab6..2310b9f7907 100644 --- a/chromium/chrome/browser/resources/net_internals/hsts_view.js +++ b/chromium/chrome/browser/resources/net_internals/hsts_view.js @@ -119,11 +119,14 @@ var HSTSView = (function() { s.innerHTML = '<b>Found:</b><br/>'; var keys = [ - 'domain', 'static_upgrade_mode', 'static_sts_include_subdomains', - 'static_pkp_include_subdomains', 'static_sts_observed', - 'static_pkp_observed', 'static_spki_hashes', 'dynamic_upgrade_mode', - 'dynamic_sts_include_subdomains', 'dynamic_pkp_include_subdomains', - 'dynamic_sts_observed', 'dynamic_pkp_observed', 'dynamic_spki_hashes' + 'static_sts_domain', 'static_upgrade_mode', + 'static_sts_include_subdomains', 'static_sts_observed', + 'static_pkp_domain', 'static_pkp_include_subdomains', + 'static_pkp_observed', 'static_spki_hashes', 'dynamic_sts_domain', + 'dynamic_upgrade_mode', 'dynamic_sts_include_subdomains', + 'dynamic_sts_observed', 'dynamic_pkp_domain', + 'dynamic_pkp_include_subdomains', 'dynamic_pkp_observed', + 'dynamic_spki_hashes', ]; var kStaticHashKeys = [ diff --git a/chromium/chrome/browser/resources/net_internals/index.html b/chromium/chrome/browser/resources/net_internals/index.html index db186f75ee0..5cf974e2e0e 100644 --- a/chromium/chrome/browser/resources/net_internals/index.html +++ b/chromium/chrome/browser/resources/net_internals/index.html @@ -1,5 +1,5 @@ <!DOCTYPE HTML> -<html i18n-values=".style.fontFamily: fontfamily;"> +<html> <!-- Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be @@ -10,14 +10,13 @@ found in the LICENSE file. <!-- Don't use automatic scaling on mobile --> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> + <link rel="stylesheet" href="chrome://resources/css/text_defaults.css"> <link rel="stylesheet" href="main.css"> <link rel="stylesheet" href="status_view.css"> <link rel="stylesheet" href="events_view.css"> <link rel="stylesheet" href="waterfall_view.css"> <link rel="stylesheet" href="timeline_view.css"> - <link rel="stylesheet" href="logs_view.css"> <link rel="stylesheet" href="chromeos_view.css"> - <link rel="stylesheet" href="cros_log_visualizer_view.css"> <script src="chrome://resources/js/util.js"></script> <script src="chrome://resources/js/cr.js"></script> <script src="chrome://resources/js/load_time_data.js"></script> @@ -40,17 +39,15 @@ found in the LICENSE file. <include src="import_view.html"> <include src="export_view.html"> <include src="capture_view.html"> - <include src="test_view.html"> <include src="hsts_view.html"> <include src="events_view.html"> <include src="waterfall_view.html"> <include src="timeline_view.html"> - <include src="logs_view.html"> + <include src="sdch_view.html"> <include src="chromeos_view.html"> - <include src="cros_log_visualizer_view.html"> </div> - <script src="chrome://resources/js/i18n_template2.js"></script> + <script src="chrome://resources/js/i18n_template.js"></script> <script src="chrome://resources/js/jstemplate_compiled.js"></script> </body> </html> diff --git a/chromium/chrome/browser/resources/net_internals/index.js b/chromium/chrome/browser/resources/net_internals/index.js index 990a773bad1..55b9abf7a76 100644 --- a/chromium/chrome/browser/resources/net_internals/index.js +++ b/chromium/chrome/browser/resources/net_internals/index.js @@ -11,7 +11,6 @@ <include src="capture_view.js"> <include src="export_view.js"> <include src="http_cache_view.js"> -<include src="test_view.js"> <include src="hsts_view.js"> <include src="browser_bridge.js"> <include src="events_tracker.js"> @@ -45,14 +44,10 @@ <include src="sockets_view.js"> <include src="spdy_view.js"> <include src="modules_view.js"> -<include src="logs_view.js"> <include src="prerender_view.js"> <include src="chromeos_view.js"> <include src="bandwidth_view.js"> -<include src="cros_log_visualizer_view.js"> -<include src="cros_log_entry.js"> -<include src="cros_log_visualizer.js" > -<include src="cros_log_marker.js" > +<include src="sdch_view.js"> document.addEventListener('DOMContentLoaded', function() { MainView.getInstance(); // from main.js diff --git a/chromium/chrome/browser/resources/net_internals/log_util.js b/chromium/chrome/browser/resources/net_internals/log_util.js index 7b36b26d95c..5438c648510 100644 --- a/chromium/chrome/browser/resources/net_internals/log_util.js +++ b/chromium/chrome/browser/resources/net_internals/log_util.js @@ -275,6 +275,7 @@ log_util = (function() { // it's most likely a full log dump. Otherwise, it may be a dump created by // --log-net-log. var parsedDump = null; + var errorString = ''; try { parsedDump = JSON.parse(logFileContents); } catch (error) { @@ -283,8 +284,10 @@ log_util = (function() { // after the final good entry, and add the necessary close brackets. var end = Math.max(logFileContents.lastIndexOf(',\n'), logFileContents.lastIndexOf(',\r')); - if (end != -1) + if (end != -1) { parsedDump = JSON.parse(logFileContents.substring(0, end) + ']}'); + errorString += 'Log file truncated. Events may be missing.\n'; + } } catch (error2) { } @@ -292,7 +295,7 @@ log_util = (function() { if (!parsedDump) return 'Unable to parse log dump as JSON file.'; - return loadLogDump(parsedDump, fileName); + return errorString + loadLogDump(parsedDump, fileName); } // Exports. diff --git a/chromium/chrome/browser/resources/net_internals/log_view_painter.js b/chromium/chrome/browser/resources/net_internals/log_view_painter.js index 069a5a94815..05d85eb040f 100644 --- a/chromium/chrome/browser/resources/net_internals/log_view_painter.js +++ b/chromium/chrome/browser/resources/net_internals/log_view_painter.js @@ -87,7 +87,7 @@ createLogEntryTablePrinter = function(logEntries, privacyStripping, } return tablePrinter; -} +}; /** * Adds a new row to the given TablePrinter, and adds five cells containing @@ -273,6 +273,7 @@ function getParamaterWriterForEventType(eventType) { switch (eventType) { case EventType.HTTP_TRANSACTION_SEND_REQUEST_HEADERS: case EventType.HTTP_TRANSACTION_SEND_TUNNEL_HEADERS: + case EventType.TYPE_HTTP_CACHE_CALLER_REQUEST_HEADERS: return writeParamsForRequestHeaders; case EventType.PROXY_CONFIG_CHANGED: @@ -281,6 +282,8 @@ function getParamaterWriterForEventType(eventType) { case EventType.CERT_VERIFIER_JOB: case EventType.SSL_CERTIFICATES_RECEIVED: return writeParamsForCertificates; + case EventType.EV_CERT_CT_COMPLIANCE_CHECKED: + return writeParamsForCheckedEVCertificates; case EventType.SSL_VERSION_FALLBACK: return writeParamsForSSLVersionFallback; @@ -350,6 +353,12 @@ function defaultWriteParameter(key, value, out) { return; } + if (key == 'sdch_problem_code' && typeof value == 'number') { + var valueStr = value + ' (' + sdchProblemCodeToString(value) + ')'; + out.writeArrowKeyValue(key, valueStr); + return; + } + // Otherwise just default to JSON formatting of the value. out.writeArrowKeyValue(key, JSON.stringify(value)); } @@ -558,7 +567,7 @@ stripCookiesAndLoginInfo = function(entry) { entry.params.headers = entry.params.headers.map(stripCookieOrLoginInfo); return entry; -} +}; /** * Outputs the request header parameters of |entry| to |out|. @@ -579,30 +588,28 @@ function writeParamsForRequestHeaders(entry, out, consumedParams) { consumedParams.headers = true; } +function writeCertificateParam( + certs_container, out, consumedParams, paramName) { + if (certs_container.certificates instanceof Array) { + var certs = certs_container.certificates.reduce( + function(previous, current) { + return previous.concat(current.split('\n')); + }, new Array()); + out.writeArrowKey(paramName); + out.writeSpaceIndentedLines(8, certs); + consumedParams[paramName] = true; + } +} + /** * Outputs the certificate parameters of |entry| to |out|. */ function writeParamsForCertificates(entry, out, consumedParams) { - if (entry.params.certificates instanceof Array) { - var certs = entry.params.certificates.reduce(function(previous, current) { - return previous.concat(current.split('\n')); - }, new Array()); - out.writeArrowKey('certificates'); - out.writeSpaceIndentedLines(8, certs); - consumedParams.certificates = true; - } - - if (typeof(entry.params.verified_cert) == 'object') { - if (entry.params.verified_cert.certificates instanceof Array) { - var certs = entry.params.verified_cert.certificates.reduce( - function(previous, current) { - return previous.concat(current.split('\n')); - }, new Array()); - out.writeArrowKey('verified_cert'); - out.writeSpaceIndentedLines(8, certs); - consumedParams.verified_cert = true; - } - } + writeCertificateParam(entry.params, out, consumedParams, 'certificates'); + + if (typeof(entry.params.verified_cert) == 'object') + writeCertificateParam( + entry.params.verified_cert, out, consumedParams, 'verified_cert'); if (typeof(entry.params.cert_status) == 'number') { var valueStr = entry.params.cert_status + ' (' + @@ -613,6 +620,12 @@ function writeParamsForCertificates(entry, out, consumedParams) { } +function writeParamsForCheckedEVCertificates(entry, out, consumedParams) { + if (typeof(entry.params.certificate) == 'object') + writeCertificateParam( + entry.params.certificate, out, consumedParams, 'certificate'); +} + /** * Outputs the SSL version fallback parameters of |entry| to |out|. */ diff --git a/chromium/chrome/browser/resources/net_internals/logs_view.css b/chromium/chrome/browser/resources/net_internals/logs_view.css deleted file mode 100644 index 4a1d3750b60..00000000000 --- a/chromium/chrome/browser/resources/net_internals/logs_view.css +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2012 The Chromium Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -.logs-view-log-cell-text, -.logs-view-log-cell-log { - background-color: white; -} - -.logs-view-log-row-collapsed .logs-view-log-cell-log { - display: none; -} - -.logs-view-log-row-expanded .logs-view-log-cell-log { - display: table-cell; -} - -.logs-view-log-table-button-column { - text-align: center; -} - -.logs-view-log-button { - width: 85px; -} - -.logs-view-global-button { - float: left; - margin: 5px; - margin-top: 0; - width: 135px; -} - -#logs-view-log-table td { - font-family: 'Courier New', monospace; - font-size: 12px; - line-height: 17px; - padding: 3px 5px 0; - vertical-align: top; - white-space: pre; -} - -#logs-view-log-table-header-row th { - text-align: left; -} diff --git a/chromium/chrome/browser/resources/net_internals/logs_view.html b/chromium/chrome/browser/resources/net_internals/logs_view.html deleted file mode 100644 index fdae5e23efa..00000000000 --- a/chromium/chrome/browser/resources/net_internals/logs_view.html +++ /dev/null @@ -1,19 +0,0 @@ -<!-- ============================ Logs View ============================ --> - -<div id=logs-view-tab-content style="display: none;" class=content-box> - <button id=logs-view-global-show-btn class=logs-view-global-button>Show all...</button> - <button id=logs-view-global-hide-btn class=logs-view-global-button>Hide all...</button> - <button id=logs-view-refresh-btn class=logs-view-global-button>Refresh logs...</button> - <div style="clear: both"></div> - <table width=100% class=styled-table> - <thead> - <tr id=logs-view-log-table-header-row> - <th width=10%>Log Name</th> - <th width=8%></th> - <th width=82%>Log</th> - </tr> - </thead> - <tbody id=logs-view-log-table> - </tbody> - </table> -</div> diff --git a/chromium/chrome/browser/resources/net_internals/logs_view.js b/chromium/chrome/browser/resources/net_internals/logs_view.js deleted file mode 100644 index 3c73150f263..00000000000 --- a/chromium/chrome/browser/resources/net_internals/logs_view.js +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * This view displays network related log data and is specific fo ChromeOS. - * We get log data from chrome by filtering system logs for network related - * keywords. Logs are not fetched until we actually need them. - */ -var LogsView = (function() { - 'use strict'; - - // Special classes (defined in logs_view.css). - var LOG_ROW_COLLAPSED_CLASSNAME = 'logs-view-log-row-collapsed'; - var LOG_ROW_EXPANDED_CLASSNAME = 'logs-view-log-row-expanded'; - var LOG_CELL_TEXT_CLASSNAME = 'logs-view-log-cell-text'; - var LOG_CELL_LOG_CLASSNAME = 'logs-view-log-cell-log'; - var LOG_TABLE_BUTTON_COLUMN_CLASSNAME = 'logs-view-log-table-button-column'; - var LOG_BUTTON_CLASSNAME = 'logs-view-log-button'; - - // We inherit from DivView. - var superClass = DivView; - - /** - * @constructor - */ - function LogsView() { - assertFirstConstructorCall(LogsView); - - // Call superclass's constructor. - superClass.call(this, LogsView.MAIN_BOX_ID); - - var tableDiv = $(LogsView.TABLE_ID); - this.rows = []; - this.populateTable(tableDiv, LOG_FILTER_LIST); - $(LogsView.GLOBAL_SHOW_BUTTON_ID).addEventListener('click', - this.onGlobalChangeVisibleClick_.bind(this, true)); - $(LogsView.GLOBAL_HIDE_BUTTON_ID).addEventListener('click', - this.onGlobalChangeVisibleClick_.bind(this, false)); - $(LogsView.REFRESH_LOGS_BUTTON_ID).addEventListener('click', - this.onLogsRefresh_.bind(this)); - } - - LogsView.TAB_ID = 'tab-handle-logs'; - LogsView.TAB_NAME = 'Logs'; - LogsView.TAB_HASH = '#logs'; - - // IDs for special HTML elements in logs_view.html - LogsView.MAIN_BOX_ID = 'logs-view-tab-content'; - LogsView.TABLE_ID = 'logs-view-log-table'; - LogsView.GLOBAL_SHOW_BUTTON_ID = 'logs-view-global-show-btn'; - LogsView.GLOBAL_HIDE_BUTTON_ID = 'logs-view-global-hide-btn'; - LogsView.REFRESH_LOGS_BUTTON_ID = 'logs-view-refresh-btn'; - - cr.addSingletonGetter(LogsView); - - /** - * Contains log keys we are interested in. - */ - var LOG_FILTER_LIST = [ - { - key: 'syslog', - }, - { - key: 'ui_log', - }, - { - key: 'chrome_system_log', - }, - { - key: 'chrome_log', - } - ]; - - LogsView.prototype = { - // Inherit the superclass's methods. - __proto__: superClass.prototype, - - /** - * Called during View's initialization. Creates the row of a table logs will - * be shown in. Each row has 4 cells. - * - * First cell's content will be set to |logKey|, second will contain a - * button that will be used to show or hide third cell, which will contain - * the filtered log. - * |logKey| also tells us which log we are getting data from. - */ - createTableRow: function(logKey) { - var row = document.createElement('tr'); - - var cells = []; - for (var i = 0; i < 3; i++) { - var rowCell = document.createElement('td'); - cells.push(rowCell); - row.appendChild(rowCell); - } - // Log key cell. - cells[0].className = LOG_CELL_TEXT_CLASSNAME; - cells[0].textContent = logKey; - // Cell log is displayed in. Log content is in div element that is - // initially hidden and empty. - cells[2].className = LOG_CELL_TEXT_CLASSNAME; - var logDiv = document.createElement('div'); - logDiv.textContent = ''; - logDiv.className = LOG_CELL_LOG_CLASSNAME; - logDiv.id = 'logs-view.log-cell.' + this.rows.length; - cells[2].appendChild(logDiv); - - // Button that we use to show or hide div element with log content. Logs - // are not visible initially, so we initialize button accordingly. - var expandButton = document.createElement('button'); - expandButton.textContent = 'Show...'; - expandButton.className = LOG_BUTTON_CLASSNAME; - expandButton.addEventListener('click', - this.onButtonClicked_.bind(this, row)); - - // Cell that contains show/hide button. - cells[1].appendChild(expandButton); - cells[1].className = LOG_TABLE_BUTTON_COLUMN_CLASSNAME; - - // Initially, log is not visible. - row.className = LOG_ROW_COLLAPSED_CLASSNAME; - - // We will need those to process row buttons' onclick events. - row.logKey = logKey; - row.expandButton = expandButton; - row.logDiv = logDiv; - row.logVisible = false; - this.rows.push(row); - - return row; - }, - - /** - * Initializes |tableDiv| to represent data from |logList| which should be - * of type LOG_FILTER_LIST. - */ - populateTable: function(tableDiv, logList) { - for (var i = 0; i < logList.length; i++) { - var logSource = this.createTableRow(logList[i].key); - tableDiv.appendChild(logSource); - } - }, - - /** - * Processes clicks on buttons that show or hide log contents in log row. - * Row containing the clicked button is given to the method since it - * contains all data we need to process the click (unlike button object - * itself). - */ - onButtonClicked_: function(containingRow) { - if (!containingRow.logVisible) { - containingRow.className = LOG_ROW_EXPANDED_CLASSNAME; - containingRow.expandButton.textContent = 'Hide...'; - var logDiv = containingRow.logDiv; - if (logDiv.textContent == '') { - logDiv.textContent = 'Getting logs...'; - // Callback will be executed by g_browser. - g_browser.getSystemLog(containingRow.logKey, - containingRow.logDiv.id); - } - } else { - containingRow.className = LOG_ROW_COLLAPSED_CLASSNAME; - containingRow.expandButton.textContent = 'Show...'; - } - containingRow.logVisible = !containingRow.logVisible; - }, - - /** - * Processes click on one of the buttons that are used to show or hide all - * logs we care about. - */ - onGlobalChangeVisibleClick_: function(isShowAll) { - for (var row in this.rows) { - if (isShowAll != this.rows[row].logVisible) { - this.onButtonClicked_(this.rows[row]); - } - } - }, - - /** - * Processes click event on the button we use to refresh fetched logs. We - * get the newest logs from libcros, and refresh content of the visible log - * cells. - */ - onLogsRefresh_: function() { - g_browser.refreshSystemLogs(); - - var visibleLogRows = []; - var hiddenLogRows = []; - for (var row in this.rows) { - if (this.rows[row].logVisible) { - visibleLogRows.push(this.rows[row]); - } else { - hiddenLogRows.push(this.rows[row]); - } - } - - // We have to refresh text content in visible rows. - for (row in visibleLogRows) { - visibleLogRows[row].logDiv.textContent = 'Getting logs...'; - g_browser.getSystemLog(visibleLogRows[row].logKey, - visibleLogRows[row].logDiv.id); - } - - // In hidden rows we just clear potential log text, so we know we have to - // get new contents when we show the row next time. - for (row in hiddenLogRows) { - hiddenLogRows[row].logDiv.textContent = ''; - } - } - }; - - return LogsView; -})(); diff --git a/chromium/chrome/browser/resources/net_internals/main.css b/chromium/chrome/browser/resources/net_internals/main.css index 822e40f957b..5f80612a418 100644 --- a/chromium/chrome/browser/resources/net_internals/main.css +++ b/chromium/chrome/browser/resources/net_internals/main.css @@ -13,8 +13,10 @@ ul { padding-left: 2em; } -/* This class is used to create the splitter widget in - ResizbleVerticalSplitView */ +/** + * This class is used to create the splitter widget in + * ResizbleVerticalSplitView. + */ .vertical-splitter { -webkit-user-select: none; border-left: 1px solid #afafaf; @@ -32,16 +34,11 @@ ul { margin: 5px; } -.log-source-entry * p { - font-size: 75%; - font-weight: bold; +pre { + font-size: 133%; } -.log-source-entry * td { - font-size: 62%; -} - -/* +/** * This class should be given to top-level content boxes (like the view's main * DIV). It gives them a consistent padding, and makes them scrollable. */ @@ -60,7 +57,7 @@ ul { margin-left: -10px; } -/* +/** * Styles for TABLE that uses a thin collapsed border. */ table.styled-table { @@ -112,7 +109,6 @@ table.styled-table, .mouse-over-help { background: #EEE; border: 1px solid black; - font-size: 80%; padding: 5px; z-index: 1; } diff --git a/chromium/chrome/browser/resources/net_internals/main.js b/chromium/chrome/browser/resources/net_internals/main.js index 05e9e7b9bac..7c5d6551b5f 100644 --- a/chromium/chrome/browser/resources/net_internals/main.js +++ b/chromium/chrome/browser/resources/net_internals/main.js @@ -12,7 +12,6 @@ var EventTypeNames = null; var EventPhase = null; var EventSourceType = null; var EventSourceTypeNames = null; -var LogLevelType = null; var ClientInfo = null; var NetError = null; var QuicError = null; @@ -21,6 +20,8 @@ var LoadFlag = null; var CertStatusFlag = null; var LoadState = null; var AddressFamily = null; +var SdchProblemCode = null; +var DataReductionProxyBypassEventType = null; /** * Dictionary of all constants, used for saving log files. @@ -192,20 +193,15 @@ var MainView = (function() { addTab(SocketsView); addTab(SpdyView); addTab(QuicView); + addTab(SdchView); addTab(HttpCacheView); addTab(ModulesView); - addTab(TestView); - addTab(CrosLogVisualizerView); addTab(HSTSView); - addTab(LogsView); addTab(BandwidthView); addTab(PrerenderView); addTab(CrosView); - this.tabSwitcher_.showMenuItem(LogsView.TAB_ID, cr.isChromeOS); this.tabSwitcher_.showMenuItem(CrosView.TAB_ID, cr.isChromeOS); - this.tabSwitcher_.showMenuItem(CrosLogVisualizerView.TAB_ID, - cr.isChromeOS); }, /** @@ -303,7 +299,6 @@ ConstantsObserver.prototype.onReceivedConstants = function(receivedConstants) { EventPhase = Constants.logEventPhase; EventSourceType = Constants.logSourceType; EventSourceTypeNames = makeInverseMap(EventSourceType); - LogLevelType = Constants.logLevelType; ClientInfo = Constants.clientInfo; LoadFlag = Constants.loadFlag; NetError = Constants.netError; @@ -311,6 +306,11 @@ ConstantsObserver.prototype.onReceivedConstants = function(receivedConstants) { QuicRstStreamError = Constants.quicRstStreamError; AddressFamily = Constants.addressFamily; LoadState = Constants.loadState; + SdchProblemCode = Constants.sdchProblemCode; + DataReductionProxyBypassEventType = + Constants.dataReductionProxyBypassEventType; + DataReductionProxyBypassActionType = + Constants.dataReductionProxyBypassActionType; // certStatusFlag may not be present when loading old log Files if (typeof(Constants.certStatusFlag) == 'object') CertStatusFlag = Constants.certStatusFlag; @@ -331,7 +331,6 @@ function areValidConstants(receivedConstants) { typeof(receivedConstants.clientInfo) == 'object' && typeof(receivedConstants.logEventPhase) == 'object' && typeof(receivedConstants.logSourceType) == 'object' && - typeof(receivedConstants.logLevelType) == 'object' && typeof(receivedConstants.loadFlag) == 'object' && typeof(receivedConstants.netError) == 'object' && typeof(receivedConstants.addressFamily) == 'object' && @@ -386,3 +385,15 @@ function addressFamilyToString(family) { // Strip that prefix since it is redundant and only clutters the output. return str.replace(/^ADDRESS_FAMILY_/, ''); } + +/** + * Returns the name for sdchProblemCode. + * + * Example: sdchProblemCodeToString(5) should return + * "DECODE_BODY_ERROR". + * @param {number} sdchProblemCode The SDCH problem code. + * @return {string} The name of the given problem code. + */ +function sdchProblemCodeToString(sdchProblemCode) { + return getKeyWithValue(SdchProblemCode, sdchProblemCode); +} diff --git a/chromium/chrome/browser/resources/net_internals/quic_view.html b/chromium/chrome/browser/resources/net_internals/quic_view.html index f4d5d4fa505..d90ebee15ee 100644 --- a/chromium/chrome/browser/resources/net_internals/quic_view.html +++ b/chromium/chrome/browser/resources/net_internals/quic_view.html @@ -1,7 +1,12 @@ <div id=quic-view-tab-content class=content-box> <ul style='margin-top:0'> <li>QUIC Enabled: <span jscontent="!!quic_enabled"></span></li> - <li>Alternate Protocol Probability Threshold: <span jscontent="alternate_protocol_probability_threshold"></span></li> + <!-- "alternative_service_probability_threshold" is used since release 44, + see https://crrev.com/1091283007. + "alternate_protocol_probability_threshold" is here to support importing + netlog json files from earlier browsers. + TODO(bnc): Deprecate around 2016 January. --!> + <li>Alternative Service Probability Threshold: <span jscontent="$this.alternative_service_probability_threshold || $this.alternate_protocol_probability_threshold"></span></li> <li>Origin To Force QUIC On: <span jscontent="origin_to_force_quic_on"></span></li> <li>QUIC connection options: <span jscontent="connection_options"></span></li> <li>Consistent Port Selection Enabled: <span jscontent="!!enable_quic_port_selection"></span></li> diff --git a/chromium/chrome/browser/resources/net_internals/sdch_view.html b/chromium/chrome/browser/resources/net_internals/sdch_view.html new file mode 100644 index 00000000000..2cbfca5292a --- /dev/null +++ b/chromium/chrome/browser/resources/net_internals/sdch_view.html @@ -0,0 +1,73 @@ +<div id=sdch-view-tab-content class=content-box> + <ul style="margin-top:0"> + <li>SDCH Enabled: + <span jscontent="!!sdch_enabled" id=sdch-view-sdch-enabled></span> + </li> + <li>Secure Scheme Support Enabled: + <span jscontent="!!secure_scheme_support" + id=sdch-view-secure-scheme-support></span> + </li> + </ul> + + <p>SDCH Errors: + <a href="#events&q=type:URL_REQUEST%20SDCH_DECODING_ERROR" + style="padding-right:2em">Decoding</a> + <a href="#events&q=type:URL_REQUEST%20SDCH_DICTIONARY_ERROR">Dictionary</a> + </p> + + <p> + <a href="#events&q=type:URL_REQUEST%20SDCH_DICTIONARY_FETCH"> + SDCH Dictionary Fetches + </a> + </p> + + <p> + <a href="#events&q=type:URL_REQUEST%20Avail-Dictionary"> + SDCH Requests + </a> + </p> + + <h4> + Dictionaries loaded: <span jscontent="dictionaries.length"></span> + </h4> + <table class="styled-table"> + <thead> + <tr> + <th>Domain</th> + <th>Path</th> + <th>Ports</th> + <th>Server Hash</th> + <th>Client Hash</th> + <th>Url</th> + </tr> + </thead> + <tbody id=sdch-view-dictionaries-body> + <tr jsselect="dictionaries"> + <td jscontent="domain"></td> + <td jscontent="path"></td> + <td jscontent="$this.ports ? $this.ports.join(', ') : ''"></td> + <td jscontent="server_hash"></td> + <td jscontent="client_hash"></td> + <td jscontent="url"></td> + </tr> + </tbody> + </table> + + <h4>Blacklisted domains</h4> + <table class="styled-table"> + <thead> + <tr> + <th>Domain</th> + <th>Reason</th> + <th>Tries to back off</th> + </tr> + </thead> + <tbody id=sdch-view-blacklist-body> + <tr jsselect="blacklisted"> + <td jscontent="domain"></td> + <td jscontent="sdchProblemCodeToString(reason)"></td> + <td jscontent="tries"></td> + </tr> + </tbody> + </table> +</div> diff --git a/chromium/chrome/browser/resources/net_internals/sdch_view.js b/chromium/chrome/browser/resources/net_internals/sdch_view.js new file mode 100644 index 00000000000..f42ec4609dd --- /dev/null +++ b/chromium/chrome/browser/resources/net_internals/sdch_view.js @@ -0,0 +1,60 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * This view displays information related to SDCH. + * + * Shows loaded dictionaries, blacklisted domains and SDCH errors. + */ +var SdchView = (function() { + 'use strict'; + + // We inherit from DivView. + var superClass = DivView; + + /** + * @constructor + */ + function SdchView() { + assertFirstConstructorCall(SdchView); + + // Call superclass's constructor. + superClass.call(this, SdchView.MAIN_BOX_ID); + + // Register to receive changes to the SDCH info. + g_browser.addSdchInfoObserver(this, false); + } + + SdchView.TAB_ID = 'tab-handle-sdch'; + SdchView.TAB_NAME = 'SDCH'; + SdchView.TAB_HASH = '#sdch'; + + // IDs for special HTML elements in sdch_view.html + SdchView.MAIN_BOX_ID = 'sdch-view-tab-content'; + SdchView.SDCH_ENABLED_SPAN_ID = 'sdch-view-sdch-enabled'; + SdchView.SECURE_SCHEME_SUPPORT_SPAN_ID = 'sdch-view-secure-scheme-support'; + SdchView.BLACKLIST_TBODY_ID = 'sdch-view-blacklist-body'; + SdchView.DICTIONARIES_TBODY_ID = 'sdch-view-dictionaries-body'; + + cr.addSingletonGetter(SdchView); + + SdchView.prototype = { + // Inherit the superclass's methods. + __proto__: superClass.prototype, + + onLoadLogFinish: function(data) { + return this.onSdchInfoChanged(data.sdchInfo); + }, + + onSdchInfoChanged: function(sdchInfo) { + if (!sdchInfo || typeof(sdchInfo.sdch_enabled) === 'undefined') + return false; + var input = new JsEvalContext(sdchInfo); + jstProcess(input, $(SdchView.MAIN_BOX_ID)); + return true; + }, + }; + + return SdchView; +})(); diff --git a/chromium/chrome/browser/resources/net_internals/sockets_view.html b/chromium/chrome/browser/resources/net_internals/sockets_view.html index b7ffce26839..ce448d3aece 100644 --- a/chromium/chrome/browser/resources/net_internals/sockets_view.html +++ b/chromium/chrome/browser/resources/net_internals/sockets_view.html @@ -1,3 +1,10 @@ +<style> +#sockets-view-close-idle-button, +#sockets-view-flush-button { + margin-bottom: 2px; +} +</style> + <div id=sockets-view-tab-content class=content-box> <ul style='margin-top:0'> <li class="hide-when-not-capturing"> diff --git a/chromium/chrome/browser/resources/net_internals/source_entry.js b/chromium/chrome/browser/resources/net_internals/source_entry.js index fafd4e3dd52..bf4259d7049 100644 --- a/chromium/chrome/browser/resources/net_internals/source_entry.js +++ b/chromium/chrome/browser/resources/net_internals/source_entry.js @@ -79,6 +79,7 @@ var SourceEntry = (function() { switch (e.source.type) { case EventSourceType.URL_REQUEST: + // TODO(ricea): Remove SOCKET_STREAM after M41 is released. case EventSourceType.SOCKET_STREAM: case EventSourceType.HTTP_STREAM_JOB: case EventSourceType.ASYNC_REVALIDATION: @@ -87,7 +88,6 @@ var SourceEntry = (function() { case EventSourceType.CONNECT_JOB: this.description_ = e.params.group_name; break; - case EventSourceType.HOST_RESOLVER_IMPL_REQUEST: case EventSourceType.HOST_RESOLVER_IMPL_JOB: case EventSourceType.HOST_RESOLVER_IMPL_PROC_TASK: this.description_ = e.params.host; @@ -100,7 +100,7 @@ var SourceEntry = (function() { if (e.params.host != undefined) this.description_ = e.params.host; break; - case EventSourceType.SPDY_SESSION: + case EventSourceType.HTTP2_SESSION: if (e.params.host) this.description_ = e.params.host + ' (' + e.params.proxy + ')'; break; @@ -181,8 +181,8 @@ var SourceEntry = (function() { /** * Returns the starting entry for this source. Conceptually this is the * first entry that was logged to this source. However, we skip over the - * TYPE_REQUEST_ALIVE entries which wrap TYPE_URL_REQUEST_START_JOB / - * TYPE_SOCKET_STREAM_CONNECT. + * TYPE_REQUEST_ALIVE entries which wrap TYPE_URL_REQUEST_START_JOB + * entries. */ getStartEntry_: function() { if (this.entries_.length < 1) diff --git a/chromium/chrome/browser/resources/net_internals/spdy_view.html b/chromium/chrome/browser/resources/net_internals/spdy_view.html index 6ff166911a7..4168785648a 100644 --- a/chromium/chrome/browser/resources/net_internals/spdy_view.html +++ b/chromium/chrome/browser/resources/net_internals/spdy_view.html @@ -1,18 +1,16 @@ <div id=spdy-view-tab-content class=content-box> <ul id=spdy-view-status style='margin-top:0'> - <li>SPDY Enabled: <span jscontent="spdy_enabled"></span></li> - <li>Use Alternate Protocol: <span jscontent="use_alternate_protocols"></span></li> - <li>Force SPDY Always: <span jscontent="force_spdy_always"></span></li> - <li>Force SPDY Over SSL: <span jscontent="force_spdy_over_ssl"></span></li> + <li>HTTP/2 Enabled: <span jscontent="spdy_enabled"></span></li> + <li>Use Alternative Service: <span jscontent="use_alternate_protocols"></span></li> <li>Next Protocols: <span jscontent="next_protos"></span></li> </ul> - <h4>SPDY sessions</h4> + <h4>HTTP/2 sessions</h4> <div id=spdy-view-session-info> <!-- Only one of these two are shown --> <div jsdisplay="spdySessionInfo.length == 0">None</div> <div jsdisplay="spdySessionInfo.length != 0"> - <a href="#events&q=type:SPDY_SESSION%20is:active">View live SPDY sessions</a> + <a href="#events&q=type:HTTP2_SESSION%20is:active">View live HTTP/2 sessions</a> <p> <table class="styled-table"> <thead> @@ -68,7 +66,7 @@ </div> </div> - <h4>Alternate Protocol Mappings</h4> + <h4>Alternative Service Mappings</h4> <div id=spdy-view-alternate-protocol-mappings> <div jsdisplay="spdyAlternateProtocolMappings.length == 0">None</div> <div jsdisplay="spdyAlternateProtocolMappings.length != 0"> @@ -76,13 +74,17 @@ <thead> <tr> <th>Host</th> - <th>Alternate Protocol</th> + <th>Alternative Service</th> </tr> </thead> <tbody> <tr jsselect="spdyAlternateProtocolMappings"> <td jscontent="host_port_pair"></td> - <td jscontent="alternate_protocol"></td> + <!-- "alternative_service" is used since release 43, see + https://crrev.com/1043973002. "alternate_protocol" is here + to support importing netlog json files from earlier browsers. + TODO(bnc): Deprecate around 2015 October. --> + <td jscontent="$this.alternative_service || $this.alternate_protocol"></td> </tr> </tbody> </table> diff --git a/chromium/chrome/browser/resources/net_internals/spdy_view.js b/chromium/chrome/browser/resources/net_internals/spdy_view.js index b997122eaa5..e7146807e29 100644 --- a/chromium/chrome/browser/resources/net_internals/spdy_view.js +++ b/chromium/chrome/browser/resources/net_internals/spdy_view.js @@ -27,8 +27,8 @@ var SpdyView = (function() { } SpdyView.TAB_ID = 'tab-handle-spdy'; - SpdyView.TAB_NAME = 'SPDY'; - SpdyView.TAB_HASH = '#spdy'; + SpdyView.TAB_NAME = 'HTTP/2'; + SpdyView.TAB_HASH = '#http2'; // IDs for special HTML elements in spdy_view.html SpdyView.MAIN_BOX_ID = 'spdy-view-tab-content'; diff --git a/chromium/chrome/browser/resources/net_internals/status_view.css b/chromium/chrome/browser/resources/net_internals/status_view.css index 8e7e76ae1a0..b9efa8e4037 100644 --- a/chromium/chrome/browser/resources/net_internals/status_view.css +++ b/chromium/chrome/browser/resources/net_internals/status_view.css @@ -5,6 +5,7 @@ .capture-status-view { background: rgb(238, 0, 0); + font-size: 133%; } .halted-status-view { diff --git a/chromium/chrome/browser/resources/net_internals/test_view.html b/chromium/chrome/browser/resources/net_internals/test_view.html deleted file mode 100644 index 9f1839c7b16..00000000000 --- a/chromium/chrome/browser/resources/net_internals/test_view.html +++ /dev/null @@ -1,13 +0,0 @@ -<!-- Connection tests --> -<div id="test-view-tab-content" class="content-box"> - <div style='margin-bottom: 20px'> - Input a URL which failed to load, and then click the button to run some - tests for why it failed. - </div> - <form id="test-view-connection-tests-form"> - <label>URL: <input id="test-view-url-input" type="text"></label> - <input id="test-view-connection-tests-submit" type="submit" - value="Start tests"> - </form> - <div id="test-view-summary"></div> -</div> diff --git a/chromium/chrome/browser/resources/net_internals/test_view.js b/chromium/chrome/browser/resources/net_internals/test_view.js deleted file mode 100644 index a902bd0c2fa..00000000000 --- a/chromium/chrome/browser/resources/net_internals/test_view.js +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * This view displays the progress and results from the "connection tester". - * - * - Has an input box to specify the URL. - * - Has a button to start running the tests. - * - Shows the set of experiments that have been run so far, and their - * result. - */ -var TestView = (function() { - 'use strict'; - - // We inherit from DivView. - var superClass = DivView; - - /** - * @constructor - */ - function TestView() { - assertFirstConstructorCall(TestView); - - // Call superclass's constructor. - superClass.call(this, TestView.MAIN_BOX_ID); - - this.urlInput_ = $(TestView.URL_INPUT_ID); - this.summaryDiv_ = $(TestView.SUMMARY_DIV_ID); - - var form = $(TestView.FORM_ID); - form.addEventListener('submit', this.onSubmitForm_.bind(this), false); - - // Register to test information as it's received. - g_browser.addConnectionTestsObserver(this); - } - - TestView.TAB_ID = 'tab-handle-tests'; - TestView.TAB_NAME = 'Tests'; - TestView.TAB_HASH = '#tests'; - - // IDs for special HTML elements in test_view.html - TestView.MAIN_BOX_ID = 'test-view-tab-content'; - TestView.FORM_ID = 'test-view-connection-tests-form'; - TestView.URL_INPUT_ID = 'test-view-url-input'; - TestView.SUMMARY_DIV_ID = 'test-view-summary'; - // Needed by tests. - TestView.SUBMIT_BUTTON_ID = 'test-view-connection-tests-submit'; - - - cr.addSingletonGetter(TestView); - - TestView.prototype = { - // Inherit the superclass's methods. - __proto__: superClass.prototype, - - onSubmitForm_: function(event) { - g_browser.sendStartConnectionTests(this.urlInput_.value); - event.preventDefault(); - }, - - /** - * Callback for when the connection tests have begun. - */ - onStartedConnectionTestSuite: function() { - this.summaryDiv_.innerHTML = ''; - - var p = addNode(this.summaryDiv_, 'p'); - addTextNode(p, 'Started connection test suite suite on '); - timeutil.addNodeWithDate(p, new Date()); - - // Add a table that will hold the individual test results. - var table = addNode(this.summaryDiv_, 'table'); - table.className = 'styled-table'; - var thead = addNode(table, 'thead'); - thead.innerHTML = '<tr><th>Result</th><th>Experiment</th>' + - '<th>Error</th><th>Time (ms)</th></tr>'; - - this.tbody_ = addNode(table, 'tbody'); - }, - - /** - * Callback for when an individual test in the suite has begun. - */ - onStartedConnectionTestExperiment: function(experiment) { - var tr = addNode(this.tbody_, 'tr'); - - var passFailCell = addNode(tr, 'td'); - - var experimentCell = addNode(tr, 'td'); - - var resultCell = addNode(tr, 'td'); - addTextNode(resultCell, '?'); - - var dtCell = addNode(tr, 'td'); - addTextNode(dtCell, '?'); - - // We will fill in result cells with actual values (to replace the - // placeholder '?') once the test has completed. For now we just - // save references to these cells. - this.currentExperimentRow_ = { - experimentCell: experimentCell, - dtCell: dtCell, - resultCell: resultCell, - passFailCell: passFailCell, - startTime: timeutil.getCurrentTime() - }; - - addTextNode(experimentCell, 'Fetch ' + experiment.url); - - if (experiment.proxy_settings_experiment || - experiment.host_resolver_experiment) { - var ul = addNode(experimentCell, 'ul'); - - if (experiment.proxy_settings_experiment) { - var li = addNode(ul, 'li'); - addTextNode(li, experiment.proxy_settings_experiment); - } - - if (experiment.host_resolver_experiment) { - var li = addNode(ul, 'li'); - addTextNode(li, experiment.host_resolver_experiment); - } - } - }, - - /** - * Callback for when an individual test in the suite has finished. - */ - onCompletedConnectionTestExperiment: function(experiment, result) { - var r = this.currentExperimentRow_; - - var endTime = timeutil.getCurrentTime(); - - r.dtCell.innerHTML = ''; - addTextNode(r.dtCell, (endTime - r.startTime)); - - r.resultCell.innerHTML = ''; - - if (result == 0) { - r.passFailCell.style.color = 'green'; - addTextNode(r.passFailCell, 'PASS'); - } else { - addTextNode(r.resultCell, - netErrorToString(result) + ' (' + result + ')'); - r.passFailCell.style.color = '#e00'; - addTextNode(r.passFailCell, 'FAIL'); - } - - this.currentExperimentRow_ = null; - }, - - /** - * Callback for when the last test in the suite has finished. - */ - onCompletedConnectionTestSuite: function() { - var p = addNode(this.summaryDiv_, 'p'); - addTextNode(p, 'Completed connection test suite suite'); - } - }; - - return TestView; -})(); diff --git a/chromium/chrome/browser/resources/net_internals/timeline_view.css b/chromium/chrome/browser/resources/net_internals/timeline_view.css index 565117a5db7..5ce199452f1 100644 --- a/chromium/chrome/browser/resources/net_internals/timeline_view.css +++ b/chromium/chrome/browser/resources/net_internals/timeline_view.css @@ -51,10 +51,6 @@ color: black; } -#timeline-view-dns-requests { - color: rgb(102, 187, 187); -} - #timeline-view-dns-jobs { color: rgb(150, 20, 29); } diff --git a/chromium/chrome/browser/resources/net_internals/timeline_view.html b/chromium/chrome/browser/resources/net_internals/timeline_view.html index 10ada2206f0..797f4900f1b 100644 --- a/chromium/chrome/browser/resources/net_internals/timeline_view.html +++ b/chromium/chrome/browser/resources/net_internals/timeline_view.html @@ -14,9 +14,6 @@ <li id=timeline-view-url-requests><label><input type=checkbox checked> █ <span class=timeline-view-text>URL requests</span></label> </li> - <li id=timeline-view-dns-requests><label><input type=checkbox checked> - █ <span class=timeline-view-text>DNS requests</span></label> - </li> <li id=timeline-view-dns-jobs><label><input type=checkbox checked> █ <span class=timeline-view-text>DNS jobs</span></label> </li> diff --git a/chromium/chrome/browser/resources/net_internals/timeline_view.js b/chromium/chrome/browser/resources/net_internals/timeline_view.js index c4183d34a4c..083000bc00b 100644 --- a/chromium/chrome/browser/resources/net_internals/timeline_view.js +++ b/chromium/chrome/browser/resources/net_internals/timeline_view.js @@ -71,7 +71,6 @@ var TimelineView = (function() { TimelineView.OPEN_SOCKETS_ID = 'timeline-view-open-sockets'; TimelineView.IN_USE_SOCKETS_ID = 'timeline-view-in-use-sockets'; TimelineView.URL_REQUESTS_ID = 'timeline-view-url-requests'; - TimelineView.DNS_REQUESTS_ID = 'timeline-view-dns-requests'; TimelineView.DNS_JOBS_ID = 'timeline-view-dns-jobs'; TimelineView.BYTES_RECEIVED_ID = 'timeline-view-bytes-received'; TimelineView.BYTES_SENT_ID = 'timeline-view-bytes-sent'; @@ -205,11 +204,6 @@ var TimelineView = (function() { TimelineView.URL_REQUESTS_ID); this.addDataSeries_(new SourceCountDataSeries( - EventSourceType.HOST_RESOLVER_IMPL_REQUEST, - EventType.HOST_RESOLVER_IMPL_REQUEST), - TimelineView.DNS_REQUESTS_ID); - - this.addDataSeries_(new SourceCountDataSeries( EventSourceType.HOST_RESOLVER_IMPL_JOB, EventType.HOST_RESOLVER_IMPL_JOB), TimelineView.DNS_JOBS_ID); diff --git a/chromium/chrome/browser/resources/net_internals/waterfall_row.js b/chromium/chrome/browser/resources/net_internals/waterfall_row.js index ee922cb6f50..6e6abe511bf 100644 --- a/chromium/chrome/browser/resources/net_internals/waterfall_row.js +++ b/chromium/chrome/browser/resources/net_internals/waterfall_row.js @@ -252,19 +252,14 @@ var WaterfallRow = (function() { for (var i = 0; i < httpStreamJobSources.length; ++i) { // Two levels down from URL Requests. - var hostResolverImplSources = findDependenciesOfType_( - httpStreamJobSources[i], EventType.HOST_RESOLVER_IMPL); - var socketSources = findDependenciesOfType_( httpStreamJobSources[i], EventType.SOCKET_POOL_BOUND_TO_SOCKET); - // Three levels down from URL Requests. - // TODO(mmenke): Some of these may be nested in the PROXY_SERVICE // event, resulting in incorrect display, since nested // events aren't handled. - var hostResolverImplRequestPairs = findEntryPairsFromSourceEntries_( - hostResolverImplSources, EventType.HOST_RESOLVER_IMPL_REQUEST); + var hostResolverImplRequestPairs = findEntryPairsByType_( + httpStreamJobSources[i], EventType.HOST_RESOLVER_IMPL_REQUEST); eventPairs = eventPairs.concat(hostResolverImplRequestPairs); // Truncate times of connection events such that they don't occur before @@ -310,7 +305,7 @@ var WaterfallRow = (function() { return a.startEntry.time - b.startEntry.time; }); return eventPairs; - } + }; function eventTypeToCssClass_(eventType) { return eventType.toLowerCase().replace(/_/g, '-'); |