1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.customtabs;
import android.net.Uri;
import android.os.Bundle;
import android.support.customtabs.CustomTabsService;
import android.support.customtabs.CustomTabsSessionToken;
import android.util.Log;
import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.GeckoService;
import java.util.List;
/**
* Custom tabs service external, third-party apps connect to.
*/
public class GeckoCustomTabsService extends CustomTabsService {
private static final String LOGTAG = "GeckoCustomTabsService";
private static final boolean DEBUG = false;
@Override
protected boolean updateVisuals(CustomTabsSessionToken sessionToken, Bundle bundle) {
Log.v(LOGTAG, "updateVisuals()");
return false;
}
@Override
protected boolean warmup(long flags) {
if (DEBUG) {
Log.v(LOGTAG, "warming up...");
}
GeckoService.startGecko(GeckoProfile.initFromArgs(this, null), null, getApplicationContext());
return true;
}
@Override
protected boolean newSession(CustomTabsSessionToken sessionToken) {
Log.v(LOGTAG, "newSession()");
// Pretend session has been started
return true;
}
@Override
protected boolean mayLaunchUrl(CustomTabsSessionToken sessionToken, Uri uri, Bundle bundle, List<Bundle> list) {
Log.v(LOGTAG, "mayLaunchUrl()");
return false;
}
@Override
protected Bundle extraCommand(String commandName, Bundle bundle) {
Log.v(LOGTAG, "extraCommand()");
return null;
}
}
|