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

Side by Side Diff: chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc

Issue 1059843002: Refactor NetLog::LogLevel --> NetLogCaptureMode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again to fix a merge conflict Created 5 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/net/chrome_net_log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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/extensions/api/log_private/log_private_api.h" 5 #include "chrome/browser/extensions/api/log_private/log_private_api.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 281 }
282 282
283 void LogPrivateAPI::StartObservingNetEvents( 283 void LogPrivateAPI::StartObservingNetEvents(
284 IOThread* io_thread, 284 IOThread* io_thread,
285 base::ScopedFILE* file) { 285 base::ScopedFILE* file) {
286 DCHECK_CURRENTLY_ON(BrowserThread::IO); 286 DCHECK_CURRENTLY_ON(BrowserThread::IO);
287 if (!file->get()) 287 if (!file->get())
288 return; 288 return;
289 289
290 write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); 290 write_to_file_observer_.reset(new net::WriteToFileNetLogObserver());
291 write_to_file_observer_->set_log_level(net::NetLog::LOG_ALL_BUT_BYTES); 291 write_to_file_observer_->set_capture_mode(
292 net::NetLogCaptureMode::IncludeCookiesAndCredentials());
292 write_to_file_observer_->StartObserving(io_thread->net_log(), file->Pass(), 293 write_to_file_observer_->StartObserving(io_thread->net_log(), file->Pass(),
293 nullptr, nullptr); 294 nullptr, nullptr);
294 } 295 }
295 296
296 void LogPrivateAPI::MaybeStartNetInternalLogging( 297 void LogPrivateAPI::MaybeStartNetInternalLogging(
297 const std::string& caller_extension_id, 298 const std::string& caller_extension_id,
298 IOThread* io_thread, 299 IOThread* io_thread,
299 api::log_private::EventSink event_sink) { 300 api::log_private::EventSink event_sink) {
300 DCHECK_CURRENTLY_ON(BrowserThread::IO); 301 DCHECK_CURRENTLY_ON(BrowserThread::IO);
301 if (!logging_net_internals_) { 302 if (!logging_net_internals_) {
302 logging_net_internals_ = true; 303 logging_net_internals_ = true;
303 event_sink_ = event_sink; 304 event_sink_ = event_sink;
304 switch (event_sink_) { 305 switch (event_sink_) {
305 case api::log_private::EVENT_SINK_CAPTURE: { 306 case api::log_private::EVENT_SINK_CAPTURE: {
306 io_thread->net_log()->DeprecatedAddObserver( 307 io_thread->net_log()->DeprecatedAddObserver(
307 this, net::NetLog::LOG_ALL_BUT_BYTES); 308 this, net::NetLogCaptureMode::IncludeCookiesAndCredentials());
308 break; 309 break;
309 } 310 }
310 case api::log_private::EVENT_SINK_FILE: { 311 case api::log_private::EVENT_SINK_FILE: {
311 base::ScopedFILE* file = new base::ScopedFILE(); 312 base::ScopedFILE* file = new base::ScopedFILE();
312 // Initialize a FILE on the blocking pool and start observing event 313 // Initialize a FILE on the blocking pool and start observing event
313 // on IO thread. 314 // on IO thread.
314 GetSequencedTaskRunner()->PostTaskAndReply( 315 GetSequencedTaskRunner()->PostTaskAndReply(
315 FROM_HERE, 316 FROM_HERE,
316 base::Bind(&LogPrivateAPI::CreateFileForNetLogger, 317 base::Bind(&LogPrivateAPI::CreateFileForNetLogger,
317 base::Unretained(this), 318 base::Unretained(this),
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 entry->SetBoolean("isDirectory", false); 540 entry->SetBoolean("isDirectory", false);
540 base::ListValue* entry_list = new base::ListValue(); 541 base::ListValue* entry_list = new base::ListValue();
541 entry_list->Append(entry); 542 entry_list->Append(entry);
542 response->Set("entries", entry_list); 543 response->Set("entries", entry_list);
543 response->SetBoolean("multiple", false); 544 response->SetBoolean("multiple", false);
544 SetResult(response.release()); 545 SetResult(response.release());
545 SendResponse(succeeded); 546 SendResponse(succeeded);
546 } 547 }
547 548
548 } // namespace extensions 549 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/chrome_net_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698