зеркало из https://github.com/mozilla/gecko-dev.git
Bug 794981 - Part 4: Consistently pass nsAString into the JNI methods, instead of the veritable smorgasbord of string types previously used. r=kats
This commit is contained in:
Родитель
0f3d6f1206
Коммит
25d707c796
|
@ -2775,7 +2775,7 @@ nsDownload::SetState(DownloadState aState)
|
|||
if (mimeInfo)
|
||||
mimeInfo->GetMIMEType(contentType);
|
||||
|
||||
mozilla::AndroidBridge::Bridge()->ScanMedia(path, contentType);
|
||||
mozilla::AndroidBridge::Bridge()->ScanMedia(path, NS_ConvertUTF8toUTF16(contentType));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIFile* aTarget,
|
|||
#endif
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
if (!aContentType.IsEmpty()) {
|
||||
mozilla::AndroidBridge::Bridge()->ScanMedia(path, aContentType);
|
||||
mozilla::AndroidBridge::Bridge()->ScanMedia(path, NS_ConvertUTF8toUTF16(aContentType));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ nsAndroidHandlerApp::LaunchWithURI(nsIURI *aURI, nsIInterfaceRequestor *aWindowC
|
|||
nsCString uriSpec;
|
||||
aURI->GetSpec(uriSpec);
|
||||
return mozilla::AndroidBridge::Bridge()->
|
||||
OpenUriExternal(uriSpec, mMimeType, mPackageName, mClassName, mAction) ?
|
||||
OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), NS_ConvertUTF8toUTF16(mMimeType), mPackageName, mClassName, mAction) ?
|
||||
NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ nsAndroidHandlerApp::Share(const nsAString & data, const nsAString & title)
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
return mozilla::AndroidBridge::Bridge()->
|
||||
OpenUriExternal(NS_ConvertUTF16toUTF8(data), mMimeType, mPackageName,
|
||||
OpenUriExternal(data, NS_ConvertUTF8toUTF16(mMimeType), mPackageName,
|
||||
mClassName, mAction) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ nsExternalSharingAppService::ShareWithDefault(const nsAString & data,
|
|||
const nsString emptyString = EmptyString();
|
||||
if (AndroidBridge::Bridge())
|
||||
return AndroidBridge::Bridge()->
|
||||
OpenUriExternal(NS_ConvertUTF16toUTF8(data), NS_ConvertUTF16toUTF8(mime),
|
||||
OpenUriExternal(data, mime,
|
||||
emptyString,emptyString, sendAction, title) ? NS_OK : NS_ERROR_FAILURE;
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -48,10 +48,9 @@ nsExternalSharingAppService::GetSharingApps(const nsAString & aMIMEType,
|
|||
NS_NAMED_LITERAL_STRING(sendAction, "android.intent.action.SEND");
|
||||
nsCOMPtr<nsIMutableArray> array = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ConvertUTF16toUTF8 nMimeType(aMIMEType);
|
||||
if (!AndroidBridge::Bridge())
|
||||
return NS_OK;
|
||||
AndroidBridge::Bridge()->GetHandlersForMimeType(nMimeType.get(), array,
|
||||
AndroidBridge::Bridge()->GetHandlersForMimeType(aMIMEType, array,
|
||||
nullptr, sendAction);
|
||||
array->GetLength(aLen);
|
||||
*aHandlers =
|
||||
|
|
|
@ -30,7 +30,7 @@ nsMIMEInfoAndroid::LoadUriInternal(nsIURI * aURI)
|
|||
|
||||
if (mozilla::AndroidBridge::Bridge())
|
||||
return mozilla::AndroidBridge::Bridge()->
|
||||
OpenUriExternal(uriSpec, (mType.Equals(uriScheme) || mType.Equals(uriSpec)) ? EmptyCString() : mType) ? NS_OK : NS_ERROR_FAILURE;
|
||||
OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), (mType.Equals(uriScheme) || mType.Equals(uriSpec)) ? EmptyString() : NS_ConvertUTF8toUTF16(mType)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ nsMIMEInfoAndroid::GetMimeInfoForMimeType(const nsACString& aMimeType,
|
|||
}
|
||||
|
||||
nsIHandlerApp* systemDefault = nullptr;
|
||||
bridge->GetHandlersForMimeType(nsAutoCString(aMimeType).get(),
|
||||
bridge->GetHandlersForMimeType(NS_ConvertUTF8toUTF16(aMimeType),
|
||||
info->mHandlerApps, &systemDefault);
|
||||
|
||||
if (systemDefault)
|
||||
|
@ -109,7 +109,7 @@ nsMIMEInfoAndroid::GetMimeInfoForURL(const nsACString &aURL,
|
|||
}
|
||||
|
||||
nsIHandlerApp* systemDefault = nullptr;
|
||||
bridge->GetHandlersForURL(nsAutoCString(aURL).get(),
|
||||
bridge->GetHandlersForURL(NS_ConvertUTF8toUTF16(aURL),
|
||||
mimeinfo->mHandlerApps, &systemDefault);
|
||||
|
||||
if (systemDefault)
|
||||
|
|
|
@ -43,7 +43,7 @@ nsresult
|
|||
nsOSHelperAppService::OSProtocolHandlerExists(const char* aScheme,
|
||||
bool* aExists)
|
||||
{
|
||||
*aExists = mozilla::AndroidBridge::Bridge()->GetHandlersForURL(aScheme);
|
||||
*aExists = mozilla::AndroidBridge::Bridge()->GetHandlersForURL(NS_ConvertUTF8toUTF16(aScheme));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -401,7 +401,7 @@ AndroidBridge::NotifyIMEContext(int aState, const nsAString& aTypeHint,
|
|||
}
|
||||
|
||||
void
|
||||
AndroidBridge::NotifyIMEChange(const PRUnichar *aText, uint32_t aTextLen,
|
||||
AndroidBridge::NotifyIMEChange(const nsAString& aText,
|
||||
int aStart, int aEnd, int aNewEnd)
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::NotifyIMEChange");
|
||||
|
@ -414,7 +414,7 @@ AndroidBridge::NotifyIMEChange(const PRUnichar *aText, uint32_t aTextLen,
|
|||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
jvalue args[4];
|
||||
args[0].l = NewJavaString(&jniFrame, aText, aTextLen);
|
||||
args[0].l = NewJavaString(&jniFrame, aText);
|
||||
args[1].i = aStart;
|
||||
args[2].i = aEnd;
|
||||
args[3].i = aNewEnd;
|
||||
|
@ -537,7 +537,7 @@ getHandlersFromStringArray(JNIEnv *aJNIEnv, jobjectArray jArr, jsize aLen,
|
|||
}
|
||||
|
||||
bool
|
||||
AndroidBridge::GetHandlersForMimeType(const char *aMimeType,
|
||||
AndroidBridge::GetHandlersForMimeType(const nsAString& aMimeType,
|
||||
nsIMutableArray *aHandlersArray,
|
||||
nsIHandlerApp **aDefaultApp,
|
||||
const nsAString& aAction)
|
||||
|
@ -570,12 +570,12 @@ AndroidBridge::GetHandlersForMimeType(const char *aMimeType,
|
|||
|
||||
getHandlersFromStringArray(env, arr, len, aHandlersArray,
|
||||
aDefaultApp, aAction,
|
||||
nsDependentCString(aMimeType));
|
||||
NS_ConvertUTF16toUTF8(aMimeType));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidBridge::GetHandlersForURL(const char *aURL,
|
||||
AndroidBridge::GetHandlersForURL(const nsAString& aURL,
|
||||
nsIMutableArray* aHandlersArray,
|
||||
nsIHandlerApp **aDefaultApp,
|
||||
const nsAString& aAction)
|
||||
|
@ -611,7 +611,7 @@ AndroidBridge::GetHandlersForURL(const char *aURL,
|
|||
}
|
||||
|
||||
bool
|
||||
AndroidBridge::OpenUriExternal(const nsACString& aUriSpec, const nsACString& aMimeType,
|
||||
AndroidBridge::OpenUriExternal(const nsAString& aUriSpec, const nsAString& aMimeType,
|
||||
const nsAString& aPackageName, const nsAString& aClassName,
|
||||
const nsAString& aAction, const nsAString& aTitle)
|
||||
{
|
||||
|
@ -1351,7 +1351,7 @@ jclass GetGeckoAppShellClass()
|
|||
}
|
||||
|
||||
void
|
||||
AndroidBridge::ScanMedia(const nsAString& aFile, const nsACString& aMimeType)
|
||||
AndroidBridge::ScanMedia(const nsAString& aFile, const nsAString& aMimeType)
|
||||
{
|
||||
JNIEnv *env = GetJNIEnv();
|
||||
if (!env)
|
||||
|
|
|
@ -179,7 +179,7 @@ public:
|
|||
static void NotifyIMEContext(int aState, const nsAString& aTypeHint,
|
||||
const nsAString& aModeHint, const nsAString& aActionHint);
|
||||
|
||||
static void NotifyIMEChange(const PRUnichar *aText, uint32_t aTextLen, int aStart, int aEnd, int aNewEnd);
|
||||
static void NotifyIMEChange(const nsAString& a0, int32_t a1, int32_t a2, int32_t a3);
|
||||
|
||||
void StartJavaProfiling(int aInterval, int aSamples);
|
||||
void StopJavaProfiling();
|
||||
|
@ -213,21 +213,21 @@ public:
|
|||
void SetLayerClient(JNIEnv* env, jobject jobj);
|
||||
AndroidGeckoLayerClient &GetLayerClient() { return *mLayerClient; }
|
||||
|
||||
bool GetHandlersForURL(const char *aURL,
|
||||
nsIMutableArray* handlersArray = nullptr,
|
||||
nsIHandlerApp **aDefaultApp = nullptr,
|
||||
const nsAString& aAction = EmptyString());
|
||||
bool GetHandlersForURL(const nsAString& aURL,
|
||||
nsIMutableArray* handlersArray = nullptr,
|
||||
nsIHandlerApp **aDefaultApp = nullptr,
|
||||
const nsAString& aAction = EmptyString());
|
||||
|
||||
bool GetHandlersForMimeType(const char *aMimeType,
|
||||
nsIMutableArray* handlersArray = nullptr,
|
||||
nsIHandlerApp **aDefaultApp = nullptr,
|
||||
const nsAString& aAction = EmptyString());
|
||||
bool GetHandlersForMimeType(const nsAString& aMimeType,
|
||||
nsIMutableArray* handlersArray = nullptr,
|
||||
nsIHandlerApp **aDefaultApp = nullptr,
|
||||
const nsAString& aAction = EmptyString());
|
||||
|
||||
bool OpenUriExternal(const nsACString& aUriSpec, const nsACString& aMimeType,
|
||||
const nsAString& aPackageName = EmptyString(),
|
||||
const nsAString& aClassName = EmptyString(),
|
||||
const nsAString& aAction = EmptyString(),
|
||||
const nsAString& aTitle = EmptyString());
|
||||
bool OpenUriExternal(const nsAString& aUriSpec, const nsAString& aMimeType,
|
||||
const nsAString& aPackageName = EmptyString(),
|
||||
const nsAString& aClassName = EmptyString(),
|
||||
const nsAString& aAction = EmptyString(),
|
||||
const nsAString& aTitle = EmptyString());
|
||||
|
||||
void GetMimeTypeFromExtensions(const nsACString& aFileExt, nsCString& aMimeType);
|
||||
void GetExtensionFromMimeType(const nsACString& aMimeType, nsACString& aFileExt);
|
||||
|
@ -298,7 +298,7 @@ public:
|
|||
|
||||
void SetKeepScreenOn(bool on);
|
||||
|
||||
void ScanMedia(const nsAString& aFile, const nsACString& aMimeType);
|
||||
void ScanMedia(const nsAString& aFile, const nsAString& aMimeType);
|
||||
|
||||
void CreateShortcut(const nsAString& aTitle, const nsAString& aURI, const nsAString& aIconData, const nsAString& aIntent);
|
||||
|
||||
|
|
|
@ -2255,8 +2255,7 @@ nsWindow::FlushIMEChanges()
|
|||
if (!event.mSucceeded)
|
||||
return;
|
||||
|
||||
AndroidBridge::NotifyIMEChange(event.mReply.mString.get(),
|
||||
event.mReply.mString.Length(),
|
||||
AndroidBridge::NotifyIMEChange(event.mReply.mString,
|
||||
change.mStart,
|
||||
change.mOldEnd,
|
||||
change.mNewEnd);
|
||||
|
@ -2271,9 +2270,9 @@ nsWindow::FlushIMEChanges()
|
|||
if (!event.mSucceeded)
|
||||
return;
|
||||
|
||||
AndroidBridge::NotifyIMEChange(nullptr, 0,
|
||||
event.GetSelectionStart(),
|
||||
event.GetSelectionEnd(), -1);
|
||||
AndroidBridge::NotifyIMEChange(EmptyString(),
|
||||
(int32_t) event.GetSelectionStart(),
|
||||
(int32_t) event.GetSelectionEnd(), -1);
|
||||
mIMESelectionChanged = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1809,7 +1809,7 @@ nsLocalFile::Launch()
|
|||
nsDependentCString fileUri = NS_LITERAL_CSTRING("file://");
|
||||
fileUri.Append(mPath);
|
||||
mozilla::AndroidBridge* bridge = mozilla::AndroidBridge::Bridge();
|
||||
return bridge->OpenUriExternal(fileUri, type) ? NS_OK : NS_ERROR_FAILURE;
|
||||
return bridge->OpenUriExternal(NS_ConvertUTF8toUTF16(fileUri), NS_ConvertUTF8toUTF16(type)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
#elif defined(MOZ_WIDGET_COCOA)
|
||||
CFURLRef url;
|
||||
if (NS_SUCCEEDED(GetCFURL(&url))) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче