OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "components/proximity_auth/webui/proximity_auth_ui.h" | 5 #include "components/proximity_auth/webui/proximity_auth_ui.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "components/grit/components_resources.h" |
8 #include "components/proximity_auth/webui/proximity_auth_webui_handler.h" | 9 #include "components/proximity_auth/webui/proximity_auth_webui_handler.h" |
9 #include "components/proximity_auth/webui/url_constants.h" | 10 #include "components/proximity_auth/webui/url_constants.h" |
10 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
11 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
12 #include "content/public/browser/web_ui.h" | 13 #include "content/public/browser/web_ui.h" |
13 #include "content/public/browser/web_ui_data_source.h" | 14 #include "content/public/browser/web_ui_data_source.h" |
14 #include "grit/components_resources.h" | |
15 #include "grit/webui_resources.h" | 15 #include "grit/webui_resources.h" |
16 | 16 |
17 namespace proximity_auth { | 17 namespace proximity_auth { |
18 | 18 |
19 ProximityAuthUI::ProximityAuthUI(content::WebUI* web_ui, | 19 ProximityAuthUI::ProximityAuthUI(content::WebUI* web_ui, |
20 ProximityAuthClient* delegate) | 20 ProximityAuthClient* delegate) |
21 : content::WebUIController(web_ui) { | 21 : content::WebUIController(web_ui) { |
22 content::WebUIDataSource* source = | 22 content::WebUIDataSource* source = |
23 content::WebUIDataSource::Create(kChromeUIProximityAuthHost); | 23 content::WebUIDataSource::Create(kChromeUIProximityAuthHost); |
24 source->SetDefaultResource(IDR_PROXIMITY_AUTH_POLLUX_DEBUG_HTML); | 24 source->SetDefaultResource(IDR_PROXIMITY_AUTH_POLLUX_DEBUG_HTML); |
25 source->AddResourcePath("pollux_debug.css", | 25 source->AddResourcePath("pollux_debug.css", |
26 IDR_PROXIMITY_AUTH_POLLUX_DEBUG_CSS); | 26 IDR_PROXIMITY_AUTH_POLLUX_DEBUG_CSS); |
27 source->AddResourcePath("pollux_debug.js", | 27 source->AddResourcePath("pollux_debug.js", |
28 IDR_PROXIMITY_AUTH_POLLUX_DEBUG_JS); | 28 IDR_PROXIMITY_AUTH_POLLUX_DEBUG_JS); |
29 source->AddResourcePath("webui.js", IDR_PROXIMITY_AUTH_POLLUX_WEBUI_JS); | 29 source->AddResourcePath("webui.js", IDR_PROXIMITY_AUTH_POLLUX_WEBUI_JS); |
30 source->AddResourcePath("logs_controller.js", | 30 source->AddResourcePath("logs_controller.js", |
31 IDR_PROXIMITY_AUTH_POLLUX_LOGS_CONTROLLER_JS); | 31 IDR_PROXIMITY_AUTH_POLLUX_LOGS_CONTROLLER_JS); |
32 | 32 |
33 content::BrowserContext* browser_context = | 33 content::BrowserContext* browser_context = |
34 web_ui->GetWebContents()->GetBrowserContext(); | 34 web_ui->GetWebContents()->GetBrowserContext(); |
35 content::WebUIDataSource::Add(browser_context, source); | 35 content::WebUIDataSource::Add(browser_context, source); |
36 web_ui->AddMessageHandler( | 36 web_ui->AddMessageHandler( |
37 base::MakeUnique<ProximityAuthWebUIHandler>(delegate)); | 37 base::MakeUnique<ProximityAuthWebUIHandler>(delegate)); |
38 } | 38 } |
39 | 39 |
40 ProximityAuthUI::~ProximityAuthUI() { | 40 ProximityAuthUI::~ProximityAuthUI() { |
41 } | 41 } |
42 | 42 |
43 } // namespace proximity_auth | 43 } // namespace proximity_auth |
OLD | NEW |