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

Unified Diff: chrome/browser/profiles/profile_android.cc

Issue 556083004: Add hooks to get incognito profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix style Created 6 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
Index: chrome/browser/profiles/profile_android.cc
diff --git a/chrome/browser/profiles/profile_android.cc b/chrome/browser/profiles/profile_android.cc
index 0496675c2e0219ca1465a71a5121f4425a370b82..47c55f204efc49f1086c8bca118fe2a17d9285e6 100644
--- a/chrome/browser/profiles/profile_android.cc
+++ b/chrome/browser/profiles/profile_android.cc
@@ -63,6 +63,35 @@ jobject ProfileAndroid::GetLastUsedProfile(JNIEnv* env, jclass clazz) {
return profile_android->obj_.obj();
}
+base::android::ScopedJavaLocalRef<jobject>
+ProfileAndroid::GetOffTheRecordProfile(JNIEnv* env, jobject obj) {
+ Profile* profile = ProfileManager::GetPrimaryUserProfile();
Ted C 2014/09/10 17:08:10 This shouldn't be using this anymore. It should b
Maria 2014/09/10 17:17:54 Done.
+ if (!profile) {
+ NOTREACHED() << "Profile not found.";
+ return base::android::ScopedJavaLocalRef<jobject>();
+ }
+
+ Profile* otr_profile = profile->GetOffTheRecordProfile();
+ DCHECK(otr_profile);
+
+ ProfileAndroid* profile_android = ProfileAndroid::FromProfile(otr_profile);
+ if (!profile_android) {
+ NOTREACHED() << "ProfileAndroid not found.";
+ return base::android::ScopedJavaLocalRef<jobject>();
+ }
+ return profile_android->GetJavaObject();
+}
+
+jboolean ProfileAndroid::HasOffTheRecordProfile(JNIEnv* env, jobject obj) {
+ Profile* profile = ProfileManager::GetPrimaryUserProfile();
+ if (!profile) {
+ NOTREACHED() << "Profile not found.";
+ return false;
+ }
+
+ return profile->HasOffTheRecordProfile();
Ted C 2014/09/10 17:08:10 and this should be profile_->HasOffTheRecordProfil
Maria 2014/09/10 17:17:54 Done.
+}
+
// static
jobject GetLastUsedProfile(JNIEnv* env, jclass clazz) {
return ProfileAndroid::GetLastUsedProfile(env, clazz);
@@ -74,7 +103,6 @@ ProfileAndroid::ProfileAndroid(Profile* profile)
base::android::ScopedJavaLocalRef<jobject> jprofile =
Java_Profile_create(env, reinterpret_cast<intptr_t>(this));
obj_.Reset(env, jprofile.obj());
-
}
ProfileAndroid::~ProfileAndroid() {

Powered by Google App Engine
This is Rietveld 408576698