Commit 7ab08ad4 authored by Side Yilmaz's avatar Side Yilmaz Committed by Commit Bot

Update ChildAccountFeedbackReporter to use incognito profile when called

incognito.

|Profile#getLastUsedProfile| is deprecated and replaced with
|Profile#getLastUsedRegularProfile|. This CL updates
ChildAccountFeedbackReporter class.

This CL passes profile (i.e., regular or off-the-record profile) object
to FeedbackCollector, while the profile always regular
profile in current usage. This CL changes the behaviour of code to
make it run with correct profile.

Bug: 1041781
Change-Id: I3ef75d4250044e81c583868e399598a5f48a988f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2066538
Commit-Queue: Side YILMAZ <sideyilmaz@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarRamin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743510}
parent 65aec416
...@@ -20,21 +20,22 @@ import org.chromium.ui.base.WindowAndroid; ...@@ -20,21 +20,22 @@ import org.chromium.ui.base.WindowAndroid;
public final class ChildAccountFeedbackReporter { public final class ChildAccountFeedbackReporter {
private static FeedbackReporter sFeedbackReporter; private static FeedbackReporter sFeedbackReporter;
public static void reportFeedback(Activity activity, String description, String url) { public static void reportFeedback(
Activity activity, String description, String url, Profile profile) {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
if (sFeedbackReporter == null) { if (sFeedbackReporter == null) {
sFeedbackReporter = AppHooks.get().createFeedbackReporter(); sFeedbackReporter = AppHooks.get().createFeedbackReporter();
} }
new FeedbackCollector(activity, Profile.getLastUsedProfile(), url, null /* categoryTag */, new FeedbackCollector(activity, profile, url, null /* categoryTag */, description, null,
description, null, true /* takeScreenshot */, null /* feed context */, true /* takeScreenshot */, null /* feed context */,
collector -> { sFeedbackReporter.reportFeedback(collector); }); collector -> { sFeedbackReporter.reportFeedback(collector); });
} }
@CalledByNative @CalledByNative
public static void reportFeedbackWithWindow( public static void reportFeedbackWithWindow(
WindowAndroid window, String description, String url) { WindowAndroid window, String description, String url, Profile profile) {
reportFeedback(window.getActivity().get(), description, url); reportFeedback(window.getActivity().get(), description, url, profile);
} }
private ChildAccountFeedbackReporter() {} private ChildAccountFeedbackReporter() {}
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "base/android/jni_string.h" #include "base/android/jni_string.h"
#include "chrome/android/chrome_jni_headers/ChildAccountFeedbackReporter_jni.h" #include "chrome/android/chrome_jni_headers/ChildAccountFeedbackReporter_jni.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_android.h"
#include "chrome/browser/ui/android/view_android_helper.h" #include "chrome/browser/ui/android/view_android_helper.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "ui/android/view_android.h" #include "ui/android/view_android.h"
...@@ -28,6 +30,10 @@ void ReportChildAccountFeedback(content::WebContents* web_contents, ...@@ -28,6 +30,10 @@ void ReportChildAccountFeedback(content::WebContents* web_contents,
base::android::ConvertUTF8ToJavaString(env, description); base::android::ConvertUTF8ToJavaString(env, description);
ScopedJavaLocalRef<jstring> jurl = ScopedJavaLocalRef<jstring> jurl =
base::android::ConvertUTF8ToJavaString(env, url.spec()); base::android::ConvertUTF8ToJavaString(env, url.spec());
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
ProfileAndroid* profile_android = ProfileAndroid::FromProfile(profile);
ScopedJavaLocalRef<jobject> jprofile = profile_android->GetJavaObject();
Java_ChildAccountFeedbackReporter_reportFeedbackWithWindow( Java_ChildAccountFeedbackReporter_reportFeedbackWithWindow(
env, window->GetJavaObject(), jdesc, jurl); env, window->GetJavaObject(), jdesc, jurl, jprofile);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment