michael@0: /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko; michael@0: michael@0: import org.json.JSONException; michael@0: import org.json.JSONObject; michael@0: michael@0: public final class ZoomConstraints { michael@0: private final boolean mAllowZoom; michael@0: private final boolean mAllowDoubleTapZoom; michael@0: private final float mDefaultZoom; michael@0: private final float mMinZoom; michael@0: private final float mMaxZoom; michael@0: michael@0: public ZoomConstraints(boolean allowZoom) { michael@0: mAllowZoom = allowZoom; michael@0: mAllowDoubleTapZoom = allowZoom; michael@0: mDefaultZoom = 0.0f; michael@0: mMinZoom = 0.0f; michael@0: mMaxZoom = 0.0f; michael@0: } michael@0: michael@0: ZoomConstraints(JSONObject message) throws JSONException { michael@0: mAllowZoom = message.getBoolean("allowZoom"); michael@0: mAllowDoubleTapZoom = message.getBoolean("allowDoubleTapZoom"); michael@0: mDefaultZoom = (float)message.getDouble("defaultZoom"); michael@0: mMinZoom = (float)message.getDouble("minZoom"); michael@0: mMaxZoom = (float)message.getDouble("maxZoom"); michael@0: } michael@0: michael@0: public final boolean getAllowZoom() { michael@0: return mAllowZoom; michael@0: } michael@0: michael@0: public final boolean getAllowDoubleTapZoom() { michael@0: return mAllowDoubleTapZoom; michael@0: } michael@0: michael@0: public final float getDefaultZoom() { michael@0: return mDefaultZoom; michael@0: } michael@0: michael@0: public final float getMinZoom() { michael@0: return mMinZoom; michael@0: } michael@0: michael@0: public final float getMaxZoom() { michael@0: return mMaxZoom; michael@0: } michael@0: }