| OLD | NEW |
| 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/ui/webui/chromeos/network_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/network_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // WebUIMessageHandler implementation. | 33 // WebUIMessageHandler implementation. |
| 34 virtual void RegisterMessages() override { | 34 virtual void RegisterMessages() override { |
| 35 web_ui()->RegisterMessageCallback( | 35 web_ui()->RegisterMessageCallback( |
| 36 "NetworkUI.getNetworkLog", | 36 "NetworkUI.getNetworkLog", |
| 37 base::Bind(&NetworkUIMessageHandler::GetNetworkLog, | 37 base::Bind(&NetworkUIMessageHandler::GetNetworkLog, |
| 38 base::Unretained(this))); | 38 base::Unretained(this))); |
| 39 } | 39 } |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 void GetNetworkLog(const base::ListValue* value) const { | 42 void GetNetworkLog(const base::ListValue* value) const { |
| 43 base::StringValue data(chromeos::network_event_log::GetAsString( | 43 base::StringValue data(chromeos::device_event_log::GetAsString( |
| 44 chromeos::network_event_log::NEWEST_FIRST, | 44 chromeos::device_event_log::NEWEST_FIRST, |
| 45 "json", | 45 "json", |
| 46 chromeos::network_event_log::LOG_LEVEL_DEBUG, | 46 device_event_log::LOG_TYPE_NETWORK, |
| 47 chromeos::device_event_log::LOG_LEVEL_DEBUG, |
| 47 kMaxLogEvents)); | 48 kMaxLogEvents)); |
| 48 web_ui()->CallJavascriptFunction("NetworkUI.getNetworkLogCallback", data); | 49 web_ui()->CallJavascriptFunction("NetworkUI.getNetworkLogCallback", data); |
| 49 } | 50 } |
| 50 | 51 |
| 51 DISALLOW_COPY_AND_ASSIGN(NetworkUIMessageHandler); | 52 DISALLOW_COPY_AND_ASSIGN(NetworkUIMessageHandler); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 } // namespace | 55 } // namespace |
| 55 | 56 |
| 56 NetworkUI::NetworkUI(content::WebUI* web_ui) | 57 NetworkUI::NetworkUI(content::WebUI* web_ui) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 81 html->SetDefaultResource(IDR_NETWORK_UI_HTML); | 82 html->SetDefaultResource(IDR_NETWORK_UI_HTML); |
| 82 | 83 |
| 83 content::WebUIDataSource::Add( | 84 content::WebUIDataSource::Add( |
| 84 web_ui->GetWebContents()->GetBrowserContext(), html); | 85 web_ui->GetWebContents()->GetBrowserContext(), html); |
| 85 } | 86 } |
| 86 | 87 |
| 87 NetworkUI::~NetworkUI() { | 88 NetworkUI::~NetworkUI() { |
| 88 } | 89 } |
| 89 | 90 |
| 90 } // namespace chromeos | 91 } // namespace chromeos |
| OLD | NEW |