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

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

Issue 1367783002: Revert of ChildAccountService[Java] delegates everything to native side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@child
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/supervised_user/child_accounts/child_account_service_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6d23de999736313b181786686fc0aa36c40424be..6abbec98d9efb835953863ab865b5637e145c6ad 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
@@ -7,16 +7,57 @@
#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"
+namespace {
+
+bool g_is_child_account = false;
+bool g_has_child_account_status = false;
+
+} // namespace
+
jboolean IsChildAccountDetectionEnabled(JNIEnv* env,
- const JavaParamRef<jclass>& jcaller) {
+ const JavaParamRef<jobject>& obj) {
return ChildAccountService::IsChildAccountDetectionEnabled();
}
-jboolean IsChildAccount(JNIEnv* env, const JavaParamRef<jclass>& jcaller) {
+jboolean GetIsChildAccount(JNIEnv* env, const JavaParamRef<jobject>& obj) {
ProfileManager* profile_manager = g_browser_process->profile_manager();
return profile_manager->GetLastUsedProfile()->IsChild();
+}
+
+void SetIsChildAccount(JNIEnv* env,
+ const JavaParamRef<jobject>& obj,
+ jboolean is_child) {
+ VLOG(1) << "OnChildAccountSigninComplete";
+
+ // If the browser process has not been created yet, store the child account
+ // status and return it later in GetJavaChildAccountStatus().
+ if (!g_browser_process) {
+ g_has_child_account_status = true;
+ g_is_child_account = is_child;
+ return;
+ }
+
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ Profile* profile = profile_manager->GetLastUsedProfile();
+ ChildAccountServiceFactory::GetForProfile(profile)
+ ->SetIsChildAccount(is_child);
+}
+
+bool GetJavaChildAccountStatus(bool* is_child_account) {
+ if (!g_has_child_account_status)
+ return false;
+
+ *is_child_account = g_is_child_account;
+ g_has_child_account_status = false;
+ return true;
+}
+
+void ChildStatusInvalidationReceived() {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ Java_ChildAccountService_onInvalidationReceived(env);
}
bool RegisterChildAccountService(JNIEnv* env) {
« no previous file with comments | « chrome/browser/supervised_user/child_accounts/child_account_service_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698