| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/device_log_ui.h" | 5 #include "chrome/browser/ui/webui/device_log_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 23 matching lines...) Expand all Loading... |
| 34 web_ui()->RegisterMessageCallback( | 34 web_ui()->RegisterMessageCallback( |
| 35 "DeviceLog.getLog", | 35 "DeviceLog.getLog", |
| 36 base::Bind(&DeviceLogMessageHandler::GetLog, base::Unretained(this))); | 36 base::Bind(&DeviceLogMessageHandler::GetLog, base::Unretained(this))); |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 void GetLog(const base::ListValue* value) const { | 40 void GetLog(const base::ListValue* value) const { |
| 41 base::StringValue data(device_event_log::GetAsString( | 41 base::StringValue data(device_event_log::GetAsString( |
| 42 device_event_log::NEWEST_FIRST, "json", "", | 42 device_event_log::NEWEST_FIRST, "json", "", |
| 43 device_event_log::LOG_LEVEL_DEBUG, 0)); | 43 device_event_log::LOG_LEVEL_DEBUG, 0)); |
| 44 web_ui()->CallJavascriptFunction("DeviceLogUI.getLogCallback", data); | 44 web_ui()->CallJavascriptFunctionUnsafe("DeviceLogUI.getLogCallback", data); |
| 45 } | 45 } |
| 46 | 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(DeviceLogMessageHandler); | 47 DISALLOW_COPY_AND_ASSIGN(DeviceLogMessageHandler); |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 DeviceLogUI::DeviceLogUI(content::WebUI* web_ui) | 52 DeviceLogUI::DeviceLogUI(content::WebUI* web_ui) |
| 53 : content::WebUIController(web_ui) { | 53 : content::WebUIController(web_ui) { |
| 54 web_ui->AddMessageHandler(new DeviceLogMessageHandler()); | 54 web_ui->AddMessageHandler(new DeviceLogMessageHandler()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 84 html->SetDefaultResource(IDR_DEVICE_LOG_UI_HTML); | 84 html->SetDefaultResource(IDR_DEVICE_LOG_UI_HTML); |
| 85 | 85 |
| 86 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), | 86 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), |
| 87 html); | 87 html); |
| 88 } | 88 } |
| 89 | 89 |
| 90 DeviceLogUI::~DeviceLogUI() { | 90 DeviceLogUI::~DeviceLogUI() { |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace chromeos | 93 } // namespace chromeos |
| OLD | NEW |