All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.phloc.web.useragent.browser.EWebFeature Maven / Gradle / Ivy

/**
 * Copyright (C) 2006-2015 phloc systems
 * http://www.phloc.com
 * office[at]phloc[dot]com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.phloc.web.useragent.browser;

import javax.annotation.Nonnull;

import com.phloc.commons.version.Version;

/**
 * Web feature detection based on user interface
 * 
 * @author Philip Helger
 */
public enum EWebFeature
{
  INLINE_IMAGES
  {
    @Override
    public boolean isSupported (@Nonnull final BrowserInfo aBI)
    {
      switch (aBI.getBrowserType ())
      {
        case OPERA:
          return aBI.getVersion ().isGreaterOrEqualThan (V72);
        case FIREFOX:
        case CHROME:
        case GECKO:
        case SAFARI:
          return true;
        case IE:
          return aBI.getVersion ().isGreaterOrEqualThan (V80);
        default:
          return false;
      }
    }
  };

  public static final Version V72 = new Version (7, 2);
  public static final Version V80 = new Version (8);

  /**
   * Check if this feature is supported on the current browser.
   * 
   * @param aBI
   *        Thr browser information to use
   * @return true if it is supported, false otherwise.
   */
  public abstract boolean isSupported (@Nonnull BrowserInfo aBI);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy