Bug 965033 - Hook up DynamicPanel to HomeProvider. r=lucasr
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Tue, 28 Jan 2014 16:43:09 -0800
changeset 165645 fa98b6aefa3421f864b076b1f85a84190651eda2
parent 165644 12ac1dced3d0acf8107f6d32a8799aadeebbbab9
child 165646 34773c5184130ef35a111e52978b6b7dc046e352
push id4634
push usermleibovic@mozilla.com
push dateWed, 29 Jan 2014 00:43:35 +0000
treeherderfx-team@34773c518413 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs965033
milestone29.0a1
Bug 965033 - Hook up DynamicPanel to HomeProvider. r=lucasr
mobile/android/base/home/DynamicPanel.java
mobile/android/modules/HomeProvider.jsm
--- a/mobile/android/base/home/DynamicPanel.java
+++ b/mobile/android/base/home/DynamicPanel.java
@@ -214,26 +214,21 @@ public class DynamicPanel extends HomeFr
         public String getDatasetId() {
             return mDatasetId;
         }
 
         @Override
         public Cursor loadCursor() {
             final ContentResolver cr = getContext().getContentResolver();
 
-            // XXX: Use the test URI for static fake data
-            final Uri fakeItemsUri = HomeItems.CONTENT_FAKE_URI.buildUpon().
-                appendQueryParameter(BrowserContract.PARAM_PROFILE, "default").build();
-
             final String selection = HomeItems.DATASET_ID + " = ?";
             final String[] selectionArgs = new String[] { mDatasetId };
 
-            Log.i(LOGTAG, "Loading fake data for list provider: " + mDatasetId);
-
-            return cr.query(fakeItemsUri, null, selection, selectionArgs, null);
+            // XXX: You can use CONTENT_FAKE_URI for development to pull items from fake_home_items.json.
+            return cr.query(HomeItems.CONTENT_URI, null, selection, selectionArgs, null);
         }
     }
 
     /**
      * LoaderCallbacks implementation that interacts with the LoaderManager.
      */
     private class PanelLoaderCallbacks implements LoaderCallbacks<Cursor> {
         @Override
--- a/mobile/android/modules/HomeProvider.jsm
+++ b/mobile/android/modules/HomeProvider.jsm
@@ -19,17 +19,17 @@ const SCHEMA_VERSION = 1;
 const DB_PATH = OS.Path.join(OS.Constants.Path.profileDir, "home.sqlite");
 
 /**
  * All SQL statements should be defined here.
  */
 const SQL = {
   createItemsTable:
     "CREATE TABLE items (" +
-      "id INTEGER PRIMARY KEY AUTOINCREMENT, " +
+      "_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
       "dataset_id TEXT NOT NULL, " +
       "url TEXT," +
       "title TEXT," +
       "description TEXT," +
       "image_url TEXT," +
       "created INTEGER" +
     ")",
 
@@ -72,16 +72,17 @@ HomeStorage.prototype = {
   save: function(data) {
     return Task.spawn(function save_task() {
       let db = yield Sqlite.openConnection({ path: DB_PATH });
 
       try {
         // XXX: Factor this out to some migration path.
         if (!(yield db.tableExists("items"))) {
           yield db.execute(SQL.createItemsTable);
+          yield db.setSchemaVersion(SCHEMA_VERSION);
         }
 
         // Insert data into DB.
         for (let item of data) {
           // XXX: Directly pass item as params? More validation for item? Batch insert?
           let params = {
             dataset_id: this.datasetId,
             url: item.url,