Commit 90505f5a authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

[sync] Make ChromeTrustedVaultService an abstract interface

The functions should rather be pure, instead of using a NOTREACHED()
body, to avoid accidents.

Bug: 1100278
Change-Id: I27fe1595d2645d511a75ff0853067d6faf25ce6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2449337
Auto-Submit: Mikel Astiz <mastiz@chromium.org>
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814666}
parent f357a95c
......@@ -9,7 +9,6 @@
#include "base/callback.h"
#include "base/callback_list.h"
#include "base/macros.h"
@class ChromeIdentity;
@class UIViewController;
......@@ -23,7 +22,10 @@ using TrustedVaultSharedKeyList = std::vector<TrustedVaultSharedKey>;
class ChromeTrustedVaultService {
public:
ChromeTrustedVaultService();
ChromeTrustedVaultService(const ChromeTrustedVaultService&) = delete;
virtual ~ChromeTrustedVaultService();
ChromeTrustedVaultService& operator=(const ChromeTrustedVaultService&) =
delete;
using CallbackList = base::CallbackList<void()>;
using Subscription = CallbackList::Subscription;
......@@ -32,23 +34,22 @@ class ChromeTrustedVaultService {
// and returns them by calling |callback|.
virtual void FetchKeys(
ChromeIdentity* chrome_identity,
base::OnceCallback<void(const TrustedVaultSharedKeyList&)> callback);
base::OnceCallback<void(const TrustedVaultSharedKeyList&)> callback) = 0;
// Presents the trusted vault key reauthentication UI for |identity|.
// Once the reauth is done and the UI is dismissed, |callback| is called.
// |callback| is not called if the reauthentication is canceled.
virtual void Reauthentication(ChromeIdentity* chrome_identity,
UIViewController* presentingViewController,
void (^callback)(BOOL success, NSError* error));
void (^callback)(BOOL success,
NSError* error)) = 0;
// Cancels the presented trusted vault key reauthentication UI.
// The reauthentication callback will not be called.
// If no reauthentication dialog is not present, |callback| is called
// synchronously.
virtual void CancelReauthentication(BOOL animated, void (^callback)(void));
virtual void CancelReauthentication(BOOL animated,
void (^callback)(void)) = 0;
virtual std::unique_ptr<Subscription> AddKeysChangedObserver(
const base::RepeatingClosure& cb);
private:
DISALLOW_COPY_AND_ASSIGN(ChromeTrustedVaultService);
const base::RepeatingClosure& cb) = 0;
};
} // namespace ios
......
......@@ -4,8 +4,6 @@
#import "ios/public/provider/chrome/browser/signin/chrome_trusted_vault_service.h"
#import "base/logging.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
......@@ -16,29 +14,4 @@ ChromeTrustedVaultService::ChromeTrustedVaultService() {}
ChromeTrustedVaultService::~ChromeTrustedVaultService() {}
void ChromeTrustedVaultService::FetchKeys(
ChromeIdentity* chrome_identity,
base::OnceCallback<void(const TrustedVaultSharedKeyList&)> callback) {
NOTREACHED();
}
void ChromeTrustedVaultService::Reauthentication(
ChromeIdentity* chrome_identity,
UIViewController* presentingViewController,
void (^callback)(BOOL success, NSError* error)) {
NOTREACHED();
}
void ChromeTrustedVaultService::CancelReauthentication(BOOL animated,
void (^callback)(void)) {
NOTREACHED();
}
std::unique_ptr<ChromeTrustedVaultService::Subscription>
ChromeTrustedVaultService::AddKeysChangedObserver(
const base::RepeatingClosure& cb) {
NOTREACHED();
return nullptr;
}
} // namespace ios
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment