Home | History | Annotate | Download | only in api
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Use the <code>chrome.webrtcLoggingPrivate</code> API to control diagnostic
      6 // WebRTC logging.
      7 [nodoc] namespace webrtcLoggingPrivate {
      8   dictionary MetaDataEntry {
      9     // The meta data entry key.
     10     DOMString key;
     11 
     12     // The meta data entry value.
     13     DOMString value;
     14   };
     15 
     16   dictionary UploadResult {
     17     // The report ID for the uploaded log. Will be empty if not successful.
     18     DOMString reportId;
     19   };
     20 
     21   callback GenericDoneCallback = void ();
     22   callback UploadDoneCallback = void (UploadResult result);
     23 
     24   interface Functions {
     25     // For all functions, |tabId| determines which render process to apply
     26     // the operation on. |tabId| is the identifier from the chrome.tabs API.
     27     // |securityOrigin| is the security origin for the tab identified by |tabId|
     28     // and is used for verifying that the tab is the correct one and has not
     29     // been navigated away from.
     30 
     31     // Sets additional custom meta data that will be uploaded along with the
     32     // log. |metaData| is a dictionary of the metadata (key, value).
     33     static void setMetaData(long tabId,
     34                             DOMString securityOrigin,
     35                             MetaDataEntry[] metaData,
     36                             GenericDoneCallback callback);
     37 
     38     // Starts logging. If logging has already been started for this render
     39     // process, the call will be ignored. |appSessionId| is the unique session
     40     // ID which will be added to the log.
     41     static void start(long tabId,
     42                       DOMString securityOrigin,
     43                       GenericDoneCallback callback);
     44 
     45     // Sets whether the log should be uploaded automatically for the case when
     46     // the render process goes away (tab is closed or crashes) and stop has not
     47     // been called before that. If |shouldUpload| is true it will be uploaded,
     48     // otherwise it will be discarded. The default setting is to discard it.
     49     static void setUploadOnRenderClose(long tabId,
     50                                        DOMString securityOrigin,
     51                                        boolean shouldUpload);
     52 
     53     // Stops logging. After stop has finished, either upload() or discard()
     54     // should be called, otherwise the log will be kept in memory until the
     55     // render process is closed or logging restarted.
     56     static void stop(long tabId,
     57                      DOMString securityOrigin,
     58                      GenericDoneCallback callback);
     59 
     60     // Uploads the log and the RTP dumps, if they exist. Logging and RTP dumping
     61     // must be stopped before this function is called.
     62     static void upload(long tabId,
     63                        DOMString securityOrigin,
     64                        UploadDoneCallback callback);
     65 
     66     // Discards the log. Logging must be stopped before this function is called.
     67     static void discard(long tabId,
     68                         DOMString securityOrigin,
     69                         GenericDoneCallback callback);
     70 
     71     // Starts RTP dumping. If it has already been started for this render
     72     // process, the call will be ignored.
     73     static void startRtpDump(long tabId,
     74                              DOMString securityOrigin,
     75                              boolean incoming,
     76                              boolean outgoing,
     77                              GenericDoneCallback callback);
     78 
     79     // Stops RTP dumping. After stop has finished, the dumps will be
     80     // uploaded with the log if upload is called. Otherwise, the dumps will be
     81     // discarded.
     82     static void stopRtpDump(long tabId,
     83                             DOMString securityOrigin,
     84                             boolean incoming,
     85                             boolean outgoing,
     86                             GenericDoneCallback callback);
     87   };
     88 };
     89