Commit 4ccee7db authored by Shik Chen's avatar Shik Chen Committed by Chromium LUCI CQ

CCA: Dismiss the barcode chip when the toggle is off

Bug: b/172879638
Test: Manually.
Change-Id: Ie951d03455d9c946724a90f1a99b347cf99dcd4b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2603702
Commit-Queue: Shik Chen <shik@chromium.org>
Reviewed-by: default avatarInker Kuo <inker@chromium.org>
Cr-Commit-Position: refs/heads/master@{#839431}
parent 713e2d45
...@@ -175,3 +175,13 @@ export async function show(code) { ...@@ -175,3 +175,13 @@ export async function show(code) {
showText(code); showText(code);
} }
} }
/**
* Dismisses the current barcode chip if it's being shown.
*/
export function dismiss() {
if (currentTimer === null) {
return;
}
currentTimer.fireNow();
}
...@@ -8,8 +8,8 @@ import {BarcodeScanner} from '../../models/barcode.js'; ...@@ -8,8 +8,8 @@ import {BarcodeScanner} from '../../models/barcode.js';
import {DeviceOperator, parseMetadata} from '../../mojo/device_operator.js'; import {DeviceOperator, parseMetadata} from '../../mojo/device_operator.js';
import * as nav from '../../nav.js'; import * as nav from '../../nav.js';
import * as state from '../../state.js'; import * as state from '../../state.js';
import * as util from '../../util.js';
import {Mode} from '../../type.js'; import {Mode} from '../../type.js';
import * as util from '../../util.js';
/** /**
* Creates a controller for the video preview of Camera view. * Creates a controller for the video preview of Camera view.
...@@ -208,6 +208,7 @@ export class Preview { ...@@ -208,6 +208,7 @@ export class Preview {
this.scanner_.start(); this.scanner_.start();
} else { } else {
this.scanner_.stop(); this.scanner_.stop();
barcodeChip.dismiss();
} }
} }
......
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