OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 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 CHROME_BROWSER_INVALIDATION_INVALIDATION_AUTH_PROVIDER_H_ | |
6 #define CHROME_BROWSER_INVALIDATION_INVALIDATION_AUTH_PROVIDER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/observer_list.h" | |
12 | |
13 class OAuth2TokenService; | |
14 | |
15 namespace invalidation { | |
16 | |
17 // Encapsulates authentication-related dependencies of InvalidationService | |
18 // implementations so different implementations can be used for regular Profiles | |
19 // and Chrome OS Kiosk Apps. | |
20 class InvalidationAuthProvider { | |
21 public: | |
22 class Observer { | |
23 public: | |
24 virtual ~Observer(); | |
25 | |
26 // Called when the user logs out. | |
27 virtual void OnInvalidationAuthLogout() = 0; | |
28 }; | |
29 | |
30 virtual ~InvalidationAuthProvider(); | |
31 | |
32 // Gets the token service vending tokens for authentication to the cloud. | |
33 virtual OAuth2TokenService* GetTokenService() = 0; | |
34 | |
35 // Gets the account ID to use for authentication. | |
36 virtual std::string GetAccountId() = 0; | |
37 | |
38 // Shows the login popup, returns true if successful. | |
39 virtual bool ShowLoginUI() = 0; | |
40 | |
41 void AddObserver(Observer* observer); | |
42 void RemoveObserver(Observer* observer); | |
43 | |
44 protected: | |
45 InvalidationAuthProvider(); | |
pavely
2014/03/07 23:43:29
I don't understand reason for making ctor protecte
Mattias Nissler (ping if slow)
2014/03/08 01:30:07
You can't create them anyways (it has pure virtual
pavely
2014/03/08 23:35:18
You could just have no ctor at all, less lines for
| |
46 | |
47 // Fires an OnInvalidationAuthLogout notification. | |
48 void FireInvalidationAuthLogout(); | |
49 | |
50 private: | |
51 ObserverList<Observer, true> observers_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(InvalidationAuthProvider); | |
54 }; | |
55 | |
56 } // namespace invalidation | |
57 | |
58 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_AUTH_PROVIDER_H_ | |
OLD | NEW |