OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ | 5 #ifndef BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ |
6 #define BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ | 6 #define BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "blimp/client/public/session/assignment.h" | 9 #include "blimp/client/public/session/assignment.h" |
10 | 10 |
| 11 class IdentityProvider; |
| 12 |
11 namespace blimp { | 13 namespace blimp { |
12 namespace client { | 14 namespace client { |
13 class BlimpContents; | 15 class BlimpContents; |
14 | 16 |
15 // BlimpClientContextDelegate is how the BlimpClientContext gets the | 17 // BlimpClientContextDelegate is how the BlimpClientContext gets the |
16 // functionality it needs from its embedder. | 18 // functionality it needs from its embedder. |
17 class BlimpClientContextDelegate { | 19 class BlimpClientContextDelegate { |
18 public: | 20 public: |
| 21 // Authentication error propagated to the embedder. |
| 22 enum AuthError { |
| 23 NOT_SIGNED_IN = 0, |
| 24 OAUTH_TOKEN_FAIL, |
| 25 }; |
| 26 |
19 virtual ~BlimpClientContextDelegate() = default; | 27 virtual ~BlimpClientContextDelegate() = default; |
20 | 28 |
21 // Attaches any required base::SupportsUserData::Data to the BlimpContents. | 29 // Attaches any required base::SupportsUserData::Data to the BlimpContents. |
22 virtual void AttachBlimpContentsHelpers(BlimpContents* blimp_contents) = 0; | 30 virtual void AttachBlimpContentsHelpers(BlimpContents* blimp_contents) = 0; |
23 | 31 |
24 // Called whenever an assignment request has finished and the resulting | 32 // Called whenever an assignment request has finished and the resulting |
25 // Assignment is ready to be used in an attempt to connect to the engine. The | 33 // Assignment is ready to be used in an attempt to connect to the engine. The |
26 // |result| is the result for the assignment request itself, not for the | 34 // |result| is the result for the assignment request itself, not for the |
27 // connection attempt. Only when |result| is ASSIGNMENT_REQUEST_RESULT_OK | 35 // connection attempt. Only when |result| is ASSIGNMENT_REQUEST_RESULT_OK |
28 // will an attempt actually be made to connect to the engine using the | 36 // will an attempt actually be made to connect to the engine using the |
29 // Assignment. | 37 // Assignment. |
30 virtual void OnAssignmentConnectionAttempted( | 38 virtual void OnAssignmentConnectionAttempted( |
31 AssignmentRequestResult result, | 39 AssignmentRequestResult result, |
32 const Assignment& assignment) = 0; | 40 const Assignment& assignment) = 0; |
33 | 41 |
| 42 // Create IdentityProvider for OAuth2 token retrieval, used in Authenticator. |
| 43 virtual std::unique_ptr<IdentityProvider> CreateIdentityProvider() = 0; |
| 44 |
| 45 // Propagate authentication error to the embedder. |
| 46 virtual void OnAuthenticationError( |
| 47 BlimpClientContextDelegate::AuthError error) = 0; |
| 48 |
34 protected: | 49 protected: |
35 BlimpClientContextDelegate() = default; | 50 BlimpClientContextDelegate() = default; |
36 | 51 |
37 private: | 52 private: |
38 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextDelegate); | 53 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextDelegate); |
39 }; | 54 }; |
40 | 55 |
41 } // namespace client | 56 } // namespace client |
42 } // namespace blimp | 57 } // namespace blimp |
43 | 58 |
44 #endif // BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ | 59 #endif // BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ |
OLD | NEW |