private void cascadeNewBestCookie(CookieType newBestCookieType) { CookieStates states = getCookieStates(); CookieState restoredFromState = restoredFromState(newBestCookieType); CookieState replacedFromState = replacedFromOlderState(newBestCookieType); // Terminology: // restored: means the cookie had no valid previous value // replaced: means the cookie had a valid previous value that was replaced // for (CookieType otherType : CookieType.values()) { CookieState otherState = states.get(otherType); if (otherType == newBestCookieType || otherState == null) { continue; } if (otherType == ETAG && otherState != RESET) { states.setEtagState(LINKED_BUT_NOT_SYNCED); continue; } switch (otherState) { case EXISTING: case REPLACED_BY_OLDER_SILVERLIGHT_COOKIE: case REPLACED_BY_OLDER_FLASH_COOKIE: case REPLACED_BY_OLDER_WEB_STORAGE_COOKIE: case REPLACED_BY_OLDER_PLAIN_COOKIE: case REPLACED_BY_OLDER_ETAG_COOKIE: states.set(otherType, replacedFromState); break; case NEW: case RESTORED_FROM_SILVERLIGHT_COOKIE: case RESTORED_FROM_FLASH_COOKIE: case RESTORED_FROM_WEB_STORAGE_COOKIE: case RESTORED_FROM_PLAIN_COOKIE: case RESTORED_FROM_ETAG_COOKIE: states.set(otherType, restoredFromState); break; } } }