David Roger | b1d33e71 | 2024-09-20 17:40:02 | [diff] [blame] | 1 | // 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 Kasting | d6c29547 | 2025-02-12 18:56:37 | [diff] [blame^] | 8 | #include <string_view> |
David Roger | b1d33e71 | 2024-09-20 17:40:02 | [diff] [blame] | 9 | |
| 10 | #include "base/functional/callback_forward.h" |
| 11 | #include "ui/base/interaction/element_identifier.h" |
| 12 | |
| 13 | namespace syncer { |
| 14 | class SyncService; |
| 15 | } |
| 16 | |
| 17 | DECLARE_ELEMENT_IDENTIFIER_VALUE(kSyncPassphrasePasswordFieldId); |
| 18 | DECLARE_ELEMENT_IDENTIFIER_VALUE(kSyncPassphraseOkButtonFieldId); |
| 19 | |
| 20 | class Browser; |
| 21 | |
| 22 | // Factory function to create and show the Sync passphrase dialog. |
| 23 | // `decrypt_data_callback` should return whether the passphrease was correct. |
| 24 | void ShowSyncPassphraseDialog( |
| 25 | Browser& browser, |
Peter Kasting | d6c29547 | 2025-02-12 18:56:37 | [diff] [blame^] | 26 | base::RepeatingCallback<bool(std::u16string_view)> decrypt_data_callback); |
David Roger | b1d33e71 | 2024-09-20 17:40:02 | [diff] [blame] | 27 | |
| 28 | // Decrypts sync data. Returns true in case of success. |
| 29 | // When this returns false, the user will be prompted to try again. |
| 30 | bool SyncPassphraseDialogDecryptData(syncer::SyncService* sync_service, |
Peter Kasting | d6c29547 | 2025-02-12 18:56:37 | [diff] [blame^] | 31 | std::u16string_view passphrase); |
David Roger | b1d33e71 | 2024-09-20 17:40:02 | [diff] [blame] | 32 | |
| 33 | #endif // CHROME_BROWSER_UI_SYNC_SYNC_PASSPHRASE_DIALOG_H_ |