File: proximity_auth_ui.cc

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (62 lines) | stat: -rw-r--r-- 2,966 bytes parent folder | download
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