-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Office upload] Implement cancel confirmation dialog for setup
Bug: b/260035590 Change-Id: I78f7217da9664d2a42a77be6d6534d8073ff7407 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4054757 Reviewed-by: Luciano Pacheco <lucmult@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Commit-Queue: Austin Tankiang <austinct@chromium.org> Cr-Commit-Position: refs/heads/main@{#1076591}
- Loading branch information
Austin Tankiang
authored and
Chromium LUCI CQ
committed
Nov 29, 2022
1 parent
422b5c3
commit fdb2324
Showing
7 changed files
with
182 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
chrome/browser/resources/chromeos/cloud_upload/setup_cancel_dialog.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<style> | ||
cr-dialog { | ||
--cr-dialog-width: 448px; | ||
} | ||
|
||
cr-dialog [slot=title] { | ||
color: var(--cros-text-color-primary); | ||
/* TODO(austinct): replace once proper font is in cros_typography */ | ||
font: var(--cros-display-7-font); | ||
padding: 24px 24px 16px; | ||
} | ||
|
||
cr-dialog [slot=body] { | ||
color: var(--cros-text-color-secondary); | ||
font: var(--cros-body-2-font); | ||
padding: 0 24px; | ||
} | ||
|
||
cr-dialog [slot=button-container] { | ||
padding: 49px 24px 24px; | ||
} | ||
|
||
</style> | ||
|
||
<!-- TODO(b/254586358): Use localized strings --> | ||
<cr-dialog> | ||
<div slot="title">Are you sure you want to cancel setup?</div> | ||
<div slot="body"> | ||
You won't be able to open files in Microsoft 365 until setup is complete. | ||
</div> | ||
<div slot="button-container"> | ||
<cr-button class="cancel-button">Cancel setup</cr-button> | ||
<cr-button class="action-button">Resume setup</cr-button> | ||
</div> | ||
</cr-dialog> |
61 changes: 61 additions & 0 deletions
61
chrome/browser/resources/chromeos/cloud_upload/setup_cancel_dialog.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright 2022 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'chrome://resources/cr_elements/cr_button/cr_button.js'; | ||
import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; | ||
|
||
import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; | ||
|
||
import {getTemplate} from './setup_cancel_dialog.html.js'; | ||
|
||
/** | ||
* The SetupCancelDialogElement represents the confirmation dialog shown when | ||
* the user wants to cancel the setup part way through. | ||
*/ | ||
export class SetupCancelDialogElement extends HTMLElement { | ||
private dialog: CrDialogElement; | ||
|
||
/** Callback called if the user chooses to cancel the setup. */ | ||
private cancelCallback: (() => void)|null = null; | ||
|
||
constructor() { | ||
super(); | ||
|
||
this.attachShadow({mode: 'open'}).innerHTML = getTemplate(); | ||
this.dialog = this.$('cr-dialog'); | ||
this.$('.action-button')!.addEventListener( | ||
'click', () => this.onResumeButtonClick()); | ||
this.$('.cancel-button')!.addEventListener( | ||
'click', () => this.onCancelButtonClick()); | ||
} | ||
|
||
$<T extends HTMLElement>(query: string): T { | ||
return this.shadowRoot!.querySelector(query)!; | ||
} | ||
|
||
get open(): boolean { | ||
return this.dialog.open; | ||
} | ||
|
||
show(cancelCallback: () => void): void { | ||
this.cancelCallback = cancelCallback; | ||
this.dialog.showModal(); | ||
} | ||
|
||
private onResumeButtonClick(): void { | ||
this.dialog.close(); | ||
} | ||
|
||
private onCancelButtonClick(): void { | ||
this.cancelCallback!(); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'setup-cancel-dialog': SetupCancelDialogElement; | ||
} | ||
} | ||
|
||
customElements.define('setup-cancel-dialog', SetupCancelDialogElement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters