зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1353185 - Open the passed-in URI in GeckoViewExample, if any r=jchen
MozReview-Commit-ID: Hv3IVuBvhw2
This commit is contained in:
Родитель
7de981c17f
Коммит
f3a9ed209e
|
@ -10,7 +10,7 @@
|
|||
windowtype="navigator:browser"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<browser id="content" type="content" primary="true" src="https://mozilla.com" flex="1" remote="true"/>
|
||||
<browser id="content" type="content" primary="true" src="about:blank" flex="1" remote="true"/>
|
||||
|
||||
<script type="application/javascript" src="chrome://geckoview/content/geckoview.js"/>
|
||||
</window>
|
||||
|
|
|
@ -11,8 +11,20 @@
|
|||
android:label="GeckoViewActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
<category android:name="android.intent.category.APP_BROWSER" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="about" />
|
||||
<data android:scheme="javascript" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ package org.mozilla.geckoview_example;
|
|||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
@ -21,6 +22,7 @@ import static org.mozilla.gecko.GeckoView.setGeckoInterface;
|
|||
|
||||
public class GeckoViewActivity extends Activity {
|
||||
private static final String LOGTAG = "GeckoViewActivity";
|
||||
private static final String DEFAULT_URL = "https://mozilla.org";
|
||||
|
||||
GeckoView mGeckoView;
|
||||
|
||||
|
@ -36,16 +38,18 @@ public class GeckoViewActivity extends Activity {
|
|||
mGeckoView.setChromeDelegate(new MyGeckoViewChrome());
|
||||
mGeckoView.setContentListener(new MyGeckoViewContent());
|
||||
mGeckoView.setProgressListener(new MyGeckoViewProgress());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
final GeckoProfile profile = GeckoProfile.get(getApplicationContext());
|
||||
|
||||
GeckoThread.initMainProcess(profile, /* args */ null, /* debugging */ false);
|
||||
GeckoThread.launch();
|
||||
|
||||
Uri u = getIntent().getData();
|
||||
if (u != null) {
|
||||
mGeckoView.loadUri(u.toString());
|
||||
} else {
|
||||
mGeckoView.loadUri(DEFAULT_URL);
|
||||
}
|
||||
}
|
||||
|
||||
private class MyGeckoViewChrome implements GeckoView.ChromeDelegate {
|
||||
|
|
Загрузка…
Ссылка в новой задаче