mobile/android/base/BaseGeckoInterface.java

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
     2  * This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 package org.mozilla.gecko;
     8 import org.mozilla.gecko.util.HardwareUtils;
     9 import org.mozilla.gecko.util.ThreadUtils;
    10 import org.mozilla.gecko.prompts.PromptService;
    12 import android.app.Activity;
    13 import android.content.Context;
    14 import android.graphics.RectF;
    15 import android.hardware.SensorEventListener;
    16 import android.location.LocationListener;
    17 import android.os.Build;
    18 import android.view.View;
    19 import android.view.Window;
    20 import android.view.WindowManager;
    21 import android.widget.AbsoluteLayout;
    23 public class BaseGeckoInterface implements GeckoAppShell.GeckoInterface {
    24     // Bug 908744: Implement GeckoEventListener
    25     // Bug 908752: Implement SensorEventListener
    26     // Bug 908755: Implement LocationListener
    27     // Bug 908756: Implement Tabs.OnTabsChangedListener
    28     // Bug 908760: Implement GeckoEventResponder
    30     private Context mContext;
    31     private GeckoProfile mProfile;
    33     public BaseGeckoInterface(Context context) {
    34         mContext = context;
    35     }
    37     public GeckoProfile getProfile() {
    38         // Fall back to default profile if we didn't load a specific one
    39         if (mProfile == null) {
    40             mProfile = GeckoProfile.get(mContext);
    41         }
    42         return mProfile;
    43     }
    45     // Bug 908770: Implement this
    46     public PromptService getPromptService() {
    47         return null;
    48     }
    50     public Activity getActivity() {
    51         return (Activity)mContext;
    52     }
    54     public String getDefaultUAString() {
    55         return HardwareUtils.isTablet() ? AppConstants.USER_AGENT_FENNEC_TABLET :
    56                                           AppConstants.USER_AGENT_FENNEC_MOBILE;
    57     }
    59     // Bug 908772: Implement this
    60     public LocationListener getLocationListener() {
    61         return null;
    62     }
    64     // Bug 908773: Implement this
    65     public SensorEventListener getSensorEventListener() {
    66         return null;
    67     }
    69     // Bug 908775: Implement this
    70     public void doRestart() {}
    72     public void setFullScreen(final boolean fullscreen) {
    73         ThreadUtils.postToUiThread(new Runnable() {
    74             @Override
    75             public void run() {
    76                 // Hide/show the system notification bar
    77                 Window window = ((Activity)mContext).getWindow();
    78                 window.setFlags(fullscreen ?
    79                                 WindowManager.LayoutParams.FLAG_FULLSCREEN : 0,
    80                                 WindowManager.LayoutParams.FLAG_FULLSCREEN);
    82                 if (Build.VERSION.SDK_INT >= 11)
    83                     window.getDecorView().setSystemUiVisibility(fullscreen ? 1 : 0);
    84             }
    85         });
    86     }
    88     // Bug 908779: Implement this
    89     public void addPluginView(final View view, final RectF rect, final boolean isFullScreen) {}
    91     // Bug 908781: Implement this
    92     public void removePluginView(final View view, final boolean isFullScreen) {}
    94     // Bug 908783: Implement this
    95     public void enableCameraView() {}
    97     // Bug 908785: Implement this
    98     public void disableCameraView() {}
   100     // Bug 908786: Implement this
   101     public void addAppStateListener(GeckoAppShell.AppStateListener listener) {}
   103     // Bug 908787: Implement this
   104     public void removeAppStateListener(GeckoAppShell.AppStateListener listener) {}
   106     // Bug 908788: Implement this
   107     public View getCameraView() {
   108         return null;
   109     }
   111     // Bug 908789: Implement this
   112     public void notifyWakeLockChanged(String topic, String state) {}
   114     // Bug 908790: Implement this
   115     public FormAssistPopup getFormAssistPopup() {
   116         return null;
   117     }
   119     public boolean areTabsShown() {
   120         return false;
   121     }
   123     // Bug 908791: Implement this
   124     public AbsoluteLayout getPluginContainer() {
   125         return null;
   126     }
   128     public void notifyCheckUpdateResult(String result) {
   129         GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Update:CheckResult", result));
   130     }
   132     public boolean hasTabsSideBar() {
   133         return false;
   134     }
   136     // Bug 908792: Implement this
   137     public void invalidateOptionsMenu() {}
   138 }

mercurial