package com.facebook;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import ῲ.㗽.K.C2243;

public class CustomTabActivity extends Activity {
    public static final String CUSTOM_TAB_REDIRECT_ACTION = (CustomTabActivity.class.getSimpleName() + ".action_customTabRedirect");
    public static final int CUSTOM_TAB_REDIRECT_REQUEST_CODE = 2;
    public static final String DESTROY_ACTION = (CustomTabActivity.class.getSimpleName() + ".action_destroy");
    public BroadcastReceiver closeReceiver;

    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i2 == 0) {
            Intent intent2 = new Intent(CUSTOM_TAB_REDIRECT_ACTION);
            intent2.putExtra(CustomTabMainActivity.EXTRA_URL, getIntent().getDataString());
            C2243.m5866(this).m5870(intent2);
            this.closeReceiver = new BroadcastReceiver() {
                /* class com.facebook.CustomTabActivity.AnonymousClass1 */

                public void onReceive(Context context, Intent intent) {
                    CustomTabActivity.this.finish();
                }
            };
            C2243.m5866(this).m5869(this.closeReceiver, new IntentFilter(DESTROY_ACTION));
        }
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        Intent intent = new Intent(this, CustomTabMainActivity.class);
        intent.setAction(CUSTOM_TAB_REDIRECT_ACTION);
        intent.putExtra(CustomTabMainActivity.EXTRA_URL, getIntent().getDataString());
        intent.addFlags(603979776);
        startActivityForResult(intent, 2);
    }

    public void onDestroy() {
        C2243.m5866(this).m5868(this.closeReceiver);
        super.onDestroy();
    }
}
