OLD | NEW |
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 "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
9 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" | 9 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" |
10 #include "chrome/browser/supervised_user/child_accounts/child_account_service_fa
ctory.h" | 10 #include "chrome/browser/supervised_user/child_accounts/child_account_service_fa
ctory.h" |
11 #include "jni/ChildAccountService_jni.h" | 11 #include "jni/ChildAccountService_jni.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 bool g_is_child_account = false; | 15 bool g_is_child_account = false; |
16 bool g_has_child_account_status = false; | 16 bool g_has_child_account_status = false; |
17 | 17 |
18 } // namespace | 18 } // namespace |
19 | 19 |
20 jboolean IsChildAccountDetectionEnabled(JNIEnv* env, jobject obj) { | 20 jboolean IsChildAccountDetectionEnabled(JNIEnv* env, |
| 21 const JavaParamRef<jobject>& obj) { |
21 return ChildAccountService::IsChildAccountDetectionEnabled(); | 22 return ChildAccountService::IsChildAccountDetectionEnabled(); |
22 } | 23 } |
23 | 24 |
24 jboolean GetIsChildAccount(JNIEnv* env, jobject obj) { | 25 jboolean GetIsChildAccount(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
25 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 26 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
26 return profile_manager->GetLastUsedProfile()->IsChild(); | 27 return profile_manager->GetLastUsedProfile()->IsChild(); |
27 } | 28 } |
28 | 29 |
29 void SetIsChildAccount(JNIEnv* env, jobject obj, jboolean is_child) { | 30 void SetIsChildAccount(JNIEnv* env, |
| 31 const JavaParamRef<jobject>& obj, |
| 32 jboolean is_child) { |
30 VLOG(1) << "OnChildAccountSigninComplete"; | 33 VLOG(1) << "OnChildAccountSigninComplete"; |
31 | 34 |
32 // If the browser process has not been created yet, store the child account | 35 // If the browser process has not been created yet, store the child account |
33 // status and return it later in GetJavaChildAccountStatus(). | 36 // status and return it later in GetJavaChildAccountStatus(). |
34 if (!g_browser_process) { | 37 if (!g_browser_process) { |
35 g_has_child_account_status = true; | 38 g_has_child_account_status = true; |
36 g_is_child_account = is_child; | 39 g_is_child_account = is_child; |
37 return; | 40 return; |
38 } | 41 } |
39 | 42 |
(...skipping 13 matching lines...) Expand all Loading... |
53 } | 56 } |
54 | 57 |
55 void ChildStatusInvalidationReceived() { | 58 void ChildStatusInvalidationReceived() { |
56 JNIEnv* env = base::android::AttachCurrentThread(); | 59 JNIEnv* env = base::android::AttachCurrentThread(); |
57 Java_ChildAccountService_onInvalidationReceived(env); | 60 Java_ChildAccountService_onInvalidationReceived(env); |
58 } | 61 } |
59 | 62 |
60 bool RegisterChildAccountService(JNIEnv* env) { | 63 bool RegisterChildAccountService(JNIEnv* env) { |
61 return RegisterNativesImpl(env); | 64 return RegisterNativesImpl(env); |
62 } | 65 } |
OLD | NEW |