コード例 #1
0
ファイル: SiteIdentity.java プロジェクト: kilikkuo/gecko-dev
  void update(JSONObject identityData) {
    if (identityData == null) {
      reset();
      return;
    }

    try {
      JSONObject mode = identityData.getJSONObject("mode");

      try {
        mMixedModeDisplay = MixedMode.fromString(mode.getString("mixed_display"));
      } catch (Exception e) {
        mMixedModeDisplay = MixedMode.UNKNOWN;
      }

      try {
        mMixedModeActive = MixedMode.fromString(mode.getString("mixed_active"));
      } catch (Exception e) {
        mMixedModeActive = MixedMode.UNKNOWN;
      }

      try {
        mTrackingMode = TrackingMode.fromString(mode.getString("tracking"));
      } catch (Exception e) {
        mTrackingMode = TrackingMode.UNKNOWN;
      }

      try {
        mSecurityMode = SecurityMode.fromString(mode.getString("identity"));
      } catch (Exception e) {
        resetIdentity();
        return;
      }

      try {
        mOrigin = identityData.getString("origin");
        mHost = identityData.optString("host", null);
        mOwner = identityData.optString("owner", null);
        mSupplemental = identityData.optString("supplemental", null);
        mVerifier = identityData.optString("verifier", null);
        mSecure = identityData.optBoolean("secure", false);
      } catch (Exception e) {
        resetIdentity();
      }
    } catch (Exception e) {
      reset();
    }
  }
コード例 #2
0
ファイル: SiteIdentity.java プロジェクト: ShakoHo/gecko-dev
  void update(JSONObject identityData) {
    if (identityData == null) {
      reset();
      return;
    }

    try {
      JSONObject mode = identityData.getJSONObject("mode");

      try {
        mMixedMode = MixedMode.fromString(mode.getString("mixed"));
      } catch (Exception e) {
        mMixedMode = MixedMode.UNKNOWN;
      }

      try {
        mTrackingMode = TrackingMode.fromString(mode.getString("tracking"));
      } catch (Exception e) {
        mTrackingMode = TrackingMode.UNKNOWN;
      }

      try {
        mSecurityMode = SecurityMode.fromString(mode.getString("identity"));
      } catch (Exception e) {
        resetIdentity();
        return;
      }

      try {
        mOrigin = identityData.getString("origin");
        mHost = identityData.getString("host");
        mOwner = identityData.optString("owner", null);
        mSupplemental = identityData.optString("supplemental", null);
        mVerifier = identityData.getString("verifier");
        mEncrypted = identityData.optBoolean("encrypted", false);
      } catch (Exception e) {
        Log.e(LOGTAG, "Error fetching Site identity host info", e);
        resetIdentity();
      }
    } catch (Exception e) {
      reset();
    }
  }
コード例 #3
0
ファイル: SiteIdentity.java プロジェクト: ShakoHo/gecko-dev
 public void reset() {
   resetIdentity();
   mMixedMode = MixedMode.UNKNOWN;
   mTrackingMode = TrackingMode.UNKNOWN;
 }