-
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.
Gets current sync and account states and listens for updates. Displays different UI depending on sync state. Does not yet trigger any sync/ sign-in flows, the not started state button is currently a no-op for these cases. Bug: 1469126 Change-Id: I6f97b10feeac912180a11cf79c037167486f08f9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4977837 Commit-Queue: Emily Shack <emshack@chromium.org> Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com> Reviewed-by: David Pennington <dpenning@chromium.org> Reviewed-by: Alison Gale <agale@chromium.org> Cr-Commit-Position: refs/heads/main@{#1216210}
- Loading branch information
Emily Shack
authored and
Chromium LUCI CQ
committed
Oct 27, 2023
1 parent
52d9aa2
commit 36e0dad
Showing
13 changed files
with
556 additions
and
30 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
47 changes: 44 additions & 3 deletions
47
chrome/browser/resources/tab_search/tab_organization_not_started.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 |
---|---|---|
@@ -1,16 +1,57 @@ | ||
<style include="tab-organization-shared-style"> | ||
:host { | ||
--avatar-size: 40px; | ||
} | ||
|
||
cr-button { | ||
align-self: flex-end; | ||
width: fit-content; | ||
} | ||
|
||
.account-email { | ||
font-size: 12px; | ||
} | ||
|
||
.account-image { | ||
border-radius: var(--avatar-size); | ||
height: var(--avatar-size); | ||
width: var(--avatar-size); | ||
} | ||
|
||
.account-row { | ||
align-items: center; | ||
display: flex; | ||
gap: 10px; | ||
} | ||
|
||
.account-text { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 4px; | ||
} | ||
</style> | ||
|
||
<div class="tab-organization-container"> | ||
<div class="tab-organization-text-container"> | ||
<div class="tab-organization-header">[[getTitle_(showFre)]]</div> | ||
<div class="tab-organization-body">[[getBody_(showFre)]]</div> | ||
<div class="tab-organization-body"> | ||
[[getBody_(showFre, sync_, account_)]] | ||
</div> | ||
</div> | ||
<cr-button class="action-button" on-click="onOrganizeTabsClick_"> | ||
$i18n{notStartedButton} | ||
<template is="dom-if" if="[[shouldShowAccountInfo_(sync_, account_)]]"> | ||
<div class="account-row"> | ||
<!-- TODO(emshack): Add alt text --> | ||
<img class="account-image" alt="" | ||
src="[[getAccountImageSrc_(account_.avatarImage)]]"> | ||
<div class="account-text"> | ||
<div class="tab-organization-header">[[account_.name]]</div> | ||
<div class="tab-organization-body account-email"> | ||
[[account_.email]] | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
<cr-button class="action-button" on-click="onButtonClick_"> | ||
[[getButtonText_(sync_, account_)]] | ||
</cr-button> | ||
</div> |
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
53 changes: 53 additions & 0 deletions
53
chrome/browser/resources/tab_search/tab_search_sync_browser_proxy.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,53 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import {sendWithPromise} from 'chrome://resources/js/cr.js'; | ||
|
||
/** | ||
* @see chrome/browser/ui/webui/tab_search/tab_search_sync_handler.cc | ||
*/ | ||
export interface AccountInfo { | ||
name: string; | ||
email: string; | ||
avatarImage?: string; | ||
} | ||
|
||
export interface SyncInfo { | ||
syncing: boolean; | ||
paused: boolean; | ||
syncingHistory: boolean; | ||
} | ||
|
||
export interface TabSearchSyncBrowserProxy { | ||
/** | ||
* Gets the current sync info. | ||
*/ | ||
getSyncInfo(): Promise<SyncInfo>; | ||
|
||
/** | ||
* Gets the current account info. | ||
*/ | ||
getAccountInfo(): Promise<AccountInfo>; | ||
} | ||
|
||
export class TabSearchSyncBrowserProxyImpl implements | ||
TabSearchSyncBrowserProxy { | ||
getSyncInfo() { | ||
return sendWithPromise('GetSyncInfo'); | ||
} | ||
|
||
getAccountInfo() { | ||
return sendWithPromise('GetAccountInfo'); | ||
} | ||
|
||
static getInstance(): TabSearchSyncBrowserProxy { | ||
return instance || (instance = new TabSearchSyncBrowserProxyImpl()); | ||
} | ||
|
||
static setInstance(obj: TabSearchSyncBrowserProxy) { | ||
instance = obj; | ||
} | ||
} | ||
|
||
let instance: TabSearchSyncBrowserProxy|null = null; |
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.