Chromium Code Reviews| Index: chrome/browser/ui/webui/chromeos/emulator/device_emulator_ui.cc |
| diff --git a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_ui.cc b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_ui.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..22e2cf7c7b51c8ef366e5443e34886a02b8fbc23 |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_ui.cc |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/webui/chromeos/emulator/device_emulator_ui.h" |
| + |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h" |
| +#include "chrome/common/url_constants.h" |
| +#include "content/public/browser/web_ui.h" |
| +#include "content/public/browser/web_ui_data_source.h" |
| +#include "grit/browser_resources.h" |
| +#include "grit/generated_resources.h" |
| + |
| +namespace chromeos { |
| + |
| +// Create data source for chrome://device-emulator/. |
| +content::WebUIDataSource* CreateDeviceEmulatorUIDataSource() { |
|
michaelpg
2015/06/24 23:33:49
Put functions local to your implementation inside
rfrappier
2015/06/25 17:09:21
Done.
|
| + content::WebUIDataSource* html = |
| + content::WebUIDataSource::Create(chrome::kChromeUIDeviceEmulatorHost); |
| + |
| + // Localized strings. |
| + |
| + // Variables. |
|
oshima
2015/06/24 22:33:55
Clean up comments. If you want to write a comment
rfrappier
2015/06/24 23:22:27
Done.
|
| + |
| + // Add resources. |
| + html->AddResourcePath("device_emulator.css", IDR_DEVICE_EMULATOR_CSS); |
| + html->AddResourcePath("device_emulator.js", IDR_DEVICE_EMULATOR_JS); |
| + html->SetDefaultResource(IDR_DEVICE_EMULATOR_HTML); |
| + |
| + return html; |
| +} |
| + |
| +DeviceEmulatorUI::DeviceEmulatorUI(content::WebUI* web_ui) |
| + : WebUIController(web_ui) { |
| + // Add message handler to WebUI. |
| + web_ui->AddMessageHandler(new DeviceEmulatorMessageHandler()); |
| + |
| + Profile* profile = Profile::FromWebUI(web_ui); |
| + content::WebUIDataSource::Add(profile, CreateDeviceEmulatorUIDataSource()); |
| +} |
| + |
| +DeviceEmulatorUI::~DeviceEmulatorUI() { |
| +} |
| + |
| +} // namespace chromeos |