forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaccount_addition_result.h
47 lines (39 loc) · 1.61 KB
/
account_addition_result.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_ACCOUNT_MANAGER_CORE_ACCOUNT_ADDITION_RESULT_H_
#define COMPONENTS_ACCOUNT_MANAGER_CORE_ACCOUNT_ADDITION_RESULT_H_
#include "base/optional.h"
#include "components/account_manager_core/account.h"
#include "google_apis/gaia/google_service_auth_error.h"
namespace account_manager {
// The result of account addition request.
struct COMPONENT_EXPORT(ACCOUNT_MANAGER_CORE) AccountAdditionResult {
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class Status {
// The account was added successfully.
kSuccess = 0,
// The dialog is already open.
kAlreadyInProgress = 1,
// User closed the dialog.
kCancelledByUser = 2,
// Network error.
kNetworkError = 3,
// Unexpected response (couldn't parse mojo struct).
kUnexpectedResponse = 4,
kMaxValue = kUnexpectedResponse,
};
Status status;
// The account that was added.
base::Optional<Account> account;
// The error is set only if `status` is set to `kNetworkError`.
base::Optional<GoogleServiceAuthError> error;
explicit AccountAdditionResult(Status status);
AccountAdditionResult(Status status, Account account);
AccountAdditionResult(Status status, GoogleServiceAuthError error);
AccountAdditionResult(const AccountAdditionResult&);
~AccountAdditionResult();
};
} // namespace account_manager
#endif // COMPONENTS_ACCOUNT_MANAGER_CORE_ACCOUNT_ADDITION_RESULT_H_