Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/webui/chromeos/emulator/device_emulator_ui.h" | |
| 6 | |
| 7 #include "chrome/browser/profiles/profile.h" | |
| 8 #include "chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_hand ler.h" | |
| 9 #include "chrome/common/url_constants.h" | |
| 10 #include "content/public/browser/web_ui.h" | |
| 11 #include "content/public/browser/web_ui_data_source.h" | |
| 12 #include "grit/browser_resources.h" | |
| 13 #include "grit/generated_resources.h" | |
| 14 | |
| 15 namespace chromeos { | |
| 16 | |
| 17 // Create data source for chrome://device-emulator/. | |
| 18 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.
| |
| 19 content::WebUIDataSource* html = | |
| 20 content::WebUIDataSource::Create(chrome::kChromeUIDeviceEmulatorHost); | |
| 21 | |
| 22 // Localized strings. | |
| 23 | |
| 24 // 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.
| |
| 25 | |
| 26 // Add resources. | |
| 27 html->AddResourcePath("device_emulator.css", IDR_DEVICE_EMULATOR_CSS); | |
| 28 html->AddResourcePath("device_emulator.js", IDR_DEVICE_EMULATOR_JS); | |
| 29 html->SetDefaultResource(IDR_DEVICE_EMULATOR_HTML); | |
| 30 | |
| 31 return html; | |
| 32 } | |
| 33 | |
| 34 DeviceEmulatorUI::DeviceEmulatorUI(content::WebUI* web_ui) | |
| 35 : WebUIController(web_ui) { | |
| 36 // Add message handler to WebUI. | |
| 37 web_ui->AddMessageHandler(new DeviceEmulatorMessageHandler()); | |
| 38 | |
| 39 Profile* profile = Profile::FromWebUI(web_ui); | |
| 40 content::WebUIDataSource::Add(profile, CreateDeviceEmulatorUIDataSource()); | |
| 41 } | |
| 42 | |
| 43 DeviceEmulatorUI::~DeviceEmulatorUI() { | |
| 44 } | |
| 45 | |
| 46 } // namespace chromeos | |
| OLD | NEW |