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_CORE_SETTINGS_ANDROID_BLIMP_SETTINGS_ANDROID_H_ | |
6 #define BLIMP_CLIENT_CORE_SETTINGS_ANDROID_BLIMP_SETTINGS_ANDROID_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/android/jni_android.h" | |
11 #include "base/android/scoped_java_ref.h" | |
12 #include "base/macros.h" | |
13 #include "blimp/client/core/session/identity_source.h" | |
14 #include "blimp/client/core/session/network_event_observer.h" | |
15 | |
16 namespace blimp { | |
17 namespace client { | |
18 | |
19 class BlimpSettingsDelegate; | |
20 | |
21 // JNI bridge between AboutBlimpPreferences.java and native code. | |
22 class BlimpSettingsAndroid : public IdentityProvider::Observer, | |
23 public NetworkEventObserver { | |
24 public: | |
25 static bool RegisterJni(JNIEnv* env); | |
26 static BlimpSettingsAndroid* FromJavaObject( | |
27 JNIEnv* env, | |
28 const base::android::JavaRef<jobject>& jobj); | |
29 BlimpSettingsAndroid(JNIEnv* env, | |
30 const base::android::JavaRef<jobject>& jobj); | |
31 ~BlimpSettingsAndroid() override; | |
32 | |
33 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); | |
34 | |
35 void SetDelegate(BlimpSettingsDelegate* delegate); | |
36 | |
37 private: | |
38 // Notify Java layer for user sign in state change. | |
39 void OnSignedOut() const; | |
40 void OnSignedIn() const; | |
41 | |
42 // Update engine info in Java, this can be either connection end point or | |
43 // engine disconnection reason. | |
44 void UpdateEngineInfo() const; | |
45 | |
46 // IdentityProvider::Observer implementation. | |
47 void OnActiveAccountLogout() override; | |
48 void OnActiveAccountLogin() override; | |
49 | |
50 // NetworkEventObserver implementation. | |
51 void OnConnected() override; | |
52 void OnDisconnected(int result) override; | |
53 | |
54 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | |
55 | |
56 // Delegate that provides functions needed by settings. | |
57 BlimpSettingsDelegate* delegate_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(BlimpSettingsAndroid); | |
60 }; | |
61 | |
62 } // namespace client | |
63 } // namespace blimp | |
64 | |
65 #endif // BLIMP_CLIENT_CORE_SETTINGS_ANDROID_BLIMP_SETTINGS_ANDROID_H_ | |
OLD | NEW |