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 #include "chrome/browser/net/net_log_temp_file.h" | 5 #include "chrome/browser/net/net_log_temp_file.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/net/chrome_net_log.h" | 9 #include "chrome/browser/net/chrome_net_log.h" |
10 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" | 10 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 FILE* file = base::OpenFile(log_path_, "w"); | 117 FILE* file = base::OpenFile(log_path_, "w"); |
118 if (file == NULL) | 118 if (file == NULL) |
119 return; | 119 return; |
120 | 120 |
121 scoped_ptr<base::Value> constants(NetInternalsUI::GetConstants()); | 121 scoped_ptr<base::Value> constants(NetInternalsUI::GetConstants()); |
122 net_log_logger_.reset(new net::NetLogLogger(file, *constants)); | 122 net_log_logger_.reset(new net::NetLogLogger(file, *constants)); |
123 if (strip_private_data) { | 123 if (strip_private_data) { |
124 net_log_logger_->set_log_level(net::NetLog::LOG_STRIP_PRIVATE_DATA); | 124 net_log_logger_->set_log_level(net::NetLog::LOG_STRIP_PRIVATE_DATA); |
125 log_type_ = LOG_TYPE_STRIP_PRIVATE_DATA; | 125 log_type_ = LOG_TYPE_STRIP_PRIVATE_DATA; |
126 } else { | 126 } else { |
| 127 net_log_logger_->set_log_level(net::NetLog::LOG_ALL_BUT_BYTES); |
127 log_type_ = LOG_TYPE_NORMAL; | 128 log_type_ = LOG_TYPE_NORMAL; |
128 } | 129 } |
129 net_log_logger_->StartObserving(chrome_net_log_); | 130 net_log_logger_->StartObserving(chrome_net_log_); |
130 state_ = STATE_LOGGING; | 131 state_ = STATE_LOGGING; |
131 } | 132 } |
132 | 133 |
133 void NetLogTempFile::StopNetLog() { | 134 void NetLogTempFile::StopNetLog() { |
134 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING)); | 135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING)); |
135 if (state_ != STATE_LOGGING) | 136 if (state_ != STATE_LOGGING) |
136 return; | 137 return; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 bool NetLogTempFile::GetNetExportLogDirectory(base::FilePath* path) { | 173 bool NetLogTempFile::GetNetExportLogDirectory(base::FilePath* path) { |
173 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING)); | 174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING)); |
174 return base::GetTempDir(path); | 175 return base::GetTempDir(path); |
175 } | 176 } |
176 | 177 |
177 bool NetLogTempFile::NetExportLogExists() { | 178 bool NetLogTempFile::NetExportLogExists() { |
178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING)); | 179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING)); |
179 DCHECK(!log_path_.empty()); | 180 DCHECK(!log_path_.empty()); |
180 return base::PathExists(log_path_); | 181 return base::PathExists(log_path_); |
181 } | 182 } |
OLD | NEW |