OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ | |
6 #define BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "blimp/client/public/session/assignment.h" | |
10 | |
11 class IdentityProvider; | |
12 class GoogleServiceAuthError; | |
13 | |
14 namespace blimp { | |
15 namespace client { | |
16 class BlimpContents; | |
17 | |
18 // BlimpClientContextDelegate is how the BlimpClientContext gets the | |
19 // functionality it needs from its embedder. | |
20 class BlimpClientContextDelegate { | |
21 public: | |
22 virtual ~BlimpClientContextDelegate() = default; | |
23 | |
24 // Attaches any required base::SupportsUserData::Data to the BlimpContents. | |
25 virtual void AttachBlimpContentsHelpers(BlimpContents* blimp_contents) = 0; | |
26 | |
27 // Called whenever an assignment request has finished and the resulting | |
28 // Assignment is ready to be used in an attempt to connect to the engine. The | |
29 // |result| is the result for the assignment request itself, not for the | |
30 // connection attempt. Only when |result| is ASSIGNMENT_REQUEST_RESULT_OK | |
31 // will an attempt actually be made to connect to the engine using the | |
32 // Assignment. | |
33 virtual void OnAssignmentConnectionAttempted( | |
34 AssignmentRequestResult result, | |
35 const Assignment& assignment) = 0; | |
36 | |
37 // Create IdentityProvider for OAuth2 token retrieval, used in Authenticator. | |
38 virtual std::unique_ptr<IdentityProvider> CreateIdentityProvider() = 0; | |
39 | |
40 // Propagate authentication error to the embedder. | |
41 virtual void OnAuthenticationError(const GoogleServiceAuthError& error) = 0; | |
42 | |
43 // Called when the client is connected to the engine. | |
44 virtual void OnConnected() = 0; | |
45 | |
46 // Called when the client is disconnected from the engine. | |
47 // See EndConnectionMessage::Reason. | |
48 virtual void OnEngineDisconnected(int result) = 0; | |
49 | |
50 // Called when the network is disconnected. | |
51 // See /net/base/net_errors.h. | |
52 virtual void OnNetworkDisconnected(int result) = 0; | |
53 | |
54 protected: | |
55 BlimpClientContextDelegate() = default; | |
56 | |
57 private: | |
58 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextDelegate); | |
59 }; | |
60 | |
61 } // namespace client | |
62 } // namespace blimp | |
63 | |
64 #endif // BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ | |
OLD | NEW |