Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/bluetooth_internals/bluetooth_internals_ui.h" | 5 #include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.h" |
| 6 | 6 |
| 7 #include <utility> | |
| 8 | |
| 7 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 9 #include "chrome/grit/browser_resources.h" | 11 #include "chrome/grit/browser_resources.h" |
| 10 #include "content/public/browser/web_ui_data_source.h" | 12 #include "content/public/browser/web_ui_data_source.h" |
| 11 | 13 |
| 12 BluetoothInternalsUI::BluetoothInternalsUI(content::WebUI* web_ui) | 14 BluetoothInternalsUI::BluetoothInternalsUI(content::WebUI* web_ui) |
| 13 : content::WebUIController(web_ui) { | 15 : MojoWebUIController(web_ui) { |
| 14 // Set up the chrome://bluetooth-internals source. | 16 // Set up the chrome://bluetooth-internals source. |
| 15 content::WebUIDataSource* html_source = | 17 content::WebUIDataSource* html_source = |
| 16 content::WebUIDataSource::Create(chrome::kChromeUIBluetoothInternalsHost); | 18 content::WebUIDataSource::Create(chrome::kChromeUIBluetoothInternalsHost); |
| 17 | 19 |
| 18 // Add required resources. | 20 // Add required resources. |
| 19 html_source->AddResourcePath("bluetooth_internals.css", | 21 html_source->AddResourcePath("bluetooth_internals.css", |
| 20 IDR_BLUETOOTH_INTERNALS_CSS); | 22 IDR_BLUETOOTH_INTERNALS_CSS); |
| 21 html_source->AddResourcePath("bluetooth_internals.js", | 23 html_source->AddResourcePath("bluetooth_internals.js", |
| 22 IDR_BLUETOOTH_INTERNALS_JS); | 24 IDR_BLUETOOTH_INTERNALS_JS); |
| 25 html_source->AddResourcePath( | |
| 26 "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom", | |
| 27 IDR_BLUETOOTH_INTERNALS_MOJO_JS); | |
| 28 html_source->AddResourcePath( | |
| 29 "device/bluetooth/public/interfaces/bluetooth.mojom", | |
| 30 IDR_BLUETOOTH_MOJO_JS); | |
| 23 html_source->SetDefaultResource(IDR_BLUETOOTH_INTERNALS_HTML); | 31 html_source->SetDefaultResource(IDR_BLUETOOTH_INTERNALS_HTML); |
| 24 | 32 |
| 25 Profile* profile = Profile::FromWebUI(web_ui); | 33 Profile* profile = Profile::FromWebUI(web_ui); |
| 26 content::WebUIDataSource::Add(profile, html_source); | 34 content::WebUIDataSource::Add(profile, html_source); |
| 27 } | 35 } |
| 28 | 36 |
| 29 BluetoothInternalsUI::~BluetoothInternalsUI() {} | 37 BluetoothInternalsUI::~BluetoothInternalsUI() {} |
| 38 | |
| 39 void BluetoothInternalsUI::BindUIHandler( | |
| 40 mojom::InternalsPageHandlerRequest request) { | |
| 41 page_handler_.reset(new BluetoothInternalsPageHandler(std::move(request))); | |
|
ortuno
2016/09/22 08:32:53
I'm probably missing some context here but why not
mbrunson
2016/09/24 01:05:47
This seems to be the established pattern but the W
| |
| 42 } | |
| OLD | NEW |