OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_SYSTEM_USER_USER_ACCOUNTS_DELEGATE_H_ | |
6 #define ASH_SYSTEM_USER_USER_ACCOUNTS_DELEGATE_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "ash/ash_export.h" | |
12 #include "base/macros.h" | |
13 #include "base/observer_list.h" | |
14 | |
15 namespace ash { | |
16 namespace tray { | |
17 | |
18 class ASH_EXPORT UserAccountsDelegate { | |
19 public: | |
20 class Observer { | |
21 public: | |
22 Observer() {} | |
oshima
2014/04/02 00:14:14
optional: I think you can omit ctor in this case.
| |
23 virtual ~Observer() {} | |
24 | |
25 // Called when the account list of user has been changed. | |
26 virtual void AccountListChanged() = 0; | |
27 | |
28 private: | |
29 DISALLOW_COPY_AND_ASSIGN(Observer); | |
30 }; | |
31 | |
32 UserAccountsDelegate(); | |
33 virtual ~UserAccountsDelegate(); | |
34 | |
35 void AddObserver(Observer* observer); | |
36 void RemoveObserver(Observer* observer); | |
37 | |
38 // Returns the user's primary account as a canonicalized email address. | |
39 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
| |
40 | |
41 // Returns a list of the user's secondary accounts in form of canonicalized | |
42 // email addresses. | |
43 virtual std::vector<std::string> GetSecondaryAccountsList() = 0; | |
44 | |
45 // Returns display name for given |account_id|. It has form of email but could | |
46 // be uncanonical, e.g. account "test-user@gmail.com" could have display | |
47 // name "Test-user+AfterPlus@gmail.com". | |
48 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
| |
49 | |
50 // Deletes given |account_id| from the list of user's account. Passing | |
51 // |account_id| that is not from list is no-op. | |
52 virtual void DeleteAccount(const std::string& account_id) = 0; | |
53 | |
54 // Launches a dialog which lets the user add a new account. | |
55 virtual void LaunchAddAccountDialog() = 0; | |
56 | |
57 protected: | |
58 void NotifyAccountListChanged(); | |
59 | |
60 private: | |
61 ObserverList<Observer> observers_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(UserAccountsDelegate); | |
64 }; | |
65 | |
66 } // namespace tray | |
67 } // namespace ash | |
68 | |
69 #endif // ASH_SYSTEM_USER_USER_ACCOUNTS_DELEGATE_H_ | |
OLD | NEW |