Commit 37a75b22 authored by Dominique Fauteux-Chapleau's avatar Dominique Fauteux-Chapleau Committed by Commit Bot

Remove unused StoreDMToken overload.

Removing overload as discussed in crrev.com/c/1903957 so callers don't
have to use the Create* functions. They are however still public as
test code will need them to test the behaviour of different DM token
statuses.

Change-Id: I8ee20e4b54a1b946317d1d4265bade05d4dab15d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1906628Reviewed-by: default avatarTien Mai <tienmai@chromium.org>
Reviewed-by: default avatarRoger Tawa <rogerta@chromium.org>
Commit-Queue: Dominique Fauteux-Chapleau <domfc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714277}
parent 76288c48
...@@ -120,29 +120,22 @@ std::string BrowserDMTokenStorage::RetrieveEnrollmentToken() { ...@@ -120,29 +120,22 @@ std::string BrowserDMTokenStorage::RetrieveEnrollmentToken() {
void BrowserDMTokenStorage::StoreDMToken(const std::string& dm_token, void BrowserDMTokenStorage::StoreDMToken(const std::string& dm_token,
StoreCallback callback) { StoreCallback callback) {
if (dm_token.empty())
StoreDMToken(BrowserDMToken::CreateEmptyToken(), std::move(callback));
else if (dm_token == kInvalidTokenValue)
StoreDMToken(BrowserDMToken::CreateInvalidToken(), std::move(callback));
else
StoreDMToken(BrowserDMToken::CreateValidToken(dm_token),
std::move(callback));
}
void BrowserDMTokenStorage::StoreDMToken(const BrowserDMToken& dm_token,
StoreCallback callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!store_callback_); DCHECK(!store_callback_);
InitIfNeeded(); InitIfNeeded();
dm_token_ = dm_token;
store_callback_ = std::move(callback); store_callback_ = std::move(callback);
if (dm_token_.is_invalid()) if (dm_token.empty()) {
dm_token_ = BrowserDMToken::CreateEmptyToken();
SaveDMToken("");
} else if (dm_token == kInvalidTokenValue) {
dm_token_ = BrowserDMToken::CreateInvalidToken();
SaveDMToken(kInvalidTokenValue); SaveDMToken(kInvalidTokenValue);
else } else {
dm_token_ = BrowserDMToken::CreateValidToken(dm_token);
SaveDMToken(dm_token_.value()); SaveDMToken(dm_token_.value());
}
} }
std::string BrowserDMTokenStorage::RetrieveDMToken() { std::string BrowserDMTokenStorage::RetrieveDMToken() {
......
...@@ -57,7 +57,6 @@ class BrowserDMTokenStorage { ...@@ -57,7 +57,6 @@ class BrowserDMTokenStorage {
private: private:
enum class Status { kValid, kInvalid, kEmpty }; enum class Status { kValid, kInvalid, kEmpty };
BrowserDMToken();
BrowserDMToken(Status status, const base::StringPiece value); BrowserDMToken(Status status, const base::StringPiece value);
Status status_; Status status_;
...@@ -77,9 +76,7 @@ class BrowserDMTokenStorage { ...@@ -77,9 +76,7 @@ class BrowserDMTokenStorage {
// Asynchronously stores |dm_token| and calls |callback| with a boolean to // Asynchronously stores |dm_token| and calls |callback| with a boolean to
// indicate success or failure. It is an error to attempt concurrent store // indicate success or failure. It is an error to attempt concurrent store
// operations. // operations.
// TODO(domfc): Remove overload after updating callers.
void StoreDMToken(const std::string& dm_token, StoreCallback callback); void StoreDMToken(const std::string& dm_token, StoreCallback callback);
void StoreDMToken(const BrowserDMToken& dm_token, StoreCallback callback);
// Returns an already stored DM token. An empty token is returned if no DM // Returns an already stored DM token. An empty token is returned if no DM
// token exists on the system or an error is encountered. // token exists on the system or an error is encountered.
// TODO(domfc): Remove overload after updating callers. Note that the names // TODO(domfc): Remove overload after updating callers. Note that the names
......
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