blob: d4bc8cc0373c36ddcfff689d3d2e622c551982e9 [file] [log] [blame]
David Rogerb1d33e712024-09-20 17:40:021// Copyright 2024 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_UI_SYNC_SYNC_PASSPHRASE_DIALOG_H_
6#define CHROME_BROWSER_UI_SYNC_SYNC_PASSPHRASE_DIALOG_H_
7
Peter Kastingd6c295472025-02-12 18:56:378#include <string_view>
David Rogerb1d33e712024-09-20 17:40:029
10#include "base/functional/callback_forward.h"
11#include "ui/base/interaction/element_identifier.h"
12
13namespace syncer {
14class SyncService;
15}
16
17DECLARE_ELEMENT_IDENTIFIER_VALUE(kSyncPassphrasePasswordFieldId);
18DECLARE_ELEMENT_IDENTIFIER_VALUE(kSyncPassphraseOkButtonFieldId);
19
20class Browser;
21
22// Factory function to create and show the Sync passphrase dialog.
23// `decrypt_data_callback` should return whether the passphrease was correct.
24void ShowSyncPassphraseDialog(
25 Browser& browser,
Peter Kastingd6c295472025-02-12 18:56:3726 base::RepeatingCallback<bool(std::u16string_view)> decrypt_data_callback);
David Rogerb1d33e712024-09-20 17:40:0227
28// Decrypts sync data. Returns true in case of success.
29// When this returns false, the user will be prompted to try again.
30bool SyncPassphraseDialogDecryptData(syncer::SyncService* sync_service,
Peter Kastingd6c295472025-02-12 18:56:3731 std::u16string_view passphrase);
David Rogerb1d33e712024-09-20 17:40:0232
33#endif // CHROME_BROWSER_UI_SYNC_SYNC_PASSPHRASE_DIALOG_H_