Bug 1301715 - BrowserApp: Receive metadata from event. r?ahunt draft
authorSebastian Kaspari <s.kaspari@gmail.com>
Thu, 08 Sep 2016 10:20:44 +0200
changeset 417167 66f1fa26ab65c2e973f6f9d21824a8c5e3aa24dd
parent 417166 00519e7502ff7930eb9b5efd2ef73679509ab7fd
child 419525 65b47e76d951eaf78c57082c73209f2bacc800e2
push id30349
push users.kaspari@gmail.com
push dateFri, 23 Sep 2016 17:59:39 +0000
reviewersahunt
bugs1301715
milestone52.0a1
Bug 1301715 - BrowserApp: Receive metadata from event. r?ahunt MozReview-Commit-ID: 7rND7R09Pj6
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -712,17 +712,18 @@ public class BrowserApp extends GeckoApp
             "Favicon:CacheLoad",
             "Feedback:MaybeLater",
             "Menu:Add",
             "Menu:Remove",
             "Sanitize:ClearHistory",
             "Sanitize:ClearSyncedTabs",
             "Settings:Show",
             "Telemetry:Gather",
-            "Updater:Launch");
+            "Updater:Launch",
+            "Website:Metadata");
 
         final GeckoProfile profile = getProfile();
 
         // We want to upload the telemetry core ping as soon after startup as possible. It relies on the
         // Distribution being initialized. If you move this initialization, ensure it plays well with telemetry.
         final Distribution distribution = Distribution.init(getApplicationContext());
         distribution.addOnDistributionReadyCallback(
                 new DistributionStoreCallback(getApplicationContext(), profile.getName()));
@@ -1453,17 +1454,18 @@ public class BrowserApp extends GeckoApp
             "Favicon:CacheLoad",
             "Feedback:MaybeLater",
             "Menu:Add",
             "Menu:Remove",
             "Sanitize:ClearHistory",
             "Sanitize:ClearSyncedTabs",
             "Settings:Show",
             "Telemetry:Gather",
-            "Updater:Launch");
+            "Updater:Launch",
+            "Website:Metadata");
 
         if (AppConstants.MOZ_ANDROID_BEAM) {
             NfcAdapter nfc = NfcAdapter.getDefaultAdapter(this);
             if (nfc != null) {
                 // null this out even though the docs say it's not needed,
                 // because the source code looks like it will only do this
                 // automatically on API 14+
                 nfc.setNdefPushMessageCallback(null, this);
@@ -1852,16 +1854,23 @@ public class BrowserApp extends GeckoApp
                     manager.enqueue(request);
 
                     Log.d(LOGTAG, "Enqueued download (Download Manager)");
                 } catch (RuntimeException e) {
                     Log.e(LOGTAG, "Download failed: " + e);
                 }
                 break;
 
+            case "Website:Metadata":
+                final NativeJSObject metadata = message.getObject("metadata");
+                final String location = message.getString("location");
+
+                // TODO: Store metadata (Bug 1301717)
+                break;
+
             default:
                 super.handleMessage(event, message, callback);
                 break;
         }
     }
 
     private void getFaviconFromCache(final EventCallback callback, final String url) {
         Icons.with(this)