зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1328683 - Convert ReadingListHelper events to bundle events; r=sebastian
This commit is contained in:
Родитель
b6b448520d
Коммит
e56ec60a5b
|
@ -14,9 +14,9 @@ import org.mozilla.gecko.GeckoProfile;
|
|||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.icons.IconRequest;
|
||||
import org.mozilla.gecko.icons.Icons;
|
||||
import org.mozilla.gecko.util.BundleEventListener;
|
||||
import org.mozilla.gecko.util.EventCallback;
|
||||
import org.mozilla.gecko.util.NativeEventListener;
|
||||
import org.mozilla.gecko.util.NativeJSObject;
|
||||
import org.mozilla.gecko.util.GeckoBundle;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.util.UIAsyncTask;
|
||||
|
||||
|
@ -25,7 +25,7 @@ import android.util.Log;
|
|||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public final class ReadingListHelper implements NativeEventListener {
|
||||
public final class ReadingListHelper implements BundleEventListener {
|
||||
private static final String LOGTAG = "GeckoReadingListHelper";
|
||||
|
||||
protected final Context context;
|
||||
|
@ -35,17 +35,17 @@ public final class ReadingListHelper implements NativeEventListener {
|
|||
this.context = context;
|
||||
this.db = BrowserDB.from(profile);
|
||||
|
||||
EventDispatcher.getInstance().registerGeckoThreadListener((NativeEventListener) this,
|
||||
EventDispatcher.getInstance().registerGeckoThreadListener(this,
|
||||
"Reader:FaviconRequest", "Reader:AddedToCache");
|
||||
}
|
||||
|
||||
public void uninit() {
|
||||
EventDispatcher.getInstance().unregisterGeckoThreadListener((NativeEventListener) this,
|
||||
EventDispatcher.getInstance().unregisterGeckoThreadListener(this,
|
||||
"Reader:FaviconRequest", "Reader:AddedToCache");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(final String event, final NativeJSObject message,
|
||||
public void handleMessage(final String event, final GeckoBundle message,
|
||||
final EventCallback callback) {
|
||||
switch (event) {
|
||||
case "Reader:FaviconRequest": {
|
||||
|
|
|
@ -116,7 +116,7 @@ var Reader = {
|
|||
}
|
||||
|
||||
case "Reader:FaviconRequest": {
|
||||
Messaging.sendRequestForResult({
|
||||
GlobalEventDispatcher.sendRequestForResult({
|
||||
type: "Reader:FaviconRequest",
|
||||
url: message.data.url
|
||||
}).then(data => {
|
||||
|
|
|
@ -24,7 +24,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|||
Cu.importGlobalProperties(["XMLHttpRequest"]);
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils", "resource://services-common/utils.js");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Messaging", "resource://gre/modules/Messaging.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "EventDispatcher", "resource://gre/modules/Messaging.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ReaderWorker", "resource://gre/modules/reader/ReaderWorker.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
|
||||
|
@ -348,7 +348,7 @@ this.ReaderMode = {
|
|||
return OS.File.writeAtomic(path, array, { tmpPath: path + ".tmp" })
|
||||
.then(success => {
|
||||
OS.File.stat(path).then(info => {
|
||||
return Messaging.sendRequest({
|
||||
return EventDispatcher.instance.sendRequest({
|
||||
type: "Reader:AddedToCache",
|
||||
url: article.url,
|
||||
size: info.size,
|
||||
|
|
Загрузка…
Ссылка в новой задаче