mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 841938 - Implement nsAndroidHistory::SetURITitle. r=wesj
This commit is contained in:
parent
ec15b3d55e
commit
ecfd2da70d
@ -1831,6 +1831,14 @@ public class GeckoAppShell
|
||||
});
|
||||
}
|
||||
|
||||
static void setUriTitle(final String uri, final String title) { // invoked from native JNI code
|
||||
getHandler().post(new Runnable() {
|
||||
public void run() {
|
||||
GlobalHistory.getInstance().update(uri, title);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void hideProgressDialog() {
|
||||
// unused stub
|
||||
}
|
||||
|
@ -127,8 +127,7 @@ class GlobalHistory {
|
||||
if (!canAddURI(uri))
|
||||
return;
|
||||
|
||||
ContentResolver resolver = GeckoApp.mAppContext.getContentResolver();
|
||||
BrowserDB.updateHistoryTitle(resolver, uri, title);
|
||||
BrowserDB.updateHistoryTitle(GeckoApp.mAppContext.getContentResolver(), uri, title);
|
||||
}
|
||||
|
||||
public void checkUriVisited(final String uri) {
|
||||
|
@ -10,12 +10,6 @@ public class PrivateTab extends Tab {
|
||||
super(id, url, external, parentId, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addHistory(final String uri) {}
|
||||
|
||||
@Override
|
||||
protected void updateHistory(final String uri, final String title) {}
|
||||
|
||||
@Override
|
||||
protected void saveThumbnailToDB() {}
|
||||
|
||||
|
@ -244,29 +244,9 @@ public class Tab {
|
||||
return;
|
||||
|
||||
mTitle = (title == null ? "" : title);
|
||||
|
||||
if (mUrl != null)
|
||||
updateHistory(mUrl, mTitle);
|
||||
|
||||
Tabs.getInstance().notifyListeners(this, Tabs.TabEvents.TITLE);
|
||||
}
|
||||
|
||||
protected void addHistory(final String uri) {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
public void run() {
|
||||
GlobalHistory.getInstance().add(uri);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void updateHistory(final String uri, final String title) {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
public void run() {
|
||||
GlobalHistory.getInstance().update(uri, title);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setState(int state) {
|
||||
mState = state;
|
||||
|
||||
|
@ -109,7 +109,14 @@ nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlag
|
||||
NS_IMETHODIMP
|
||||
nsAndroidHistory::SetURITitle(nsIURI *aURI, const nsAString& aTitle)
|
||||
{
|
||||
// we don't do anything with this right now
|
||||
AndroidBridge *bridge = AndroidBridge::Bridge();
|
||||
if (bridge) {
|
||||
nsAutoCString uri;
|
||||
nsresult rv = aURI->GetSpec(uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_ConvertUTF8toUTF16 uriString(uri);
|
||||
bridge->SetURITitle(uriString, aTitle);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -159,6 +159,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
||||
jHandleGeckoMessage = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "handleGeckoMessage", "(Ljava/lang/String;)Ljava/lang/String;");
|
||||
jCheckUriVisited = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "checkUriVisited", "(Ljava/lang/String;)V");
|
||||
jMarkUriVisited = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "markUriVisited", "(Ljava/lang/String;)V");
|
||||
jSetUriTitle = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "setUriTitle", "(Ljava/lang/String;Ljava/lang/String;)V");
|
||||
|
||||
jCalculateLength = (jmethodID) jEnv->GetStaticMethodID(jAndroidSmsMessageClass, "calculateLength", "(Ljava/lang/CharSequence;Z)[I");
|
||||
jSendMessage = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "sendMessage", "(Ljava/lang/String;Ljava/lang/String;I)V");
|
||||
@ -1667,6 +1668,19 @@ AndroidBridge::MarkURIVisited(const nsAString& aURI)
|
||||
env->CallStaticVoidMethod(mGeckoAppShellClass, jMarkUriVisited, jstrURI);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::SetURITitle(const nsAString& aURI, const nsAString& aTitle)
|
||||
{
|
||||
JNIEnv *env = GetJNIEnv();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
jstring jstrURI = NewJavaString(&jniFrame, aURI);
|
||||
jstring jstrTitle = NewJavaString(&jniFrame, aTitle);
|
||||
env->CallStaticVoidMethod(mGeckoAppShellClass, jSetUriTitle, jstrURI, jstrTitle);
|
||||
}
|
||||
|
||||
nsresult
|
||||
AndroidBridge::GetSegmentInfoForText(const nsAString& aText,
|
||||
dom::sms::SmsSegmentInfoData* aData)
|
||||
|
@ -311,6 +311,7 @@ public:
|
||||
|
||||
void CheckURIVisited(const nsAString& uri);
|
||||
void MarkURIVisited(const nsAString& uri);
|
||||
void SetURITitle(const nsAString& uri, const nsAString& title);
|
||||
|
||||
bool InitCamera(const nsCString& contentType, uint32_t camera, uint32_t *width, uint32_t *height, uint32_t *fps);
|
||||
|
||||
@ -465,6 +466,7 @@ protected:
|
||||
jmethodID jHandleGeckoMessage;
|
||||
jmethodID jCheckUriVisited;
|
||||
jmethodID jMarkUriVisited;
|
||||
jmethodID jSetUriTitle;
|
||||
jmethodID jAddPluginView;
|
||||
jmethodID jRemovePluginView;
|
||||
jmethodID jCreateSurface;
|
||||
|
Loading…
Reference in New Issue
Block a user