Bug 884896 - Only expose home's public API when strictly necessary (r=sriram)
authorLucas Rocha <lucasr@mozilla.com>
Tue, 25 Jun 2013 18:04:00 +0100
changeset 143356 03069010d40f7de094f9573a961b0f2e42ec3b6b
parent 143355 86b02c1b76542d6865996715a33af6651e6c8a97
child 143357 3d60ab3e61b629bfd91a45351319748278d47fef
push id25130
push userlrocha@mozilla.com
push dateWed, 21 Aug 2013 09:41:27 +0000
treeherdermozilla-central@b2486721572e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssriram
bugs884896
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 884896 - Only expose home's public API when strictly necessary (r=sriram)
mobile/android/base/BrowserApp.java
mobile/android/base/home/BrowserSearch.java
mobile/android/base/home/FaviconsLoader.java
mobile/android/base/home/HomeFragment.java
mobile/android/base/home/HomePagerTabStrip.java
mobile/android/base/home/SearchEngine.java
mobile/android/base/home/SearchEngineRow.java
mobile/android/base/home/SimpleCursorLoader.java
mobile/android/base/home/SuggestClient.java
mobile/android/base/home/VisitedPage.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -12,17 +12,16 @@ import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.gfx.BitmapUtils;
 import org.mozilla.gecko.gfx.GeckoLayerClient;
 import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
 import org.mozilla.gecko.gfx.LayerView;
 import org.mozilla.gecko.gfx.PanZoomController;
 import org.mozilla.gecko.health.BrowserHealthReporter;
 import org.mozilla.gecko.home.BrowserSearch;
 import org.mozilla.gecko.home.HomePager;
-import org.mozilla.gecko.home.SearchEngine;
 import org.mozilla.gecko.menu.GeckoMenu;
 import org.mozilla.gecko.util.FloatUtils;
 import org.mozilla.gecko.util.GamepadUtils;
 import org.mozilla.gecko.util.HardwareUtils;
 import org.mozilla.gecko.util.ThreadUtils;
 import org.mozilla.gecko.util.UiAsyncTask;
 import org.mozilla.gecko.widget.AboutHome;
 
@@ -1829,18 +1828,18 @@ abstract public class BrowserApp extends
     // (HomePager|BrowserSearch).OnUrlOpenListener
     @Override
     public void onUrlOpen(String url) {
         openUrl(url);
     }
 
     // BrowserSearch.OnSearchListener
     @Override
