OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NET_NET_LOG_TEMP_FILE_H_ | 5 #ifndef CHROME_BROWSER_NET_NET_LOG_TEMP_FILE_H_ |
6 #define CHROME_BROWSER_NET_NET_LOG_TEMP_FILE_H_ | 6 #define CHROME_BROWSER_NET_NET_LOG_TEMP_FILE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // TODO(davidben): This state is kind of silly. | 106 // TODO(davidben): This state is kind of silly. |
107 LOG_TYPE_UNKNOWN, | 107 LOG_TYPE_UNKNOWN, |
108 // The log includes raw bytes. | 108 // The log includes raw bytes. |
109 LOG_TYPE_LOG_BYTES, | 109 LOG_TYPE_LOG_BYTES, |
110 // The file includes all data. | 110 // The file includes all data. |
111 LOG_TYPE_NORMAL, | 111 LOG_TYPE_NORMAL, |
112 // The file has credentials and cookies stripped. | 112 // The file has credentials and cookies stripped. |
113 LOG_TYPE_STRIP_PRIVATE_DATA, | 113 LOG_TYPE_STRIP_PRIVATE_DATA, |
114 }; | 114 }; |
115 | 115 |
116 // Returns the NetLog::LogLevel corresponding to a LogType. | 116 // Returns the NetLog::CaptureMode corresponding to a LogType. |
117 static net::NetLog::LogLevel GetLogLevelForLogType(LogType log_type); | 117 static net::NetLogCaptureMode GetCaptureModeForLogType(LogType log_type); |
118 | 118 |
119 // Initializes the |state_| to STATE_NOT_LOGGING and |log_type_| to | 119 // Initializes the |state_| to STATE_NOT_LOGGING and |log_type_| to |
120 // LOG_TYPE_NONE (if there is no temporary file from earlier run) or | 120 // LOG_TYPE_NONE (if there is no temporary file from earlier run) or |
121 // LOG_TYPE_UNKNOWN (if there is a temporary file from earlier run). Returns | 121 // LOG_TYPE_UNKNOWN (if there is a temporary file from earlier run). Returns |
122 // false if initialization of |log_path_| fails. | 122 // false if initialization of |log_path_| fails. |
123 bool EnsureInit(); | 123 bool EnsureInit(); |
124 | 124 |
125 // Start collecting NetLog data into chrome-net-export-log.json file in | 125 // Start collecting NetLog data into chrome-net-export-log.json file in |
126 // base::GetTempDir() directory, using the specified log level. It is a no-op | 126 // base::GetTempDir() directory, using the specified capture mode. It is a |
127 // if we are already collecting data into a file, and |log_level| is ignored. | 127 // no-op if we are already collecting data into a file, and |capture_mode| is |
| 128 // ignored. |
128 // TODO(mmenke): That's rather weird behavior, think about improving it. | 129 // TODO(mmenke): That's rather weird behavior, think about improving it. |
129 void StartNetLog(LogType log_type); | 130 void StartNetLog(LogType log_type); |
130 | 131 |
131 // Stop collecting NetLog data into the temporary file. It is a no-op if we | 132 // Stop collecting NetLog data into the temporary file. It is a no-op if we |
132 // are not collecting data into a file. | 133 // are not collecting data into a file. |
133 void StopNetLog(); | 134 void StopNetLog(); |
134 | 135 |
135 // Updates |log_path_| with base::FilePath to |log_filename_| in the | 136 // Updates |log_path_| with base::FilePath to |log_filename_| in the |
136 // base::GetTempDir() directory. Returns false if base::GetTempDir() | 137 // base::GetTempDir() directory. Returns false if base::GetTempDir() |
137 // fails. | 138 // fails. |
(...skipping 17 matching lines...) Expand all Loading... |
155 scoped_ptr<net::WriteToFileNetLogObserver> net_log_logger_; | 156 scoped_ptr<net::WriteToFileNetLogObserver> net_log_logger_; |
156 | 157 |
157 // The |chrome_net_log_| is owned by the browser process, cached here to avoid | 158 // The |chrome_net_log_| is owned by the browser process, cached here to avoid |
158 // using global (g_browser_process). | 159 // using global (g_browser_process). |
159 ChromeNetLog* chrome_net_log_; | 160 ChromeNetLog* chrome_net_log_; |
160 | 161 |
161 DISALLOW_COPY_AND_ASSIGN(NetLogTempFile); | 162 DISALLOW_COPY_AND_ASSIGN(NetLogTempFile); |
162 }; | 163 }; |
163 | 164 |
164 #endif // CHROME_BROWSER_NET_NET_LOG_TEMP_FILE_H_ | 165 #endif // CHROME_BROWSER_NET_NET_LOG_TEMP_FILE_H_ |
OLD | NEW |