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.mozilla.gecko.util.HardwareUtils; michael@0: import org.mozilla.gecko.util.ThreadUtils; michael@0: import org.mozilla.gecko.prompts.PromptService; michael@0: michael@0: import android.app.Activity; michael@0: import android.content.Context; michael@0: import android.graphics.RectF; michael@0: import android.hardware.SensorEventListener; michael@0: import android.location.LocationListener; michael@0: import android.os.Build; michael@0: import android.view.View; michael@0: import android.view.Window; michael@0: import android.view.WindowManager; michael@0: import android.widget.AbsoluteLayout; michael@0: michael@0: public class BaseGeckoInterface implements GeckoAppShell.GeckoInterface { michael@0: // Bug 908744: Implement GeckoEventListener michael@0: // Bug 908752: Implement SensorEventListener michael@0: // Bug 908755: Implement LocationListener michael@0: // Bug 908756: Implement Tabs.OnTabsChangedListener michael@0: // Bug 908760: Implement GeckoEventResponder michael@0: michael@0: private Context mContext; michael@0: private GeckoProfile mProfile; michael@0: michael@0: public BaseGeckoInterface(Context context) { michael@0: mContext = context; michael@0: } michael@0: michael@0: public GeckoProfile getProfile() { michael@0: // Fall back to default profile if we didn't load a specific one michael@0: if (mProfile == null) { michael@0: mProfile = GeckoProfile.get(mContext); michael@0: } michael@0: return mProfile; michael@0: } michael@0: michael@0: // Bug 908770: Implement this michael@0: public PromptService getPromptService() { michael@0: return null; michael@0: } michael@0: michael@0: public Activity getActivity() { michael@0: return (Activity)mContext; michael@0: } michael@0: michael@0: public String getDefaultUAString() { michael@0: return HardwareUtils.isTablet() ? AppConstants.USER_AGENT_FENNEC_TABLET : michael@0: AppConstants.USER_AGENT_FENNEC_MOBILE; michael@0: } michael@0: michael@0: // Bug 908772: Implement this michael@0: public LocationListener getLocationListener() { michael@0: return null; michael@0: } michael@0: michael@0: // Bug 908773: Implement this michael@0: public SensorEventListener getSensorEventListener() { michael@0: return null; michael@0: } michael@0: michael@0: // Bug 908775: Implement this michael@0: public void doRestart() {} michael@0: michael@0: public void setFullScreen(final boolean fullscreen) { michael@0: ThreadUtils.postToUiThread(new Runnable() { michael@0: @Override michael@0: public void run() { michael@0: // Hide/show the system notification bar michael@0: Window window = ((Activity)mContext).getWindow(); michael@0: window.setFlags(fullscreen ? michael@0: WindowManager.LayoutParams.FLAG_FULLSCREEN : 0, michael@0: WindowManager.LayoutParams.FLAG_FULLSCREEN); michael@0: michael@0: if (Build.VERSION.SDK_INT >= 11) michael@0: window.getDecorView().setSystemUiVisibility(fullscreen ? 1 : 0); michael@0: } michael@0: }); michael@0: } michael@0: michael@0: // Bug 908779: Implement this michael@0: public void addPluginView(final View view, final RectF rect, final boolean isFullScreen) {} michael@0: michael@0: // Bug 908781: Implement this michael@0: public void removePluginView(final View view, final boolean isFullScreen) {} michael@0: michael@0: // Bug 908783: Implement this michael@0: public void enableCameraView() {} michael@0: michael@0: // Bug 908785: Implement this michael@0: public void disableCameraView() {} michael@0: michael@0: // Bug 908786: Implement this michael@0: public void addAppStateListener(GeckoAppShell.AppStateListener listener) {} michael@0: michael@0: // Bug 908787: Implement this michael@0: public void removeAppStateListener(GeckoAppShell.AppStateListener listener) {} michael@0: michael@0: // Bug 908788: Implement this michael@0: public View getCameraView() { michael@0: return null; michael@0: } michael@0: michael@0: // Bug 908789: Implement this michael@0: public void notifyWakeLockChanged(String topic, String state) {} michael@0: michael@0: // Bug 908790: Implement this michael@0: public FormAssistPopup getFormAssistPopup() { michael@0: return null; michael@0: } michael@0: michael@0: public boolean areTabsShown() { michael@0: return false; michael@0: } michael@0: michael@0: // Bug 908791: Implement this michael@0: public AbsoluteLayout getPluginContainer() { michael@0: return null; michael@0: } michael@0: michael@0: public void notifyCheckUpdateResult(String result) { michael@0: GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Update:CheckResult", result)); michael@0: } michael@0: michael@0: public boolean hasTabsSideBar() { michael@0: return false; michael@0: } michael@0: michael@0: // Bug 908792: Implement this michael@0: public void invalidateOptionsMenu() {} michael@0: }