-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Office upload] Change upload page to be OneDrive specific
The Drive upload page will use a different layout, so change the current setup page to be for OneDrive only. Also make the file name optional so it can handle the case where only setup occurs (and no file uploading). The file-name part is still incomplete (missing file type icon), so it is untested. Bug: 251046341 Change-Id: Ifadca53c701c55197ddd482005735ce7b9d2be0f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3996412 Reviewed-by: Jeremie Boulic <jboulic@chromium.org> Commit-Queue: Austin Tankiang <austinct@chromium.org> Cr-Commit-Position: refs/heads/main@{#1067414}
- Loading branch information
Austin Tankiang
authored and
Chromium LUCI CQ
committed
Nov 4, 2022
1 parent
58f5bc6
commit f67784b
Showing
9 changed files
with
193 additions
and
185 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
18 changes: 18 additions & 0 deletions
18
chrome/browser/resources/chromeos/cloud_upload/one_drive_upload_page.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,18 @@ | ||
<!-- TODO: Use localized strings --> | ||
<div slot="title"> | ||
Microsoft Office setup complete | ||
</div> | ||
<div slot="body"> | ||
<div id="file-container" hidden> | ||
You can now open your file in the Office app: | ||
<div id="file-name" style="margin-top: 1rem"></div> | ||
</div> | ||
<p> | ||
Other Word, Powerpoint, and Excel files will move to OneDrive and open in | ||
Office by default. You can change this later in Settings. | ||
</p> | ||
</div> | ||
<div slot="button-container"> | ||
<cr-button class="cancel-button">Close</cr-button> | ||
<cr-button class="action-button">Open file</cr-button> | ||
</div> |
70 changes: 70 additions & 0 deletions
70
chrome/browser/resources/chromeos/cloud_upload/one_drive_upload_page.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,70 @@ | ||
// 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 {BaseSetupPageElement, CANCEL_SETUP_EVENT} from './base_setup_page.js'; | ||
import {UserAction} from './cloud_upload.mojom-webui.js'; | ||
import {CloudUploadBrowserProxy} from './cloud_upload_browser_proxy.js'; | ||
import {getTemplate} from './one_drive_upload_page.html.js'; | ||
|
||
/** | ||
* The OneDriveUploadPageElement represents the setup page that prompts the user | ||
* to upload the file to OneDrive. | ||
*/ | ||
export class OneDriveUploadPageElement extends BaseSetupPageElement { | ||
/** The name of the file to upload. */ | ||
private fileName: string|null = null; | ||
|
||
constructor() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Sets the file name to be displayed by this dialog. Can be null if there is | ||
* no file to upload. | ||
* @param fileName Name of the file to be displayed. | ||
*/ | ||
setFileName(fileName: string|null) { | ||
this.fileName = fileName; | ||
if (this.isConnected) { | ||
this.connectedCallback(); | ||
} | ||
} | ||
|
||
private get proxy(): CloudUploadBrowserProxy { | ||
return CloudUploadBrowserProxy.getInstance(); | ||
} | ||
|
||
/** | ||
* Initialises the page specific content inside the page. | ||
*/ | ||
connectedCallback(): void { | ||
this.innerHTML = getTemplate() as string; | ||
const fileContainerElement = | ||
this.querySelector('#file-container')! as HTMLElement; | ||
const fileNameElement = this.querySelector('#file-name')! as HTMLElement; | ||
const uploadButton = this.querySelector('.action-button')! as HTMLElement; | ||
const cancelButton = this.querySelector('.cancel-button') as HTMLElement; | ||
|
||
if (this.fileName != null) { | ||
fileContainerElement.hidden = false; | ||
fileNameElement.innerText = `File name: ${this.fileName}`; | ||
} | ||
|
||
uploadButton.addEventListener('click', () => this.onUploadButtonClick()); | ||
cancelButton.addEventListener('click', () => this.onCancelButtonClick()); | ||
} | ||
|
||
private onUploadButtonClick(): void { | ||
this.proxy.handler.respondAndClose(UserAction.kUpload); | ||
} | ||
|
||
private onCancelButtonClick(): void { | ||
this.dispatchEvent( | ||
new CustomEvent(CANCEL_SETUP_EVENT, {bubbles: true, composed: true})); | ||
} | ||
} | ||
|
||
customElements.define('upload-page', OneDriveUploadPageElement); |
12 changes: 0 additions & 12 deletions
12
chrome/browser/resources/chromeos/cloud_upload/upload_page.html
This file was deleted.
Oops, something went wrong.
107 changes: 0 additions & 107 deletions
107
chrome/browser/resources/chromeos/cloud_upload/upload_page.ts
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.