diff options
Diffstat (limited to 'chromium/chrome/browser/resources/nearby_share')
8 files changed, 138 insertions, 0 deletions
diff --git a/chromium/chrome/browser/resources/nearby_share/BUILD.gn b/chromium/chrome/browser/resources/nearby_share/BUILD.gn new file mode 100644 index 00000000000..543394e5aaf --- /dev/null +++ b/chromium/chrome/browser/resources/nearby_share/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright 2020 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. + +import("//third_party/closure_compiler/compile_js.gni") +import("//tools/polymer/html_to_js.gni") + +js_type_check("closure_compile") { + is_polymer3 = true + deps = [ + ":app", + ":nearby_discovery_page", + ] +} + +js_library("app") { + deps = [ + ":nearby_discovery_page", + "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + "//ui/webui/resources/cr_elements/cr_view_manager:cr_view_manager.m", + ] +} + +js_library("nearby_discovery_page") { + deps = [ + "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + ] +} + +html_to_js("web_components") { + js_files = [ + "app.js", + "nearby_discovery_page.js", + ] +} diff --git a/chromium/chrome/browser/resources/nearby_share/OWNERS b/chromium/chrome/browser/resources/nearby_share/OWNERS new file mode 100644 index 00000000000..72feb28bcca --- /dev/null +++ b/chromium/chrome/browser/resources/nearby_share/OWNERS @@ -0,0 +1,3 @@ +file://chrome/browser/nearby_sharing/OWNERS + +# COMPONENT: UI>Browser>Sharing>Nearby diff --git a/chromium/chrome/browser/resources/nearby_share/app.html b/chromium/chrome/browser/resources/nearby_share/app.html new file mode 100644 index 00000000000..e16336c4164 --- /dev/null +++ b/chromium/chrome/browser/resources/nearby_share/app.html @@ -0,0 +1,4 @@ +<cr-view-manager id="viewManager"> + <nearby-discovery-page id="[[Page.DISCOVERY]]" slot="view" class="active"> + </nearby-discovery-page> +</cr-view-manager> diff --git a/chromium/chrome/browser/resources/nearby_share/app.js b/chromium/chrome/browser/resources/nearby_share/app.js new file mode 100644 index 00000000000..fc77eb7ac2a --- /dev/null +++ b/chromium/chrome/browser/resources/nearby_share/app.js @@ -0,0 +1,34 @@ +// Copyright 2020 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. + +/** + * @fileoverview The 'nearby-share' component is the entry point for the Nearby + * Share flow. It is used as a standalone dialog via chrome://nearby and as part + * of the ChromeOS share sheet. + */ + +import 'chrome://resources/cr_elements/cr_view_manager/cr_view_manager.m.js'; +import './nearby_discovery_page.js'; +import './strings.m.js'; + +import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +/** @enum {string} */ +const Page = { + DISCOVERY: 'discovery', +}; + +Polymer({ + is: 'nearby-share-app', + + _template: html`{__html_template__}`, + + properties: { + /** Mirroring the enum so that it can be used from HTML bindings. */ + Page: { + type: Object, + value: Page, + }, + }, +}); diff --git a/chromium/chrome/browser/resources/nearby_share/nearby_discovery_page.html b/chromium/chrome/browser/resources/nearby_share/nearby_discovery_page.html new file mode 100644 index 00000000000..cea179efa55 --- /dev/null +++ b/chromium/chrome/browser/resources/nearby_share/nearby_discovery_page.html @@ -0,0 +1 @@ +<h1>Nearby Discovery Page</h1> diff --git a/chromium/chrome/browser/resources/nearby_share/nearby_discovery_page.js b/chromium/chrome/browser/resources/nearby_share/nearby_discovery_page.js new file mode 100644 index 00000000000..9b3308669a4 --- /dev/null +++ b/chromium/chrome/browser/resources/nearby_share/nearby_discovery_page.js @@ -0,0 +1,16 @@ +// Copyright 2020 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. + +/** + * @fileoverview The 'nearby-discovery-page' component shows the discovery UI of + * the Nearby Share flow. It shows a list of devices to select from. + */ + +import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +Polymer({ + is: 'nearby-discovery-page', + + _template: html`{__html_template__}`, +}); diff --git a/chromium/chrome/browser/resources/nearby_share/nearby_share_dialog.html b/chromium/chrome/browser/resources/nearby_share/nearby_share_dialog.html new file mode 100644 index 00000000000..0417789bc2f --- /dev/null +++ b/chromium/chrome/browser/resources/nearby_share/nearby_share_dialog.html @@ -0,0 +1,17 @@ +<!doctype html> +<html dir="$i18n{textdirection}" lang="$i18n{language}"> + <head> + <meta charset="utf-8"> + <base href="chrome://nearby"> + <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css"> + <style> + body { + margin: 0; + } + </style> + </head> + <body> + <nearby-share-app></nearby-share-app> + <script type="module" src="app.js"></script> + </body> +</html> diff --git a/chromium/chrome/browser/resources/nearby_share/nearby_share_dialog_resources.grd b/chromium/chrome/browser/resources/nearby_share/nearby_share_dialog_resources.grd new file mode 100644 index 00000000000..96a629ef628 --- /dev/null +++ b/chromium/chrome/browser/resources/nearby_share/nearby_share_dialog_resources.grd @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grit latest_public_release="0" current_release="1" output_all_resource_defines="false"> + <outputs> + <output filename="grit/nearby_share_dialog_resources.h" type="rc_header"> + <emit emit_type='prepend'></emit> + </output> + <output filename="grit/nearby_share_dialog_resources_map.cc" + type="resource_file_map_source" /> + <output filename="grit/nearby_share_dialog_resources_map.h" + type="resource_map_header" /> + <output filename="nearby_share_dialog_resources.pak" type="data_package" /> + </outputs> + <release seq="1"> + <includes> + <include name="IDR_NEARBY_SHARE_NEARBY_SHARE_DIALOG_HTML" + file="nearby_share_dialog.html" + type="BINDATA"/> + + <!-- Generated Polymer 3 elements --> + <include name="IDR_NEARBY_SHARE_APP_JS" + file="${root_gen_dir}/chrome/browser/resources/nearby_share/app.js" + use_base_dir="false" type="BINDATA"/> + <include name="IDR_NEARBY_SHARE_NEARBY_DISCOVERY_PAGE_JS" + file="${root_gen_dir}/chrome/browser/resources/nearby_share/nearby_discovery_page.js" + use_base_dir="false" type="BINDATA"/> + </includes> + </release> +</grit> |