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

Side by Side Diff: blimp/client/core/settings/android/blimp_settings_android.h

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

Powered by Google App Engine
This is Rietveld 408576698