commit | b1d33e71720770022be4672cb64bd6dacbda4f8c | [log] [tgz] |
---|---|---|
author | David Roger <[email protected]> | Fri Sep 20 17:40:02 2024 |
committer | Chromium LUCI CQ <[email protected]> | Fri Sep 20 17:40:02 2024 |
tree | 3c432bb8bffaa6e021e1a2b3dc5405dc033893f5 | |
parent | 07e51c2146466a49158d4c370fa356702b09be63 [diff] [blame] |
[Uno-D] Add sync passphrase dialog Screenshot: https://storage.cloud.google.com/chromium-translation-screenshots/8e37738d4f94ab6fe523e6b40e7e73a1b9bd29cc Screenshot after entering invalid password: https://screenshot.googleplex.com/ARRkChmwAXUkr8m Screencast: https://screencast.googleplex.com/cast/NDgxNTIxMDg5MTE4MjA4MHw2ZWNmNTg0OS1mMQ Low-Coverage-Reason: HARD_TO_TEST some UI glue code in ProfileMenuView Bug: b/356603680 Change-Id: I6c843c305da7533579f38386cc63db6107deb054 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5838370 Reviewed-by: Peter Boström <[email protected]> Reviewed-by: Allen Bauer <[email protected]> Commit-Queue: David Roger <[email protected]> Cr-Commit-Position: refs/heads/main@{#1358261}
diff --git a/chrome/browser/ui/sync/sync_passphrase_dialog.h b/chrome/browser/ui/sync/sync_passphrase_dialog.h new file mode 100644 index 0000000..30d2c082 --- /dev/null +++ b/chrome/browser/ui/sync/sync_passphrase_dialog.h
@@ -0,0 +1,33 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_SYNC_SYNC_PASSPHRASE_DIALOG_H_ +#define CHROME_BROWSER_UI_SYNC_SYNC_PASSPHRASE_DIALOG_H_ + +#include <string> + +#include "base/functional/callback_forward.h" +#include "ui/base/interaction/element_identifier.h" + +namespace syncer { +class SyncService; +} + +DECLARE_ELEMENT_IDENTIFIER_VALUE(kSyncPassphrasePasswordFieldId); +DECLARE_ELEMENT_IDENTIFIER_VALUE(kSyncPassphraseOkButtonFieldId); + +class Browser; + +// Factory function to create and show the Sync passphrase dialog. +// `decrypt_data_callback` should return whether the passphrease was correct. +void ShowSyncPassphraseDialog( + Browser& browser, + base::RepeatingCallback<bool(const std::u16string&)> decrypt_data_callback); + +// Decrypts sync data. Returns true in case of success. +// When this returns false, the user will be prompted to try again. +bool SyncPassphraseDialogDecryptData(syncer::SyncService* sync_service, + const std::u16string& passphrase); + +#endif // CHROME_BROWSER_UI_SYNC_SYNC_PASSPHRASE_DIALOG_H_