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

Unified Diff: chrome/browser/resources/net_internals/mobile_view.js

Issue 11635023: First cut at UI for saving net_logs data into a temporary file on (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/net_internals/mobile_view.js
===================================================================
--- chrome/browser/resources/net_internals/mobile_view.js (revision 0)
+++ chrome/browser/resources/net_internals/mobile_view.js (revision 0)
@@ -0,0 +1,110 @@
+// 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 options for captured data into a file.
+ */
+var MobileView = (function() {
+ 'use strict';
+
+ // We inherit from DivView.
+ var superClass = DivView;
+
+ /**
+ * @constructor
+ */
+ function MobileView() {
+ assertFirstConstructorCall(MobileView);
+
+ // Call superclass's constructor.
+ superClass.call(this, MobileView.MAIN_BOX_ID);
+
+ g_browser.addMobileNetLogInfoObserver(this, true);
+
+ this.startDataButton_ = $(MobileView.START_DATA_BUTTON_ID);
+ this.startDataButton_.onclick = this.onStartData_.bind(this);
+ this.stopDataButton_ = $(MobileView.STOP_DATA_BUTTON_ID);
+ this.stopDataButton_.onclick = this.onStopData_.bind(this);
+ this.sendDataButton_ = $(MobileView.SEND_DATA_BUTTON_ID);
+ this.sendDataButton_.onclick = this.onSendData_.bind(this);
+ this.filePathText_ = $(MobileView.FILE_PATH_TEXT_ID);
+ }
+
+ // ID for special HTML element in category_tabs.html
+ MobileView.TAB_HANDLE_ID = 'tab-handle-mobile';
+
+ // IDs for special HTML elements in mobile_view.html
+ MobileView.MAIN_BOX_ID = 'mobile-view-tab-content';
+ MobileView.START_DATA_BUTTON_ID = 'mobile-view-start-data';
+ MobileView.STOP_DATA_BUTTON_ID = 'mobile-view-stop-data';
+ MobileView.SEND_DATA_BUTTON_ID = 'mobile-view-send-data';
+ MobileView.FILE_PATH_TEXT_ID = 'mobile-view-file-path-text';
+
+ cr.addSingletonGetter(MobileView);
+
+ MobileView.prototype = {
+ // Inherit the superclass's methods.
+ __proto__: superClass.prototype,
+
+ onLoadLogFinish: function(data) {
+ return cr.isMobile &&
+ this.onMobileNetLogInfoChanged(data.mobileNetLogInfo);
+ },
+
+ /**
+ * Starts saving NetLog data to a file.
+ */
+ onStartData_: function() {
+ g_browser.sendStartNetLog();
+ g_browser.checkForUpdatedInfo(false);
+ },
+
+ /**
+ * Stops saving NetLog data to a file.
+ */
+ onStopData_: function() {
+ g_browser.sendStopNetLog();
+ g_browser.checkForUpdatedInfo(false);
+ },
+
+ /**
+ * Sends NetLog data via email from browser.
+ */
+ onSendData_: function() {
+ g_browser.sendSendNetLog();
+ g_browser.checkForUpdatedInfo(false);
+ },
+
+ onMobileNetLogInfoChanged: function(mobileNetLogInfo) {
+ this.filePathText_.textContent = '';
+ if (mobileNetLogInfo.file != '') {
+ var message = '';
+ if (mobileNetLogInfo.state == 'STOP') {
+ message = 'NetLog data is collected in: ';
+ } else if (mobileNetLogInfo.state == 'START_SEND') {
+ message = 'NetLog data to send is in: ';
+ }
+ this.filePathText_.textContent = message + mobileNetLogInfo.file;
+ } else {
+ this.filePathText_.textContent = '';
+ }
+ this.startDataButton_.disabled = false;
+ this.stopDataButton_.disabled = false;
+ this.sendDataButton_.disabled = false;
+ if (mobileNetLogInfo.state == 'START') {
+ this.stopDataButton_.disabled = true;
+ this.sendDataButton_.disabled = true;
+ } else if (mobileNetLogInfo.state == 'STOP') {
+ this.startDataButton_.disabled = true;
+ this.sendDataButton_.disabled = true;
+ } else if (mobileNetLogInfo.state == 'START_SEND') {
+ this.stopDataButton_.disabled = true;
+ }
+ return true;
+ }
+
+ };
+
+ return MobileView;
+})();

Powered by Google App Engine
This is Rietveld 408576698