-    public void onSearch(SearchEngine engine, String text) {
-        openUrl(text, engine.name);
+    public void onSearch(String engineId, String text) {
+        openUrl(text, engineId);
     }
 
     // BrowserSearch.OnEditSuggestionListener
     @Override
     public void onEditSuggestion(String suggestion) {
         mBrowserToolbar.onEditSuggestion(suggestion);
     }
 
--- a/mobile/android/base/home/BrowserSearch.java
+++ b/mobile/android/base/home/BrowserSearch.java
@@ -106,17 +106,17 @@ public class BrowserSearch extends HomeF
     // On edit suggestion listener
     private OnEditSuggestionListener mEditSuggestionListener;
 
     public interface OnUrlOpenListener {
         public void onUrlOpen(String url);
     }
 
     public interface OnSearchListener {
-        public void onSearch(SearchEngine engine, String text);
+        public void onSearch(String engineId, String text);
     }
 
     public interface OnEditSuggestionListener {
         public void onEditSuggestion(String suggestion);
     }
 
     public static BrowserSearch newInstance() {
         return new BrowserSearch();
--- a/mobile/android/base/home/FaviconsLoader.java
+++ b/mobile/android/base/home/FaviconsLoader.java
@@ -19,17 +19,17 @@ import android.support.v4.app.LoaderMana
 import android.support.v4.app.LoaderManager.LoaderCallbacks;
 import android.support.v4.content.Loader;
 
 import java.util.ArrayList;
 
 /**
  * Encapsulates the implementation of the favicons cursorloader.
  */
-public class FaviconsLoader {
+class FaviconsLoader {
     // Argument containing list of urls for the favicons loader
     private static final String FAVICONS_LOADER_URLS_ARG = "urls";
 
     private FaviconsLoader() {
     }
 
     private static ArrayList<String> getUrlsWithoutFavicon(Cursor c) {
         ArrayList<String> urls = new ArrayList<String>();
--- a/mobile/android/base/home/HomeFragment.java
+++ b/mobile/android/base/home/HomeFragment.java
@@ -31,17 +31,17 @@ import android.view.MenuItem;
 import android.view.View;
 import android.widget.EditText;
 import android.widget.Toast;
 
 /**
  * HomeFragment is an empty fragment that can be added to the HomePager.
  * Subclasses can add their own views. 
  */
-public class HomeFragment extends Fragment {
+class HomeFragment extends Fragment {
     // Log Tag.
     private static final String LOGTAG="GeckoHomeFragment";
 
     // Share MIME type.
     private static final String SHARE_MIME_TYPE = "text/plain";
 
     // URL to Title replacement regex.
     private static final String REGEX_URL_TO_TITLE = "^([a-z]+://)?(www\\.)?";
--- a/mobile/android/base/home/HomePagerTabStrip.java
+++ b/mobile/android/base/home/HomePagerTabStrip.java
@@ -12,17 +12,17 @@ import android.util.AttributeSet;
 
 import org.mozilla.gecko.R;
 
 /**
  * HomePagerTabStrip is a custom implementation of PagerTabStrip
  * that exposes XML attributes for the public methods.
  */
 
-public class HomePagerTabStrip extends PagerTabStrip {
+class HomePagerTabStrip extends PagerTabStrip {
 
     public HomePagerTabStrip(Context context) {
         super(context);
     }
 
     public HomePagerTabStrip(Context context, AttributeSet attrs) {
         super(context, attrs);
 
--- a/mobile/android/base/home/SearchEngine.java
+++ b/mobile/android/base/home/SearchEngine.java
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.home;
 
 import android.graphics.Bitmap;
 
 import java.util.ArrayList;
 
-public class SearchEngine {
+class SearchEngine {
     public String name;
     public String identifier;
     public Bitmap icon;
     public ArrayList<String> suggestions;
 
     public SearchEngine(String name, String identifier) {
         this(name, identifier, null);
     }
--- a/mobile/android/base/home/SearchEngineRow.java
+++ b/mobile/android/base/home/SearchEngineRow.java
@@ -73,17 +73,17 @@ class SearchEngineRow extends AnimatedHe
                 // If we're not clicking the user-entered view (the first suggestion item)
                 // and the search matches a URL pattern, go to that URL. Otherwise, do a
                 // search for the term.
                 if (v != mUserEnteredView && !StringUtils.isSearchQuery(suggestion, false)) {
                     if (mUrlOpenListener != null) {
                         mUrlOpenListener.onUrlOpen(suggestion);
                     }
                 } else if (mSearchListener != null) {
-                    mSearchListener.onSearch(mSearchEngine, suggestion);
+                    mSearchListener.onSearch(mSearchEngine.name, suggestion);
                 }
             }
         };
 
         mLongClickListener = new OnLongClickListener() {
             @Override
             public boolean onLongClick(View v) {
                 if (mEditSuggestionListener != null) {
--- a/mobile/android/base/home/SimpleCursorLoader.java
+++ b/mobile/android/base/home/SimpleCursorLoader.java
@@ -23,17 +23,17 @@ import android.content.Context;
 import android.database.ContentObserver;
 import android.database.Cursor;
 import android.support.v4.content.AsyncTaskLoader;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.util.Arrays;
 
-public abstract class SimpleCursorLoader extends AsyncTaskLoader<Cursor> {
+abstract class SimpleCursorLoader extends AsyncTaskLoader<Cursor> {
     final ForceLoadContentObserver mObserver;
     Cursor mCursor;
 
     public SimpleCursorLoader(Context context) {
         super(context);
         mObserver = new ForceLoadContentObserver();
     }
 
--- a/mobile/android/base/home/SuggestClient.java
+++ b/mobile/android/base/home/SuggestClient.java
@@ -20,17 +20,17 @@ import java.io.InputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLEncoder;
 import java.util.ArrayList;
 
 /**
  * Use network-based search suggestions.
  */
-public class SuggestClient {
+class SuggestClient {
     private static final String LOGTAG = "GeckoSuggestClient";
     private static final String USER_AGENT = GeckoAppShell.getGeckoInterface().getDefaultUAString();
 
     private final Context mContext;
     private final int mTimeout;
 
     // should contain the string "__searchTerms__", which is replaced with the query
     private final String mSuggestTemplate;
--- a/mobile/android/base/home/VisitedPage.java
+++ b/mobile/android/base/home/VisitedPage.java
@@ -1,17 +1,16 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.home;
 
 import org.mozilla.gecko.R;
-import org.mozilla.gecko.SimpleCursorLoader;
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.BrowserDB.URLColumns;
 import org.mozilla.gecko.gfx.BitmapUtils;
 import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
 import org.mozilla.gecko.home.TwoLinePageRow;
 
 import android.app.Activity;
 import android.content.ContentResolver;