зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1291384 - 2. Convert GeckoProfile.getDB calls to BrowserDB.from calls; r=nalexander
Mass convert GeckoProfile.getDB() calls to BrowserDB.from() calls, whether using Context or GeckoProfile.
This commit is contained in:
Родитель
fef2725577
Коммит
5113e2786e
|
@ -727,7 +727,7 @@ public class BrowserApp extends GeckoApp
|
|||
|
||||
// Init suggested sites engine in BrowserDB.
|
||||
final SuggestedSites suggestedSites = new SuggestedSites(appContext, distribution);
|
||||
final BrowserDB db = profile.getDB();
|
||||
final BrowserDB db = BrowserDB.from(profile);
|
||||
db.setSuggestedSites(suggestedSites);
|
||||
|
||||
JavaAddonManager.getInstance().init(appContext);
|
||||
|
@ -1506,7 +1506,7 @@ public class BrowserApp extends GeckoApp
|
|||
}
|
||||
|
||||
private void handleClearHistory(final boolean clearSearchHistory) {
|
||||
final BrowserDB db = getProfile().getDB();
|
||||
final BrowserDB db = BrowserDB.from(getProfile());
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -1791,7 +1791,7 @@ public class BrowserApp extends GeckoApp
|
|||
break;
|
||||
|
||||
case "Telemetry:Gather":
|
||||
final BrowserDB db = getProfile().getDB();
|
||||
final BrowserDB db = BrowserDB.from(getProfile());
|
||||
final ContentResolver cr = getContentResolver();
|
||||
Telemetry.addToHistogram("PLACES_PAGES_COUNT", db.getCount(cr, "history"));
|
||||
Telemetry.addToHistogram("FENNEC_BOOKMARKS_COUNT", db.getCount(cr, "bookmarks"));
|
||||
|
@ -2504,7 +2504,7 @@ public class BrowserApp extends GeckoApp
|
|||
|
||||
// Otherwise, check for a bookmark keyword.
|
||||
final SharedPreferences sharedPrefs = GeckoSharedPrefs.forProfile(this);
|
||||
final BrowserDB db = getProfile().getDB();
|
||||
final BrowserDB db = BrowserDB.from(getProfile());
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -2579,7 +2579,7 @@ public class BrowserApp extends GeckoApp
|
|||
return;
|
||||
}
|
||||
|
||||
final BrowserDB db = profile.getDB();
|
||||
final BrowserDB db = BrowserDB.from(profile);
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -142,7 +142,7 @@ public class EditBookmarkDialog {
|
|||
*/
|
||||
public void show(final String url) {
|
||||
final ContentResolver cr = mContext.getContentResolver();
|
||||
final BrowserDB db = GeckoProfile.get(mContext).getDB();
|
||||
final BrowserDB db = BrowserDB.from(mContext);
|
||||
(new UIAsyncTask.WithoutParams<Bookmark>(ThreadUtils.getBackgroundHandler()) {
|
||||
@Override
|
||||
public Bookmark doInBackground() {
|
||||
|
@ -201,7 +201,7 @@ public class EditBookmarkDialog {
|
|||
locationText.setText(url);
|
||||
keywordText.setText(keyword);
|
||||
|
||||
final BrowserDB db = GeckoProfile.get(mContext).getDB();
|
||||
final BrowserDB db = BrowserDB.from(mContext);
|
||||
editPrompt.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
|
|
|
@ -613,7 +613,7 @@ public abstract class GeckoApp
|
|||
final String url = message.getString("url");
|
||||
final String title = message.getString("title");
|
||||
final Context context = this;
|
||||
final BrowserDB db = getProfile().getDB();
|
||||
final BrowserDB db = BrowserDB.from(getProfile());
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -1941,7 +1941,7 @@ public abstract class GeckoApp
|
|||
getApplicationContext().sendBroadcast(intent);
|
||||
|
||||
// Remember interaction
|
||||
final UrlAnnotations urlAnnotations = GeckoProfile.get(getApplicationContext()).getDB().getUrlAnnotations();
|
||||
final UrlAnnotations urlAnnotations = BrowserDB.from(getApplicationContext()).getUrlAnnotations();
|
||||
urlAnnotations.insertHomeScreenShortcut(getContentResolver(), aURI, true);
|
||||
}
|
||||
|
||||
|
@ -2832,7 +2832,7 @@ public abstract class GeckoApp
|
|||
@Override
|
||||
public void markUriVisited(final String uri) {
|
||||
final Context context = getApplicationContext();
|
||||
final BrowserDB db = GeckoProfile.get(context).getDB();
|
||||
final BrowserDB db = BrowserDB.from(context);
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -2844,7 +2844,7 @@ public abstract class GeckoApp
|
|||
@Override
|
||||
public void setUriTitle(final String uri, final String title) {
|
||||
final Context context = getApplicationContext();
|
||||
final BrowserDB db = GeckoProfile.get(context).getDB();
|
||||
final BrowserDB db = BrowserDB.from(context);
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -122,7 +122,7 @@ public class GeckoApplication extends Application
|
|||
GeckoThread.onPause();
|
||||
mPausedGecko = true;
|
||||
|
||||
final BrowserDB db = GeckoProfile.get(this).getDB();
|
||||
final BrowserDB db = BrowserDB.from(this);
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -53,7 +53,7 @@ class GlobalHistory {
|
|||
|
||||
public NotifierRunnable(final Context context) {
|
||||
mContentResolver = context.getContentResolver();
|
||||
mDB = GeckoProfile.get(context).getDB();
|
||||
mDB = BrowserDB.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -253,7 +253,7 @@ class MemoryMonitor extends BroadcastReceiver {
|
|||
profile = GeckoProfile.get(mContext, GeckoProfile.DEFAULT_PROFILE);
|
||||
}
|
||||
|
||||
mDB = profile.getDB();
|
||||
mDB = BrowserDB.from(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -124,7 +124,7 @@ public class Tab {
|
|||
|
||||
public Tab(Context context, int id, String url, boolean external, int parentId, String title) {
|
||||
mAppContext = context.getApplicationContext();
|
||||
mDB = GeckoProfile.get(context).getDB();
|
||||
mDB = BrowserDB.from(context);
|
||||
mId = id;
|
||||
mUrl = url;
|
||||
mBaseDomain = "";
|
||||
|
|
|
@ -89,7 +89,7 @@ public class Tabs implements GeckoEventListener {
|
|||
|
||||
public PersistTabsRunnable(final Context context, Iterable<Tab> tabsInOrder) {
|
||||
this.context = context;
|
||||
this.db = GeckoProfile.get(context).getDB();
|
||||
this.db = BrowserDB.from(context);
|
||||
this.tabs = tabsInOrder;
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ public class Tabs implements GeckoEventListener {
|
|||
if (mBookmarksContentObserver != null) {
|
||||
// It's safe to use the db here since we aren't doing any I/O.
|
||||
final GeckoProfile profile = GeckoProfile.get(context);
|
||||
profile.getDB().registerBookmarkObserver(getContentResolver(), mBookmarksContentObserver);
|
||||
BrowserDB.from(profile).registerBookmarkObserver(getContentResolver(), mBookmarksContentObserver);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ public class Tabs implements GeckoEventListener {
|
|||
|
||||
// It's safe to use the db here since we aren't doing any I/O.
|
||||
final GeckoProfile profile = GeckoProfile.get(mAppContext);
|
||||
profile.getDB().registerBookmarkObserver(getContentResolver(), mBookmarksContentObserver);
|
||||
BrowserDB.from(profile).registerBookmarkObserver(getContentResolver(), mBookmarksContentObserver);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -579,7 +579,7 @@ public class Tabs implements GeckoEventListener {
|
|||
}
|
||||
|
||||
public void refreshThumbnails() {
|
||||
final BrowserDB db = GeckoProfile.get(mAppContext).getDB();
|
||||
final BrowserDB db = BrowserDB.from(mAppContext);
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -26,7 +26,7 @@ import android.support.v4.content.CursorLoader;
|
|||
/**
|
||||
* Interface for interactions with all databases. If you want an instance
|
||||
* that implements this, you should go through GeckoProfile. E.g.,
|
||||
* <code>GeckoProfile.get(context).getDB()</code>.
|
||||
* <code>BrowserDB.from(context)</code>.
|
||||
*/
|
||||
public abstract class BrowserDB {
|
||||
public static enum FilterFlags {
|
||||
|
|
|
@ -858,7 +858,8 @@ public class BrowserProvider extends SharedBrowserDatabaseProvider {
|
|||
}
|
||||
|
||||
// If we don't have enough data: get suggested sites too
|
||||
final SuggestedSites suggestedSites = GeckoProfile.get(getContext(), uri.getQueryParameter(BrowserContract.PARAM_PROFILE)).getDB().getSuggestedSites();
|
||||
final SuggestedSites suggestedSites = BrowserDB.from(GeckoProfile.get(
|
||||
getContext(), uri.getQueryParameter(BrowserContract.PARAM_PROFILE))).getSuggestedSites();
|
||||
|
||||
final Cursor suggestedSitesCursor = suggestedSites.get(limit - c.getCount());
|
||||
|
||||
|
@ -947,7 +948,8 @@ public class BrowserProvider extends SharedBrowserDatabaseProvider {
|
|||
|
||||
// Stuff the suggested sites into SQL: this allows us to filter pinned and topsites out of the suggested
|
||||
// sites list as part of the final query (as opposed to walking cursors in java)
|
||||
final SuggestedSites suggestedSites = GeckoProfile.get(getContext(), uri.getQueryParameter(BrowserContract.PARAM_PROFILE)).getDB().getSuggestedSites();
|
||||
final SuggestedSites suggestedSites = BrowserDB.from(GeckoProfile.get(
|
||||
getContext(), uri.getQueryParameter(BrowserContract.PARAM_PROFILE))).getSuggestedSites();
|
||||
|
||||
StringBuilder suggestedSitesBuilder = new StringBuilder();
|
||||
// We could access the underlying data here, however SuggestedSites also performs filtering on the suggested
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.mozilla.gecko.Tab;
|
|||
import org.mozilla.gecko.Tabs;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
|
@ -58,7 +59,7 @@ public class ScreenshotDelegate extends BrowserAppDelegateWithReference implemen
|
|||
return;
|
||||
}
|
||||
|
||||
GeckoProfile.get(activity).getDB().getUrlAnnotations().insertScreenshot(
|
||||
BrowserDB.from(activity).getUrlAnnotations().insertScreenshot(
|
||||
activity.getContentResolver(), selectedTab.getURL(), screenshotPath);
|
||||
|
||||
SnackbarBuilder.builder(activity)
|
||||
|
|
|
@ -64,7 +64,7 @@ public class FeedService extends IntentService {
|
|||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
browserDB = GeckoProfile.get(this).getDB();
|
||||
browserDB = BrowserDB.from(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -107,7 +107,7 @@ public class BookmarkFolderView extends LinearLayout {
|
|||
return null;
|
||||
}
|
||||
|
||||
final BrowserDB db = GeckoProfile.get(textView.getContext()).getDB();
|
||||
final BrowserDB db = BrowserDB.from(textView.getContext());
|
||||
return db.getBookmarkCountForFolder(textView.getContext().getContentResolver(), mFolderID);
|
||||
}
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ public class BookmarksPanel extends HomeFragment {
|
|||
super(context);
|
||||
mFolderInfo = folderInfo;
|
||||
mRefreshType = refreshType;
|
||||
mDB = GeckoProfile.get(context).getDB();
|
||||
mDB = BrowserDB.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -296,7 +296,7 @@ public class CombinedHistoryPanel extends HomeFragment implements RemoteClientsD
|
|||
|
||||
@Override
|
||||
public Cursor loadCursor() {
|
||||
return mProfile.getDB().getTabsAccessor().getRemoteTabsCursor(getContext());
|
||||
return BrowserDB.from(mProfile).getTabsAccessor().getRemoteTabsCursor(getContext());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ public class CombinedHistoryPanel extends HomeFragment implements RemoteClientsD
|
|||
|
||||
public HistoryCursorLoader(Context context) {
|
||||
super(context);
|
||||
mDB = GeckoProfile.get(context).getDB();
|
||||
mDB = BrowserDB.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -323,7 +323,7 @@ public class CombinedHistoryPanel extends HomeFragment implements RemoteClientsD
|
|||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
if (mDB == null) {
|
||||
mDB = GeckoProfile.get(getActivity()).getDB();
|
||||
mDB = BrowserDB.from(getActivity());
|
||||
}
|
||||
|
||||
switch (id) {
|
||||
|
|
|
@ -398,7 +398,7 @@ public abstract class HomeFragment extends Fragment {
|
|||
mUrl = url;
|
||||
mType = type;
|
||||
mPosition = position;
|
||||
mDB = GeckoProfile.get(context).getDB();
|
||||
mDB = BrowserDB.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.EnumSet;
|
|||
|
||||
import org.mozilla.gecko.GeckoProfile;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.db.BrowserDB.FilterFlags;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -98,7 +99,7 @@ class SearchLoader {
|
|||
@Override
|
||||
public Cursor loadCursor() {
|
||||
final long start = SystemClock.uptimeMillis();
|
||||
final Cursor cursor = mProfile.getDB().filter(getContext().getContentResolver(), mSearchTerm, SEARCH_LIMIT, mFlags);
|
||||
final Cursor cursor = BrowserDB.from(mProfile).filter(getContext().getContentResolver(), mSearchTerm, SEARCH_LIMIT, mFlags);
|
||||
final long end = SystemClock.uptimeMillis();
|
||||
final long took = end - start;
|
||||
Telemetry.addToHistogram(TELEMETRY_HISTOGRAM_LOAD_CURSOR, (int) Math.min(took, Integer.MAX_VALUE));
|
||||
|
|
|
@ -376,7 +376,7 @@ public class TopSitesPanel extends HomeFragment {
|
|||
TopSitesGridContextMenuInfo info = (TopSitesGridContextMenuInfo) menuInfo;
|
||||
|
||||
final int itemId = item.getItemId();
|
||||
final BrowserDB db = GeckoProfile.get(getActivity()).getDB();
|
||||
final BrowserDB db = BrowserDB.from(getActivity());
|
||||
|
||||
if (itemId == R.id.top_sites_pin) {
|
||||
final String url = info.url;
|
||||
|
@ -465,7 +465,7 @@ public class TopSitesPanel extends HomeFragment {
|
|||
public void onSiteSelected(final String url, final String title) {
|
||||
final int position = mPosition;
|
||||
final Context context = getActivity().getApplicationContext();
|
||||
final BrowserDB db = GeckoProfile.get(getActivity()).getDB();
|
||||
final BrowserDB db = BrowserDB.from(getActivity());
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -499,7 +499,7 @@ public class TopSitesPanel extends HomeFragment {
|
|||
public TopSitesLoader(Context context) {
|
||||
super(context);
|
||||
mMaxGridEntries = context.getResources().getInteger(R.integer.number_of_top_sites);
|
||||
mDB = GeckoProfile.get(context).getDB();
|
||||
mDB = BrowserDB.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -564,7 +564,7 @@ public class TopSitesPanel extends HomeFragment {
|
|||
|
||||
public TopSitesGridAdapter(Context context, Cursor cursor) {
|
||||
super(context, cursor, 0);
|
||||
mDB = GeckoProfile.get(context).getDB();
|
||||
mDB = BrowserDB.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -711,7 +711,7 @@ public class TopSitesPanel extends HomeFragment {
|
|||
// Only try to fetch thumbnails for non-empty URLs that
|
||||
// don't have an associated suggested image URL.
|
||||
final GeckoProfile profile = GeckoProfile.get(getActivity());
|
||||
if (TextUtils.isEmpty(url) || profile.getDB().hasSuggestedImageUrl(url)) {
|
||||
if (TextUtils.isEmpty(url) || BrowserDB.from(profile).hasSuggestedImageUrl(url)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -798,7 +798,7 @@ public class TopSitesPanel extends HomeFragment {
|
|||
public ThumbnailsLoader(Context context, ArrayList<String> urls) {
|
||||
super(context);
|
||||
mUrls = urls;
|
||||
mDB = GeckoProfile.get(context).getDB();
|
||||
mDB = BrowserDB.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,6 +16,7 @@ import android.widget.FrameLayout;
|
|||
|
||||
import org.mozilla.gecko.GeckoProfile;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.home.HomePager;
|
||||
import org.mozilla.gecko.home.SimpleCursorLoader;
|
||||
import org.mozilla.gecko.home.activitystream.topsites.TopSitesPagerAdapter;
|
||||
|
@ -59,14 +60,12 @@ public class ActivityStream extends FrameLayout {
|
|||
private class CursorLoaderCallbacks implements LoaderManager.LoaderCallbacks<Cursor> {
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
final Context context = getContext();
|
||||
if (id == LOADER_ID_HIGHLIGHTS) {
|
||||
final Context context = getContext();
|
||||
return GeckoProfile.get(context)
|
||||
.getDB()
|
||||
.getHighlights(context, 10);
|
||||
return BrowserDB.from(context).getHighlights(context, 10);
|
||||
} else if (id == LOADER_ID_TOPSITES) {
|
||||
return GeckoProfile.get(getContext()).getDB().getActivityStreamTopSites(getContext(),
|
||||
TopSitesPagerAdapter.TOTAL_ITEMS);
|
||||
return BrowserDB.from(context).getActivityStreamTopSites(
|
||||
context, TopSitesPagerAdapter.TOTAL_ITEMS);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Can't handle loader id " + id);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class LegacyLoader implements IconLoader {
|
|||
/* package-private */ Bitmap loadBitmapFromDatabase(IconRequest request) {
|
||||
final Context context = request.getContext();
|
||||
final ContentResolver contentResolver = context.getContentResolver();
|
||||
final BrowserDB db = GeckoProfile.get(context).getDB();
|
||||
final BrowserDB db = BrowserDB.from(context);
|
||||
|
||||
// We ask the database for the favicon URL and ignore the icon URL in the request object:
|
||||
// As we are not updating the database anymore the icon might be stored under a different URL.
|
||||
|
|
|
@ -238,7 +238,7 @@ public class SendTab extends ShareMethod {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
final BrowserDB browserDB = GeckoProfile.get(context).getDB();
|
||||
final BrowserDB browserDB = BrowserDB.from(context);
|
||||
final TabsAccessor tabsAccessor = browserDB.getTabsAccessor();
|
||||
final Cursor remoteTabsCursor = tabsAccessor.getRemoteClientsByRecencyCursor(context);
|
||||
try {
|
||||
|
|
|
@ -209,13 +209,13 @@ public class AddToHomeScreenPromotion extends TabsTrayVisibilityAwareDelegate im
|
|||
}
|
||||
|
||||
protected boolean hasAcceptedOrDeclinedHomeScreenShortcut(Context context, String url) {
|
||||
final UrlAnnotations urlAnnotations = GeckoProfile.get(context).getDB().getUrlAnnotations();
|
||||
final UrlAnnotations urlAnnotations = BrowserDB.from(context).getUrlAnnotations();
|
||||
return urlAnnotations.hasAcceptedOrDeclinedHomeScreenShortcut(context.getContentResolver(), url);
|
||||
}
|
||||
|
||||
protected URLHistory getHistoryForURL(Context context, String url) {
|
||||
final GeckoProfile profile = GeckoProfile.get(context);
|
||||
final BrowserDB browserDB = profile.getDB();
|
||||
final BrowserDB browserDB = BrowserDB.from(profile);
|
||||
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.mozilla.gecko.Locales;
|
|||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.db.UrlAnnotations;
|
||||
import org.mozilla.gecko.icons.IconCallback;
|
||||
import org.mozilla.gecko.icons.IconResponse;
|
||||
|
@ -175,7 +176,7 @@ public class HomeScreenPrompt extends Locales.LocaleAwareActivity implements Ico
|
|||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final UrlAnnotations urlAnnotations = GeckoProfile.get(HomeScreenPrompt.this).getDB().getUrlAnnotations();
|
||||
final UrlAnnotations urlAnnotations = BrowserDB.from(HomeScreenPrompt.this).getUrlAnnotations();
|
||||
urlAnnotations.insertHomeScreenShortcut(getContentResolver(), url, false);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.mozilla.gecko.GeckoThread;
|
|||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
import org.mozilla.gecko.annotation.ReflectionTarget;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.fxa.FxAccountPushHandler;
|
||||
import org.mozilla.gecko.gcm.GcmTokenClient;
|
||||
import org.mozilla.gecko.push.autopush.AutopushClientException;
|
||||
|
@ -404,7 +405,7 @@ public class PushService implements BundleEventListener {
|
|||
return;
|
||||
}
|
||||
// We're on a background thread, so we can be synchronous.
|
||||
final long millis = geckoProfile.getDB().getPrePathLastVisitedTimeMilliseconds(
|
||||
final long millis = BrowserDB.from(geckoProfile).getPrePathLastVisitedTimeMilliseconds(
|
||||
context.getContentResolver(), prePath);
|
||||
callback.sendSuccess(millis);
|
||||
return;
|
||||
|
|
|
@ -33,7 +33,7 @@ public final class ReadingListHelper implements NativeEventListener {
|
|||
|
||||
public ReadingListHelper(Context context, GeckoProfile profile) {
|
||||
this.context = context;
|
||||
this.db = profile.getDB();
|
||||
this.db = BrowserDB.from(profile);
|
||||
|
||||
EventDispatcher.getInstance().registerGeckoThreadListener((NativeEventListener) this,
|
||||
"Reader:FaviconRequest", "Reader:AddedToCache");
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
import org.mozilla.gecko.GeckoProfile;
|
||||
import org.mozilla.gecko.annotation.RobocopTarget;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.db.UrlAnnotations;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
|
@ -145,7 +146,7 @@ public class SavedReaderViewHelper {
|
|||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
UrlAnnotations annotations = GeckoProfile.get(mContext).getDB().getUrlAnnotations();
|
||||
UrlAnnotations annotations = BrowserDB.from(mContext).getUrlAnnotations();
|
||||
annotations.insertReaderViewUrl(mContext.getContentResolver(), pageURL);
|
||||
|
||||
commit();
|
||||
|
@ -161,7 +162,7 @@ public class SavedReaderViewHelper {
|
|||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
UrlAnnotations annotations = GeckoProfile.get(mContext).getDB().getUrlAnnotations();
|
||||
UrlAnnotations annotations = BrowserDB.from(mContext).getUrlAnnotations();
|
||||
annotations.deleteReaderViewUrl(mContext.getContentResolver(), pageURL);
|
||||
|
||||
commit();
|
||||
|
|
|
@ -1313,7 +1313,7 @@ public class ActivityChooserModel extends DataSetObservable {
|
|||
return false;
|
||||
}
|
||||
|
||||
final BrowserDB browserDB = GeckoProfile.get(mContext).getDB();
|
||||
final BrowserDB browserDB = BrowserDB.from(mContext);
|
||||
final TabsAccessor tabsAccessor = browserDB.getTabsAccessor();
|
||||
final Cursor remoteClientsCursor = tabsAccessor
|
||||
.getRemoteClientsByRecencyCursor(mContext);
|
||||
|
|
|
@ -6,6 +6,7 @@ package org.mozilla.gecko.background.db;
|
|||
|
||||
import org.mozilla.gecko.GeckoProfile;
|
||||
import org.mozilla.gecko.db.BrowserContract;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.db.BrowserContract.Combined;
|
||||
import org.mozilla.gecko.db.SuggestedSites;
|
||||
import org.mozilla.gecko.sync.setup.Constants;
|
||||
|
@ -37,12 +38,12 @@ public class TestTopSites extends ActivityInstrumentationTestCase2<Activity> {
|
|||
mSuggestedSites = new SuggestedSites(mContext);
|
||||
|
||||
// By default we're using StubBrowserDB which has no suggested sites available.
|
||||
GeckoProfile.get(mContext, Constants.DEFAULT_PROFILE).getDB().setSuggestedSites(mSuggestedSites);
|
||||
BrowserDB.from(GeckoProfile.get(mContext, Constants.DEFAULT_PROFILE)).setSuggestedSites(mSuggestedSites);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tearDown() {
|
||||
GeckoProfile.get(mContext, Constants.DEFAULT_PROFILE).getDB().setSuggestedSites(null);
|
||||
BrowserDB.from(GeckoProfile.get(mContext, Constants.DEFAULT_PROFILE)).setSuggestedSites(null);
|
||||
}
|
||||
|
||||
public void testGetTopSites() {
|
||||
|
|
|
@ -165,6 +165,6 @@ class DatabaseHelper {
|
|||
}
|
||||
|
||||
protected BrowserDB getProfileDB() {
|
||||
return GeckoProfile.get(mActivity).getDB();
|
||||
return BrowserDB.from(mActivity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.Random;
|
|||
|
||||
import org.mozilla.gecko.db.BrowserContract;
|
||||
import org.mozilla.gecko.db.BrowserContract.UrlAnnotations.SyncStatus;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.db.URLMetadata;
|
||||
import org.mozilla.gecko.db.URLMetadataTable;
|
||||
|
||||
|
@ -1491,7 +1492,7 @@ public class testBrowserProvider extends ContentProviderTest {
|
|||
final String value = "42a";
|
||||
final long timeBeforeCreation = System.currentTimeMillis();
|
||||
|
||||
getTestProfile().getDB().getUrlAnnotations().insertAnnotation(mResolver, url, key, value);
|
||||
BrowserDB.from(getTestProfile()).getUrlAnnotations().insertAnnotation(mResolver, url, key, value);
|
||||
|
||||
final Cursor c = getUrlAnnotationByUrl(url);
|
||||
try {
|
||||
|
@ -1559,7 +1560,7 @@ public class testBrowserProvider extends ContentProviderTest {
|
|||
data.put(URLMetadataTable.TILE_COLOR_COLUMN, tileColor);
|
||||
data.put(URLMetadataTable.TOUCH_ICON_COLUMN, touchIcon);
|
||||
|
||||
getTestProfile().getDB().getURLMetadata().save(mResolver, data);
|
||||
BrowserDB.from(getTestProfile()).getURLMetadata().save(mResolver, data);
|
||||
|
||||
final Cursor c = getUrlMetadataByUrl(url2);
|
||||
try {
|
||||
|
@ -1577,7 +1578,7 @@ public class testBrowserProvider extends ContentProviderTest {
|
|||
// column being cached, the subsequent query should still retrieve all requested columns.
|
||||
// (In this case the URL may be cached but without all data, we need to make sure that
|
||||
// this state is correctly handled.)
|
||||
URLMetadata metadata = getTestProfile().getDB().getURLMetadata();
|
||||
URLMetadata metadata = BrowserDB.from(getTestProfile()).getURLMetadata();
|
||||
|
||||
Map<String, Map<String, Object>> results;
|
||||
Map<String, Object> urlData;
|
||||
|
|
Загрузка…
Ссылка в новой задаче