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

Side by Side Diff: chrome/browser/ui/webui/net_internals/net_internals_ui.cc

Issue 1059843002: Refactor NetLog::LogLevel --> NetLogCaptureMode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update copyright 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/webui/net_internals/net_internals_ui.h" 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 if (net_log()) { 745 if (net_log()) {
746 net_log()->DeprecatedRemoveObserver(this); 746 net_log()->DeprecatedRemoveObserver(this);
747 PostPendingEntries(); 747 PostPendingEntries();
748 } 748 }
749 749
750 SendJavascriptCommand("receivedConstants", NetInternalsUI::GetConstants()); 750 SendJavascriptCommand("receivedConstants", NetInternalsUI::GetConstants());
751 751
752 PrePopulateEventList(); 752 PrePopulateEventList();
753 753
754 // Register with network stack to observe events. 754 // Register with network stack to observe events.
755 io_thread_->net_log()->DeprecatedAddObserver(this, 755 io_thread_->net_log()->DeprecatedAddObserver(
756 net::NetLog::LOG_ALL_BUT_BYTES); 756 this, net::NetLogCaptureMode::AllButBytes());
757 } 757 }
758 758
759 void NetInternalsMessageHandler::IOThreadImpl::OnGetNetInfo( 759 void NetInternalsMessageHandler::IOThreadImpl::OnGetNetInfo(
760 const base::ListValue* list) { 760 const base::ListValue* list) {
761 DCHECK(list); 761 DCHECK(list);
762 int info_sources; 762 int info_sources;
763 if (!list->GetInteger(0, &info_sources)) 763 if (!list->GetInteger(0, &info_sources))
764 return; 764 return;
765 SendNetInfo(info_sources); 765 SendNetInfo(info_sources);
766 } 766 }
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 void NetInternalsMessageHandler::IOThreadImpl::OnSetLogLevel( 1161 void NetInternalsMessageHandler::IOThreadImpl::OnSetLogLevel(
1162 const base::ListValue* list) { 1162 const base::ListValue* list) {
1163 int log_level; 1163 int log_level;
1164 std::string log_level_string; 1164 std::string log_level_string;
1165 if (!list->GetString(0, &log_level_string) || 1165 if (!list->GetString(0, &log_level_string) ||
1166 !base::StringToInt(log_level_string, &log_level)) { 1166 !base::StringToInt(log_level_string, &log_level)) {
1167 NOTREACHED(); 1167 NOTREACHED();
1168 return; 1168 return;
1169 } 1169 }
1170 1170
1171 DCHECK_GE(log_level, net::NetLog::LOG_ALL); 1171 DCHECK_GE(log_level, net::NetLogCaptureMode::NONE);
1172 DCHECK_LT(log_level, net::NetLog::LOG_NONE); 1172 DCHECK_LE(log_level, net::NetLogCaptureMode::ALL);
1173 net_log()->SetObserverLogLevel( 1173 net_log()->SetObserverCaptureMode(
1174 this, static_cast<net::NetLog::LogLevel>(log_level)); 1174 this, net::NetLogCaptureMode(
1175 static_cast<net::NetLogCaptureMode::Level>(log_level)));
1175 } 1176 }
1176 1177
1177 // Note that unlike other methods of IOThreadImpl, this function 1178 // Note that unlike other methods of IOThreadImpl, this function
1178 // can be called from ANY THREAD. 1179 // can be called from ANY THREAD.
1179 void NetInternalsMessageHandler::IOThreadImpl::OnAddEntry( 1180 void NetInternalsMessageHandler::IOThreadImpl::OnAddEntry(
1180 const net::NetLog::Entry& entry) { 1181 const net::NetLog::Entry& entry) {
1181 BrowserThread::PostTask( 1182 BrowserThread::PostTask(
1182 BrowserThread::IO, FROM_HERE, 1183 BrowserThread::IO, FROM_HERE,
1183 base::Bind(&IOThreadImpl::AddEntryToQueue, this, entry.ToValue())); 1184 base::Bind(&IOThreadImpl::AddEntryToQueue, this, entry.ToValue()));
1184 } 1185 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 } 1323 }
1323 1324
1324 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1325 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1325 : WebUIController(web_ui) { 1326 : WebUIController(web_ui) {
1326 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1327 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1327 1328
1328 // Set up the chrome://net-internals/ source. 1329 // Set up the chrome://net-internals/ source.
1329 Profile* profile = Profile::FromWebUI(web_ui); 1330 Profile* profile = Profile::FromWebUI(web_ui);
1330 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); 1331 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource());
1331 } 1332 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698