mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 05:45:33 +00:00
Bug 1252650 - Add a 'data' parameter to GeckoThread.createServices. r=kit
This commit is contained in:
parent
6b215d4b0f
commit
b3a61c24e3
@ -31,6 +31,7 @@ public class GeckoService extends Service {
|
||||
private static final String INTENT_ACTION_CREATE_SERVICES = "create-services";
|
||||
|
||||
private static final String INTENT_SERVICE_CATEGORY = "category";
|
||||
private static final String INTENT_SERVICE_DATA = "data";
|
||||
|
||||
private static class EventListener implements NativeEventListener {
|
||||
@Override // NativeEventListener
|
||||
@ -120,6 +121,13 @@ public class GeckoService extends Service {
|
||||
return intent;
|
||||
}
|
||||
|
||||
public static Intent getIntentToCreateServices(final Context context, final String category, final String data) {
|
||||
final Intent intent = getIntentForAction(context, INTENT_ACTION_CREATE_SERVICES);
|
||||
intent.putExtra(INTENT_SERVICE_CATEGORY, category);
|
||||
intent.putExtra(INTENT_SERVICE_DATA, data);
|
||||
return intent;
|
||||
}
|
||||
|
||||
public static Intent getIntentToCreateServices(final Context context, final String category) {
|
||||
final Intent intent = getIntentForAction(context, INTENT_ACTION_CREATE_SERVICES);
|
||||
intent.putExtra(INTENT_SERVICE_CATEGORY, category);
|
||||
@ -168,11 +176,12 @@ public class GeckoService extends Service {
|
||||
|
||||
case INTENT_ACTION_CREATE_SERVICES:
|
||||
final String category = intent.getStringExtra(INTENT_SERVICE_CATEGORY);
|
||||
final String data = intent.getStringExtra(INTENT_SERVICE_DATA);
|
||||
|
||||
if (category == null) {
|
||||
break;
|
||||
}
|
||||
GeckoThread.createServices(category);
|
||||
GeckoThread.createServices(category, data);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -658,14 +658,14 @@ public class GeckoThread extends Thread {
|
||||
}
|
||||
|
||||
@WrapForJNI(stubName = "CreateServices")
|
||||
private static native void nativeCreateServices(String category);
|
||||
private static native void nativeCreateServices(String category, String data);
|
||||
|
||||
public static void createServices(final String category) {
|
||||
public static void createServices(final String category, final String data) {
|
||||
if (isStateAtLeast(State.PROFILE_READY)) {
|
||||
nativeCreateServices(category);
|
||||
nativeCreateServices(category, data);
|
||||
} else {
|
||||
queueNativeCallUntil(State.PROFILE_READY, GeckoThread.class, "nativeCreateServices",
|
||||
String.class, category);
|
||||
String.class, category, String.class, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2239,10 +2239,11 @@ public:
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
mozilla::jni::String::Param,
|
||||
mozilla::jni::String::Param> Args;
|
||||
static constexpr char name[] = "nativeCreateServices";
|
||||
static constexpr char signature[] =
|
||||
"(Ljava/lang/String;)V";
|
||||
"(Ljava/lang/String;Ljava/lang/String;)V";
|
||||
static const bool isStatic = true;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
|
@ -260,12 +260,15 @@ public:
|
||||
obsServ->NotifyObservers(nullptr, "application-foreground", nullptr);
|
||||
}
|
||||
|
||||
static void CreateServices(jni::String::Param aCategory)
|
||||
static void CreateServices(jni::String::Param aCategory, jni::String::Param aData)
|
||||
{
|
||||
nsCString category(aCategory->ToCString());
|
||||
|
||||
NS_CreateServicesFromCategory(
|
||||
category.get(), /* aOrigin */ nullptr, category.get());
|
||||
category.get(),
|
||||
nullptr, // aOrigin
|
||||
category.get(),
|
||||
aData ? aData->ToString().get() : nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user