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.
5 #include "components/proximity_auth/webui/proximity_auth_ui.h"
7 #include "components/proximity_auth/webui/proximity_auth_webui_handler.h"
8 #include "components/proximity_auth/webui/url_constants.h"
9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_ui.h"
12 #include "content/public/browser/web_ui_data_source.h"
13 #include "grit/components_resources.h"
14 #include "grit/webui_resources.h"
16 namespace proximity_auth
{
18 ProximityAuthUI::ProximityAuthUI(content::WebUI
* web_ui
,
19 ProximityAuthUIDelegate
* delegate
)
20 : content::WebUIController(web_ui
) {
21 content::WebUIDataSource
* source
=
22 content::WebUIDataSource::Create(kChromeUIProximityAuthHost
);
23 source
->SetDefaultResource(IDR_PROXIMITY_AUTH_UI_HTML
);
24 source
->AddResourcePath("proximity_auth.css", IDR_PROXIMITY_AUTH_UI_CSS
);
25 source
->AddResourcePath("content-panel.html",
26 IDR_PROXIMITY_AUTH_CONTENT_PANEL_HTML
);
27 source
->AddResourcePath("content-panel.js",
28 IDR_PROXIMITY_AUTH_CONTENT_PANEL_JS
);
29 source
->AddResourcePath("log-panel.html", IDR_PROXIMITY_AUTH_LOG_PANEL_HTML
);
30 source
->AddResourcePath("log-panel.js", IDR_PROXIMITY_AUTH_LOG_PANEL_JS
);
31 source
->AddResourcePath("local-state.html",
32 IDR_PROXIMITY_AUTH_LOCAL_STATE_HTML
);
33 source
->AddResourcePath("local-state.js", IDR_PROXIMITY_AUTH_LOCAL_STATE_JS
);
34 source
->AddResourcePath("device-list.html",
35 IDR_PROXIMITY_AUTH_DEVICE_LIST_HTML
);
36 source
->AddResourcePath("device-list.js", IDR_PROXIMITY_AUTH_DEVICE_LIST_JS
);
37 source
->AddResourcePath("log-buffer.html",
38 IDR_PROXIMITY_AUTH_LOG_BUFFER_HTML
);
39 source
->AddResourcePath("log-buffer.js", IDR_PROXIMITY_AUTH_LOG_BUFFER_JS
);
40 source
->AddResourcePath("eligible-devices.html",
41 IDR_PROXIMITY_AUTH_ELIGIBLE_DEVICES_HTML
);
42 source
->AddResourcePath("eligible-devices.js",
43 IDR_PROXIMITY_AUTH_ELIGIBLE_DEVICES_JS
);
44 source
->AddResourcePath("cryptauth_interface.js",
45 IDR_PROXIMITY_AUTH_CRYPTAUTH_INTERFACE_JS
);
47 content::BrowserContext
* browser_context
=
48 web_ui
->GetWebContents()->GetBrowserContext();
49 content::WebUIDataSource::Add(browser_context
, source
);
50 web_ui
->AddMessageHandler(new ProximityAuthWebUIHandler(delegate
));
53 ProximityAuthUI::~ProximityAuthUI() {
56 } // namespace proximity_auth