package defpackage; import J.N; import java.util.Collections; import org.chromium.base.Callback; import org.chromium.chrome.browser.profiles.Profile; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /* renamed from: Hl1 reason: default package and case insensitive filesystem */ /* compiled from: chromium-ChromePublic.apk-stable-447210115 */ public class C0488Hl1 implements AbstractC5981yl1 { @Override // defpackage.AbstractC5981yl1 public void a(C0017Af1 af1, Callback callback) { try { for (C6137zf1 zf1 : af1.a) { if (zf1.E) { ((C0165Cl1) callback).onResult(new C6155zl1(Collections.emptyList(), af1)); return; } } N.MiPC31k4(Profile.c(), "https://memex-pa.googleapis.com/v1/suggestions", "POST", "application/json; charset=UTF-8", b(af1), 10000, new String[0], new C0424Gl1(this, callback, af1)); } catch (JSONException e) { StringBuilder a = AbstractC5933yT0.a("There was a problem parsing the JSON"); a.append(e.getMessage()); AbstractC5452vj0.a("TSSF", a.toString(), new Object[0]); ((C0165Cl1) callback).onResult(new C6155zl1(Collections.emptyList(), af1)); } } public String b(C0017Af1 af1) { JSONObject jSONObject = new JSONObject(); JSONObject jSONObject2 = new JSONObject(); JSONArray jSONArray = new JSONArray(); for (C6137zf1 zf1 : af1.a) { JSONObject jSONObject3 = new JSONObject(); jSONObject3.put("id", zf1.B); jSONObject3.put("url", zf1.y); jSONObject3.put("title", zf1.C); jSONObject3.put("timestamp", zf1.A); String str = zf1.z; if (str != null) { jSONObject3.put("referrer", str); } jSONArray.put(jSONObject3); } return jSONObject.put("tabContext", jSONObject2.put("tabs", jSONArray)).toString(); } @Override // defpackage.AbstractC5981yl1 public boolean isEnabled() { if (!X60.a().b(Profile.c()).b() || !N.M6bsIDpc("CloseTabSuggestions", "server_fetcher_enabled", false) || !Gm1.g()) { return false; } return true; } }