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