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

Unified Diff: chrome/browser/supervised_user/child_accounts/child_account_service_android.cc

Issue 2695113002: [Webview, Child Accounts] Automatically sign in to Chrome if needed. (Closed)
Patch Set: Fix instrumentation tests Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/supervised_user/child_accounts/child_account_service_android.cc
diff --git a/chrome/browser/supervised_user/child_accounts/child_account_service_android.cc b/chrome/browser/supervised_user/child_accounts/child_account_service_android.cc
index 0cf6c7ac3b23ec9ec3f849124791ec79d03b4408..016b82acd9731959be65b7a65dd0ba372d0ac293 100644
--- a/chrome/browser/supervised_user/child_accounts/child_account_service_android.cc
+++ b/chrome/browser/supervised_user/child_accounts/child_account_service_android.cc
@@ -4,12 +4,19 @@
#include "chrome/browser/supervised_user/child_accounts/child_account_service_android.h"
+#include "base/android/callback_android.h"
+#include "base/bind.h"
+
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/supervised_user/child_accounts/child_account_service.h"
+#include "chrome/browser/supervised_user/child_accounts/child_account_service_factory.h"
#include "jni/ChildAccountService_jni.h"
using base::android::JavaParamRef;
+using base::android::JavaRef;
+using base::android::RunCallbackAndroid;
+using base::android::ScopedJavaGlobalRef;
jboolean IsChildAccount(JNIEnv* env, const JavaParamRef<jclass>& jcaller) {
ProfileManager* profile_manager = g_browser_process->profile_manager();
@@ -19,3 +26,17 @@ jboolean IsChildAccount(JNIEnv* env, const JavaParamRef<jclass>& jcaller) {
bool RegisterChildAccountService(JNIEnv* env) {
return RegisterNativesImpl(env);
}
+
+void ListenForChildStatusReceived(JNIEnv* env,
+ const JavaParamRef<jclass>& jcaller,
+ const JavaParamRef<jobject>& callback) {
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ ChildAccountService* service = ChildAccountServiceFactory::GetForProfile(
+ profile_manager->GetLastUsedProfile());
+ // Needed to disambiguate RunCallbackAndroid
+ void (*runCallback)(const JavaRef<jobject>&, bool) = &RunCallbackAndroid;
+ // TODO(https://crbug.com/692591) Should use base::BindOnce, but
+ // AddChildStatusReceivedCallback won't yet accept a BindOnce.
+ service->AddChildStatusReceivedCallback(
+ base::Bind(runCallback, ScopedJavaGlobalRef<jobject>(callback), true));
+}

Powered by Google App Engine
This is Rietveld 408576698