Chromium Code Reviews| Index: ash/system/user/user_accounts_delegate.h |
| diff --git a/ash/system/user/user_accounts_delegate.h b/ash/system/user/user_accounts_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b717e83aac24a791265859649b389609169a8722 |
| --- /dev/null |
| +++ b/ash/system/user/user_accounts_delegate.h |
| @@ -0,0 +1,69 @@ |
| +// Copyright 2014 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 ASH_SYSTEM_USER_USER_ACCOUNTS_DELEGATE_H_ |
| +#define ASH_SYSTEM_USER_USER_ACCOUNTS_DELEGATE_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "ash/ash_export.h" |
| +#include "base/macros.h" |
| +#include "base/observer_list.h" |
| + |
| +namespace ash { |
| +namespace tray { |
| + |
| +class ASH_EXPORT UserAccountsDelegate { |
| + public: |
| + class Observer { |
| + public: |
| + Observer() {} |
|
oshima
2014/04/02 00:14:14
optional: I think you can omit ctor in this case.
|
| + virtual ~Observer() {} |
| + |
| + // Called when the account list of user has been changed. |
| + virtual void AccountListChanged() = 0; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(Observer); |
| + }; |
| + |
| + UserAccountsDelegate(); |
| + virtual ~UserAccountsDelegate(); |
| + |
| + void AddObserver(Observer* observer); |
| + void RemoveObserver(Observer* observer); |
| + |
| + // Returns the user's primary account as a canonicalized email address. |
| + virtual std::string GetPrimaryAccount() = 0; |
|
oshima
2014/03/31 23:07:52
Q: Is std::string what the multi-login uses as an
dzhioev (left Google)
2014/04/01 17:25:02
Yes, TokenService uses std::string as account ID.
oshima
2014/04/02 00:14:14
That's only true in browser process and they do no
|
| + |
| + // Returns a list of the user's secondary accounts in form of canonicalized |
| + // email addresses. |
| + virtual std::vector<std::string> GetSecondaryAccountsList() = 0; |
| + |
| + // Returns display name for given |account_id|. It has form of email but could |
| + // be uncanonical, e.g. account "test-user@gmail.com" could have display |
| + // name "Test-user+AfterPlus@gmail.com". |
| + virtual std::string GetAccountDisplayName(const std::string& account_id) = 0; |
|
oshima
2014/03/31 23:07:52
shouldn't this be string16?
dzhioev (left Google)
2014/04/01 17:25:02
Probably not. For primary account it will be "disp
oshima
2014/04/02 00:14:14
I see. It's unfortunate that we're using different
|
| + |
| + // Deletes given |account_id| from the list of user's account. Passing |
| + // |account_id| that is not from list is no-op. |
| + virtual void DeleteAccount(const std::string& account_id) = 0; |
| + |
| + // Launches a dialog which lets the user add a new account. |
| + virtual void LaunchAddAccountDialog() = 0; |
| + |
| + protected: |
| + void NotifyAccountListChanged(); |
| + |
| + private: |
| + ObserverList<Observer> observers_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(UserAccountsDelegate); |
| +}; |
| + |
| +} // namespace tray |
| +} // namespace ash |
| + |
| +#endif // ASH_SYSTEM_USER_USER_ACCOUNTS_DELEGATE_H_ |