Commit 3a73a21f authored by Gavin Williams's avatar Gavin Williams Committed by Commit Bot

scanning: Add browser proxy

Add browser proxy to give Scanning UI access to ScanningHandler
functions.

Bug: 1059779
Change-Id: Iad0f72305ae315c3079393ff077c784ec9b8f101
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2497427
Commit-Queue: Gavin Williams <gavinwill@chromium.org>
Reviewed-by: default avatarZentaro Kavanagh <zentaro@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821831}
parent 3e075f99
......@@ -20,6 +20,7 @@ js_type_check("closure_compile_module") {
":scanning_app",
":scanning_app_types",
":scanning_app_util",
":scanning_browser_proxy",
":select_behavior",
":source_select",
]
......@@ -96,6 +97,7 @@ js_library("scanning_app") {
":scanner_select",
":scanning_app_types",
":scanning_app_util",
":scanning_browser_proxy",
":source_select",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/js:i18n_behavior.m",
......@@ -121,6 +123,10 @@ js_library("source_select") {
]
}
js_library("scanning_browser_proxy") {
deps = [ "//ui/webui/resources/js:cr" ]
}
js_library("mojo_interface_provider") {
deps = [
"//chromeos/components/scanning/mojom:mojom_js_library_for_compile",
......
......@@ -43,6 +43,7 @@
</includes>
<structures>
<structure name="IDR_SCANNING_APP_BROWSER_PROXY_JS" file="scanning_browser_proxy.js" type="chrome_html" />
<structure name="IDR_SCANNING_APP_MOJO_INTERFACE_PROVIDER_JS" file="mojo_interface_provider.js" type="chrome_html" />
<structure name="IDR_SCANNING_APP_SELECT_BEHAVIOR_JS" file="select_behavior.js" type="chrome_html" />
<structure name="IDR_SCANNING_APP_TYPES_JS" file="scanning_app_types.js" type="chrome_html" />
......
// 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 A helper object used by the Scanning App UI in chromeos/ to
* provide access to the ScanningHandler which invokes functions that only exist
* in chrome/.
*/
import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
/** @interface */
class ScanningBrowserProxy {
/** Initialize ScanningHandler. */
initialize() {}
/**
* Requests the user to choose the directory to save scans.
* @return {!Promise<string>}
*/
requestScanToLocation() {}
}
/** @implements {ScanningBrowserProxy} */
export class ScanningBrowserProxyImpl {
/** @override */
initialize() {
chrome.send('initialize');
}
/** @override */
requestScanToLocation() {
return sendWithPromise('requestScanToLocation');
}
}
// The singleton instance_ can be replaced with a test version of this wrapper
// during testing.
addSingletonGetter(ScanningBrowserProxyImpl);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment