blob: 30d2c082997f996c5d0a9658f4458ca62e5ff1f6 [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
8#include <string>
9
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,
26 base::RepeatingCallback<bool(const std::u16string&)> decrypt_data_callback);
27
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,
31 const std::u16string& passphrase);
32
33#endif // CHROME_BROWSER_UI_SYNC_SYNC_PASSPHRASE_DIALOG_H_