| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // WebUIMessageHandler implementation. | 32 // WebUIMessageHandler implementation. |
| 33 void RegisterMessages() override { | 33 void RegisterMessages() override { |
| 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::Value 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()->CallJavascriptFunctionUnsafe("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 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 82 html->SetDefaultResource(IDR_DEVICE_LOG_UI_HTML); | 82 html->SetDefaultResource(IDR_DEVICE_LOG_UI_HTML); |
| 83 | 83 |
| 84 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), | 84 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), |
| 85 html); | 85 html); |
| 86 } | 86 } |
| 87 | 87 |
| 88 DeviceLogUI::~DeviceLogUI() { | 88 DeviceLogUI::~DeviceLogUI() { |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace chromeos | 91 } // namespace chromeos |
| OLD | NEW |