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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/supervised_user/child_accounts/child_account_service_an droid.h" 5 #include "chrome/browser/supervised_user/child_accounts/child_account_service_an droid.h"
6 6
7 #include "base/bind.h"
8
7 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
9 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" 11 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h"
12 #include "chrome/browser/supervised_user/child_accounts/child_account_service_fa ctory.h"
10 #include "jni/ChildAccountService_jni.h" 13 #include "jni/ChildAccountService_jni.h"
11 14
12 using base::android::JavaParamRef; 15 using base::android::JavaParamRef;
16 using base::android::ScopedJavaGlobalRef;
13 17
14 jboolean IsChildAccount(JNIEnv* env, const JavaParamRef<jclass>& jcaller) { 18 jboolean IsChildAccount(JNIEnv* env, const JavaParamRef<jclass>& jcaller) {
15 ProfileManager* profile_manager = g_browser_process->profile_manager(); 19 ProfileManager* profile_manager = g_browser_process->profile_manager();
16 return profile_manager->GetLastUsedProfile()->IsChild(); 20 return profile_manager->GetLastUsedProfile()->IsChild();
17 } 21 }
18 22
19 bool RegisterChildAccountService(JNIEnv* env) { 23 bool RegisterChildAccountService(JNIEnv* env) {
20 return RegisterNativesImpl(env); 24 return RegisterNativesImpl(env);
21 } 25 }
26
27 void ListenForChildStatusReceived(JNIEnv* env,
28 const JavaParamRef<jclass>& jcaller,
29 const JavaParamRef<jobject>& callback) {
30 ProfileManager* profile_manager = g_browser_process->profile_manager();
31 ChildAccountService* service = ChildAccountServiceFactory::GetForProfile(
32 profile_manager->GetLastUsedProfile());
33 service->AddChildStatusReceivedCallback(
34 base::Bind(&Java_ChildAccountService_childStatusReceived, env,
Bernhard Bauer 2017/02/15 15:09:38 Don't hold on to the JNIEnv* by binding it into th
aberent 2017/02/15 18:34:46 Actually switched to binding RunCallbackAndroid, w
35 ScopedJavaGlobalRef<jobject>(callback)));
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698