Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: blimp/client/public/blimp_client_context_delegate.h

Issue 2391263005: Propagate error messages to UI for blimp. (Closed)
Patch Set: Minor fixes. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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; 11 class IdentityProvider;
12 class GoogleServiceAuthError;
12 13
13 namespace blimp { 14 namespace blimp {
14 namespace client { 15 namespace client {
15 class BlimpContents; 16 class BlimpContents;
16 17
17 // BlimpClientContextDelegate is how the BlimpClientContext gets the 18 // BlimpClientContextDelegate is how the BlimpClientContext gets the
18 // functionality it needs from its embedder. 19 // functionality it needs from its embedder.
19 class BlimpClientContextDelegate { 20 class BlimpClientContextDelegate {
20 public: 21 public:
21 // Authentication error propagated to the embedder.
22 enum AuthError {
23 NOT_SIGNED_IN = 0,
24 OAUTH_TOKEN_FAIL,
25 };
26
27 virtual ~BlimpClientContextDelegate() = default; 22 virtual ~BlimpClientContextDelegate() = default;
28 23
29 // Attaches any required base::SupportsUserData::Data to the BlimpContents. 24 // Attaches any required base::SupportsUserData::Data to the BlimpContents.
30 virtual void AttachBlimpContentsHelpers(BlimpContents* blimp_contents) = 0; 25 virtual void AttachBlimpContentsHelpers(BlimpContents* blimp_contents) = 0;
31 26
32 // Called whenever an assignment request has finished and the resulting 27 // Called whenever an assignment request has finished and the resulting
33 // Assignment is ready to be used in an attempt to connect to the engine. The 28 // Assignment is ready to be used in an attempt to connect to the engine. The
34 // |result| is the result for the assignment request itself, not for the 29 // |result| is the result for the assignment request itself, not for the
35 // connection attempt. Only when |result| is ASSIGNMENT_REQUEST_RESULT_OK 30 // connection attempt. Only when |result| is ASSIGNMENT_REQUEST_RESULT_OK
36 // will an attempt actually be made to connect to the engine using the 31 // will an attempt actually be made to connect to the engine using the
37 // Assignment. 32 // Assignment.
38 virtual void OnAssignmentConnectionAttempted( 33 virtual void OnAssignmentConnectionAttempted(
39 AssignmentRequestResult result, 34 AssignmentRequestResult result,
40 const Assignment& assignment) = 0; 35 const Assignment& assignment) = 0;
41 36
42 // Create IdentityProvider for OAuth2 token retrieval, used in Authenticator. 37 // Create IdentityProvider for OAuth2 token retrieval, used in Authenticator.
43 virtual std::unique_ptr<IdentityProvider> CreateIdentityProvider() = 0; 38 virtual std::unique_ptr<IdentityProvider> CreateIdentityProvider() = 0;
44 39
45 // Propagate authentication error to the embedder. 40 // Propagate authentication error to the embedder.
46 virtual void OnAuthenticationError( 41 virtual void OnAuthenticationError(const GoogleServiceAuthError& error) = 0;
47 BlimpClientContextDelegate::AuthError error) = 0; 42
43 // Called when the client 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;
48 53
49 protected: 54 protected:
50 BlimpClientContextDelegate() = default; 55 BlimpClientContextDelegate() = default;
51 56
52 private: 57 private:
53 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextDelegate); 58 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextDelegate);
54 }; 59 };
55 60
56 } // namespace client 61 } // namespace client
57 } // namespace blimp 62 } // namespace blimp
58 63
59 #endif // BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ 64 #endif // BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_DELEGATE_H_
OLDNEW
« no previous file with comments | « blimp/client/core/session/identity_source_unittest.cc ('k') | blimp/client/test/test_blimp_client_context_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698