File tree 1 file changed +13
-3
lines changed
android/java/org/chromium/chrome/browser/crypto_wallet/util
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -1104,6 +1104,7 @@ public static Spanned geteTldSpanned(OriginInfo originInfo) {
1104
1104
return AndroidUtils .formatHTML (geteTldHtmlString (originInfo ));
1105
1105
}
1106
1106
1107
+ @ Nullable
1107
1108
public static Profile getProfile (boolean isIncognito ) {
1108
1109
ChromeActivity chromeActivity = null ;
1109
1110
try {
@@ -1115,23 +1116,32 @@ public static Profile getProfile(boolean isIncognito) {
1115
1116
chromeActivity = BraveActivity .getChromeTabbedActivity ();
1116
1117
}
1117
1118
if (chromeActivity == null ) {
1118
- return ProfileManager . getLastUsedRegularProfile ( ); // Last resort
1119
+ return getLastUsedProfile ( isIncognito ); // Last resort
1119
1120
}
1120
1121
1121
1122
ObservableSupplier <TabModelSelector > supplier =
1122
1123
chromeActivity .getTabModelSelectorSupplier ();
1123
1124
TabModelSelector selector = supplier .get ();
1124
1125
if (selector == null ) {
1125
- return ProfileManager . getLastUsedRegularProfile ( );
1126
+ return getLastUsedProfile ( isIncognito );
1126
1127
}
1127
1128
1128
1129
Profile profile = selector .getModel (isIncognito ).getProfile ();
1129
1130
if (profile == null ) {
1130
- return ProfileManager . getLastUsedRegularProfile ( );
1131
+ return getLastUsedProfile ( isIncognito );
1131
1132
}
1132
1133
return profile ;
1133
1134
}
1134
1135
1136
+ @ Nullable
1137
+ private static Profile getLastUsedProfile (boolean isIncognito ) {
1138
+ if (!isIncognito ) {
1139
+ return ProfileManager .getLastUsedRegularProfile ();
1140
+ } else {
1141
+ return ProfileManager .getLastUsedRegularProfile ().getPrimaryOtrProfile (true );
1142
+ }
1143
+ }
1144
+
1135
1145
public static String formatErc721TokenTitle (String title , String id ) {
1136
1146
if (id .isEmpty () || id .equals ("0" )) {
1137
1147
return title ;
You can’t perform that action at this time.
0 commit comments