Bug 1096958 - Move TilesRecorder instance into TopSitesPanel. r=bnicholson, a=sledru
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 22 Jan 2015 17:36:17 -0800
changeset 243020 d6baa06d52b4
parent 243019 c1e9f11144a5
child 243021 2745f66dac6f
push id4364
push userryanvm@gmail.com
push date2015-01-24 16:33 +0000
treeherdermozilla-beta@34330baf2af6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson, sledru
bugs1096958
milestone36.0
Bug 1096958 - Move TilesRecorder instance into TopSitesPanel. r=bnicholson, a=sledru Thereby removing it from BrowserApp.
mobile/android/base/BrowserApp.java
mobile/android/base/home/TopSitesPanel.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -147,18 +147,17 @@ public class BrowserApp extends GeckoApp
                                    View.OnKeyListener,
                                    LayerView.OnMetricsChangedListener,
                                    BrowserSearch.OnSearchListener,
                                    BrowserSearch.OnEditSuggestionListener,
                                    HomePager.OnNewTabsListener,
                                    OnUrlOpenListener,
                                    OnUrlOpenInBackgroundListener,
                                    ActionModeCompat.Presenter,
-                                   LayoutInflater.Factory,
-                                   TopSitesPanel.BrowserTilesRecorderProvider {
+                                   LayoutInflater.Factory {
     private static final String LOGTAG = "GeckoBrowserApp";
 
     private static final int TABS_ANIMATION_DURATION = 450;
 
     private static final String ADD_SHORTCUT_TOAST = "add_shortcut_toast";
     public static final String GUEST_BROWSING_ARG = "--guest";
 
     private static final String STATE_ABOUT_HOME_TOP_PADDING = "abouthome_top_padding";
@@ -252,18 +251,16 @@ public class BrowserApp extends GeckoApp
     // The animator used to toggle HomePager visibility has a race where if the HomePager is shown
     // (starting the animation), the HomePager is hidden, and the HomePager animation completes,
     // both the web content and the HomePager will be hidden. This flag is used to prevent the
     // race by determining if the web content should be hidden at the animation's end.
     private boolean mHideWebContentOnAnimationEnd;
 
     private final DynamicToolbar mDynamicToolbar = new DynamicToolbar();
 
-    private TilesRecorder mTilesRecorder;
-
     @Override
     public View onCreateView(final String name, final Context context, final AttributeSet attrs) {
         final View view;
         if (BrowserToolbar.class.getName().equals(name)) {
             view = BrowserToolbar.create(context, attrs);
         } else if (TabsPanel.TabsLayout.class.getName().equals(name)) {
             view = TabsPanel.createTabsLayout(context, attrs);
         } else {
@@ -658,18 +655,16 @@ public class BrowserApp extends GeckoApp
         if (mediaManagerClass != null) {
             try {
                 Method init = mediaManagerClass.getMethod("init", Context.class);
                 init.invoke(null, this);
             } catch(Exception ex) {
                 Log.e(LOGTAG, "Error initializing media manager", ex);
             }
         }
-
-        mTilesRecorder = new TilesRecorder();
     }
 
     private void setupSystemUITinting() {
         if (!Versions.feature19Plus) {
             return;
         }
 
         getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
@@ -3347,14 +3342,9 @@ public class BrowserApp extends GeckoApp
         return new BrowserHealthRecorder(context,
                                          GeckoSharedPrefs.forApp(context),
                                          profilePath,
                                          dispatcher,
                                          osLocale,
                                          appLocale,
                                          previousSession);
     }
-
-    @Override
-    public TilesRecorder getTilesRecorder() {
-        return mTilesRecorder;
-    }
 }
--- a/mobile/android/base/home/TopSitesPanel.java
+++ b/mobile/android/base/home/TopSitesPanel.java
@@ -124,32 +124,23 @@ public class TopSitesPanel extends HomeF
     }
 
     private static void trace(final String message) {
         if (logVerbose) {
             Log.v(LOGTAG, message);
         }
     }
 
-    public interface BrowserTilesRecorderProvider {
-        public TilesRecorder getTilesRecorder();
-    }
-
     @Override
     public void onAttach(Activity activity) {
         super.onAttach(activity);
 
         mMaxGridEntries = activity.getResources().getInteger(R.integer.number_of_top_sites);
 
-        try {
-            mTilesRecorder = ((BrowserTilesRecorderProvider) activity).getTilesRecorder();
-        } catch (ClassCastException e) {
-            throw new ClassCastException(activity.toString()
-                    + " must implement TopSitesPanel.BrowserTilesRecorderProvider");
-        }
+        mTilesRecorder = new TilesRecorder();
     }
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         final View view = inflater.inflate(R.layout.home_top_sites_panel, container, false);
 
         mList = (HomeListView) view.findViewById(R.id.list);