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 CHROME_BROWSER_ANDROID_BLIMP_CHROME_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ | |
6 #define CHROME_BROWSER_ANDROID_BLIMP_CHROME_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/strings/string16.h" | |
12 #include "blimp/client/public/blimp_client_context_delegate.h" | |
13 | |
14 class IdentityProvider; | |
15 class Profile; | |
16 | |
17 namespace blimp { | |
18 namespace client { | |
19 class BlimpClientContext; | |
20 class BlimpContents; | |
21 } // namespace client | |
22 } // namespace blimp | |
23 | |
24 // The BlimpClientContextDelegate for //chrome which provides the necessary | |
25 // functionality required to run Blimp. | |
26 class ChromeBlimpClientContextDelegate | |
27 : public blimp::client::BlimpClientContextDelegate { | |
28 public: | |
29 // Constructs the object and attaches it to the BlimpClientContext that is | |
30 // used for the given profile. | |
31 explicit ChromeBlimpClientContextDelegate(Profile* profile); | |
32 // Unattaches itself from the BlimpClientContext before going away. | |
33 ~ChromeBlimpClientContextDelegate() override; | |
34 | |
35 // BlimpClientContextDelegate implementation. | |
36 void AttachBlimpContentsHelpers( | |
37 blimp::client::BlimpContents* blimp_contents) override; | |
38 void OnAssignmentConnectionAttempted( | |
39 blimp::client::AssignmentRequestResult result, | |
40 const blimp::client::Assignment& assignment) override; | |
41 std::unique_ptr<IdentityProvider> CreateIdentityProvider() override; | |
42 void OnAuthenticationError(const GoogleServiceAuthError& error) override; | |
43 void OnConnected() override; | |
44 void OnEngineDisconnected(int result) override; | |
45 void OnNetworkDisconnected(int result) override; | |
46 | |
47 protected: | |
48 // Show an alert message in the embedder. | |
49 virtual void ShowMessage(const base::string16& msg, bool short_message); | |
50 | |
51 private: | |
52 void OnDisconnected(const base::string16& reason); | |
53 | |
54 // The profile this delegate is used for. | |
55 Profile* profile_; | |
56 | |
57 // The BlimpClientContext this is the delegate for. | |
58 blimp::client::BlimpClientContext* blimp_client_context_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(ChromeBlimpClientContextDelegate); | |
61 }; | |
62 | |
63 #endif // CHROME_BROWSER_ANDROID_BLIMP_CHROME_BLIMP_CLIENT_CONTEXT_DELEGATE_H_ | |
OLD | NEW |