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

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: git cl format.... 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(JNIEnv* env, jobject jobj); 27 static BlimpSettingsAndroid* FromJavaObject(JNIEnv* env, jobject jobj);
23 BlimpSettingsAndroid(JNIEnv* env, jobject jobj); 28 BlimpSettingsAndroid(JNIEnv* env, jobject jobj);
24 ~BlimpSettingsAndroid() override; 29 ~BlimpSettingsAndroid() override;
25 30
26 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); 31 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj);
27 32
28 void SetIdentitySource(IdentitySource* identity_source); 33 void SetDelegate(BlimpSettingsDelegate* delegate);
29 34
30 // Notify Java layer for user sign in state change. 35 // Notify Java layer for user sign in state change.
31 void OnSignedOut(); 36 void OnSignedOut();
32 void OnSignedIn(); 37 void OnSignedIn();
33 38
34 // IdentityProvider::Observer implementation. 39 // IdentityProvider::Observer implementation.
35 void OnActiveAccountLogout() override; 40 void OnActiveAccountLogout() override;
36 void OnActiveAccountLogin() override; 41 void OnActiveAccountLogin() override;
37 42
43 // NetworkEventObserver implementation.
44 void OnConnected() override;
45 void OnDisconnected(int result) override;
46
38 private: 47 private:
39 base::android::ScopedJavaGlobalRef<jobject> java_obj_; 48 base::android::ScopedJavaGlobalRef<jobject> java_obj_;
40 49
41 // IdentitySource that broadcasts sign in state change. 50 // Delegate that provides functions needed by settings.
42 IdentitySource* identity_source_; 51 BlimpSettingsDelegate* delegate_ = nullptr;
43 52
44 DISALLOW_COPY_AND_ASSIGN(BlimpSettingsAndroid); 53 DISALLOW_COPY_AND_ASSIGN(BlimpSettingsAndroid);
45 }; 54 };
46 55
47 } // namespace client 56 } // namespace client
48 } // namespace blimp 57 } // namespace blimp
49 58
50 #endif // BLIMP_CLIENT_CORE_SETTINGS_ANDROID_BLIMP_SETTINGS_ANDROID_H_ 59 #endif // BLIMP_CLIENT_CORE_SETTINGS_ANDROID_BLIMP_SETTINGS_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698