OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 #endif | 507 #endif |
508 } | 508 } |
509 | 509 |
510 void NetInternalsMessageHandler::SendJavascriptCommand( | 510 void NetInternalsMessageHandler::SendJavascriptCommand( |
511 const std::string& command, | 511 const std::string& command, |
512 base::Value* arg) { | 512 base::Value* arg) { |
513 std::unique_ptr<base::Value> command_value(new base::StringValue(command)); | 513 std::unique_ptr<base::Value> command_value(new base::StringValue(command)); |
514 std::unique_ptr<base::Value> value(arg); | 514 std::unique_ptr<base::Value> value(arg); |
515 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 515 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
516 if (value.get()) { | 516 if (value.get()) { |
517 web_ui()->CallJavascriptFunction("g_browser.receive", | 517 web_ui()->CallJavascriptFunctionUnsafe("g_browser.receive", |
518 *command_value.get(), | 518 *command_value.get(), *value.get()); |
519 *value.get()); | |
520 } else { | 519 } else { |
521 web_ui()->CallJavascriptFunction("g_browser.receive", | 520 web_ui()->CallJavascriptFunctionUnsafe("g_browser.receive", |
522 *command_value.get()); | 521 *command_value.get()); |
523 } | 522 } |
524 } | 523 } |
525 | 524 |
526 void NetInternalsMessageHandler::OnRendererReady(const base::ListValue* list) { | 525 void NetInternalsMessageHandler::OnRendererReady(const base::ListValue* list) { |
527 IOThreadImpl::CallbackHelper(&IOThreadImpl::OnRendererReady, proxy_, list); | 526 IOThreadImpl::CallbackHelper(&IOThreadImpl::OnRendererReady, proxy_, list); |
528 } | 527 } |
529 | 528 |
530 void NetInternalsMessageHandler::OnClearBrowserCache( | 529 void NetInternalsMessageHandler::OnClearBrowserCache( |
531 const base::ListValue* list) { | 530 const base::ListValue* list) { |
532 BrowsingDataRemover* remover = | 531 BrowsingDataRemover* remover = |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 //////////////////////////////////////////////////////////////////////////////// | 1179 //////////////////////////////////////////////////////////////////////////////// |
1181 | 1180 |
1182 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1181 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1183 : WebUIController(web_ui) { | 1182 : WebUIController(web_ui) { |
1184 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1183 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1185 | 1184 |
1186 // Set up the chrome://net-internals/ source. | 1185 // Set up the chrome://net-internals/ source. |
1187 Profile* profile = Profile::FromWebUI(web_ui); | 1186 Profile* profile = Profile::FromWebUI(web_ui); |
1188 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1187 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1189 } | 1188 } |
OLD | NEW |