Bug 799609 - Disable Places in B2G - Part 4 - Disable Places in Firefox for Android.
authorMarco Bonardo <mbonardo@mozilla.com>
Fri, 09 Nov 2012 10:55:59 +0100
changeset 120739 695612ed380919608cac6ffa42f4ac6a750db659
parent 120738 a7f1ae3b42252558ec6a6b56e0c8b66a3008414a
child 120740 83157913f81fbb9b71c361b2660e653ab41ab8a5
push id1997
push userakeybl@mozilla.com
push dateMon, 07 Jan 2013 21:25:26 +0000
treeherdermozilla-beta@4baf45cdcf21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs799609
milestone19.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 799609 - Disable Places in B2G - Part 4 - Disable Places in Firefox for Android. Move Android history implementation to the mobile folder, use the newly exposed NotifyVisited API, disable Places. r=blassey
configure.in
mobile/android/components/build/Makefile.in
mobile/android/components/build/nsAndroidHistory.cpp
mobile/android/components/build/nsAndroidHistory.h
mobile/android/components/build/nsBrowserModule.cpp
mobile/android/confvars.sh
toolkit/components/places/nsAndroidHistory.cpp
toolkit/components/places/nsAndroidHistory.h
widget/android/Makefile.in
widget/android/nsAppShell.cpp
--- a/configure.in
+++ b/configure.in
@@ -5063,20 +5063,22 @@ AC_SUBST(MOZ_DBUS_CFLAGS)
 AC_SUBST(MOZ_DBUS_LIBS)
 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
 
 dnl ========================================================
 dnl = Enable Android History instead of Places
 dnl ========================================================
 if test -n "$MOZ_ANDROID_HISTORY"; then
-     dnl Do this if defined in confvars.sh
-     AC_DEFINE(MOZ_ANDROID_HISTORY)
-fi
-
+    if test -z "$MOZ_PLACES"; then
+        AC_DEFINE(MOZ_ANDROID_HISTORY)
+    else
+        AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
+    fi
+fi
 
 dnl ========================================================
 dnl = Build with the Android compositor
 dnl ========================================================
 if test -n "$MOZ_ANDROID_OMTC"; then
      dnl Do this if defined in confvars.sh
      AC_DEFINE(MOZ_ANDROID_OMTC)
 fi
--- a/mobile/android/components/build/Makefile.in
+++ b/mobile/android/components/build/Makefile.in
@@ -23,9 +23,17 @@ XPIDL_MODULE = browsercomps
 
 XPIDLSRCS = nsIShellService.idl
 
 CPPSRCS = \
 	nsBrowserModule.cpp \
 	nsShellService.cpp \
 	$(NULL)
 
+ifdef MOZ_ANDROID_HISTORY
+CPPSRCS += nsAndroidHistory.cpp
+LOCAL_INCLUDES += \
+	-I$(topsrcdir)/docshell/base \
+	-I$(topsrcdir)/content/base/src \
+	$(NULL)
+endif
+
 include $(topsrcdir)/config/rules.mk
rename from toolkit/components/places/nsAndroidHistory.cpp
rename to mobile/android/components/build/nsAndroidHistory.cpp
--- a/toolkit/components/places/nsAndroidHistory.cpp
+++ b/mobile/android/components/build/nsAndroidHistory.cpp
@@ -108,23 +108,26 @@ nsAndroidHistory::VisitURI(nsIURI *aURI,
 
 NS_IMETHODIMP
 nsAndroidHistory::SetURITitle(nsIURI *aURI, const nsAString& aTitle)
 {
   // we don't do anything with this right now
   return NS_OK;
 }
 
-void /*static*/
-nsAndroidHistory::NotifyURIVisited(const nsString& aUriString)
+NS_IMETHODIMP
+nsAndroidHistory::NotifyVisited(nsIURI *aURI)
 {
-  if (! sHistory)
-    return;
-  sHistory->mPendingURIs.Push(aUriString);
-  NS_DispatchToMainThread(sHistory);
+  if (aURI && sHistory) {
+    nsAutoCString spec;
+    (void)aURI->GetSpec(spec);
+    sHistory->mPendingURIs.Push(NS_ConvertUTF8toUTF16(spec));
+    NS_DispatchToMainThread(sHistory);
+  }
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAndroidHistory::Run()
 {
   while (! mPendingURIs.IsEmpty()) {
     nsString uriString = mPendingURIs.Pop();
     nsTArray<Link*>* list = sHistory->mListeners.Get(uriString);
rename from toolkit/components/places/nsAndroidHistory.h
rename to mobile/android/components/build/nsAndroidHistory.h
--- a/toolkit/components/places/nsAndroidHistory.h
+++ b/mobile/android/components/build/nsAndroidHistory.h
@@ -23,17 +23,16 @@ public:
 
   /**
    * Obtains a pointer that has had AddRef called on it.  Used by the service
    * manager only.
    */
   static nsAndroidHistory* GetSingleton();
 
   nsAndroidHistory();
-  static void NotifyURIVisited(const nsString& str);
 
 private:
   static nsAndroidHistory* sHistory;
 
   nsDataHashtable<nsStringHashKey, nsTArray<mozilla::dom::Link *> *> mListeners;
   nsTPriorityQueue<nsString> mPendingURIs;
 };
 
--- a/mobile/android/components/build/nsBrowserModule.cpp
+++ b/mobile/android/components/build/nsBrowserModule.cpp
@@ -2,26 +2,44 @@
 /* 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/. */
 
 #include "mozilla/ModuleUtils.h"
 
 #include "nsShellService.h"
 
+#ifdef MOZ_ANDROID_HISTORY
+#include "nsDocShellCID.h"
+#include "nsAndroidHistory.h"
+#define NS_ANDROIDHISTORY_CID \
+  {0xCCAA4880, 0x44DD, 0x40A7, {0xA1, 0x3F, 0x61, 0x56, 0xFC, 0x88, 0x2C, 0x0B}}
+#endif
+
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsShellService)
 NS_DEFINE_NAMED_CID(nsShellService_CID);
 
+#ifdef MOZ_ANDROID_HISTORY
+NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsAndroidHistory, nsAndroidHistory::GetSingleton)
+NS_DEFINE_NAMED_CID(NS_ANDROIDHISTORY_CID);
+#endif
+
 static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
   { &knsShellService_CID, false, NULL, nsShellServiceConstructor },
+#ifdef MOZ_ANDROID_HISTORY
+  { &kNS_ANDROIDHISTORY_CID, false, NULL, nsAndroidHistoryConstructor },
+#endif
   { NULL }
 };
 
 static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
   { nsShellService_ContractID, &knsShellService_CID },
+#ifdef MOZ_ANDROID_HISTORY
+  { NS_IHISTORY_CONTRACTID, &kNS_ANDROIDHISTORY_CID },
+#endif
   { NULL }
 };
 
 static const mozilla::Module kBrowserModule = {
   mozilla::Module::kVersion,
   kBrowserCIDs,
   kBrowserContracts
 };
--- a/mobile/android/confvars.sh
+++ b/mobile/android/confvars.sh
@@ -18,21 +18,21 @@ MOZ_DISABLE_DOMCRYPTO=1
 
 # Enable getUserMedia
 MOZ_MEDIA_NAVIGATOR=1
 
 if test "$LIBXUL_SDK"; then
 MOZ_XULRUNNER=1
 else
 MOZ_XULRUNNER=
-MOZ_PLACES=1
 fi
 
 MOZ_CAPTURE=1
 MOZ_RAW=1
+MOZ_PLACES=
 MOZ_ANDROID_HISTORY=1
 
 # Needed for building our components as part of libxul
 MOZ_APP_COMPONENT_LIBS="browsercomps"
 MOZ_APP_COMPONENT_INCLUDE=nsBrowserComponents.h
 
 # use custom widget for html:select
 MOZ_USE_NATIVE_POPUP_WINDOWS=1
--- a/widget/android/Makefile.in
+++ b/widget/android/Makefile.in
@@ -64,17 +64,16 @@ include $(topsrcdir)/config/rules.mk
 
 DEFINES += -D_IMPL_NS_WIDGET
 #DEFINES += -DDEBUG_WIDGETS
 
 LOCAL_INCLUDES += \
 	-I$(topsrcdir)/widget/xpwidgets \
 	-I$(topsrcdir)/widget/shared \
 	-I$(topsrcdir)/dom/system/android \
-	-I$(topsrcdir)/toolkit/components/places \
 	-I$(topsrcdir)/docshell/base \
 	-I$(topsrcdir)/content/events/src \
 	-I$(topsrcdir)/netwerk/cache \
 	-I$(topsrcdir)/widget/android/android \
 	-I$(srcdir) \
 	$(NULL)
 
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -36,17 +36,18 @@
 #include <android/log.h>
 #include <pthread.h>
 #include <wchar.h>
 
 #include "mozilla/dom/ScreenOrientation.h"
 
 #include "sampler.h"
 #ifdef MOZ_ANDROID_HISTORY
-#include "nsAndroidHistory.h"
+#include "nsNetUtil.h"
+#include "IHistory.h"
 #endif
 
 #ifdef MOZ_LOGGING
 #define FORCE_PR_LOG
 #include "prlog.h"
 #endif
 
 #ifdef DEBUG_ANDROID_EVENTS
@@ -566,17 +567,23 @@ nsAppShell::ProcessNextNativeEvent(bool 
             gLastSizeChange = new AndroidGeckoEvent(curEvent);
         }
         nsWindow::OnGlobalAndroidEvent(curEvent);
         break;
     }
 
     case AndroidGeckoEvent::VISITED: {
 #ifdef MOZ_ANDROID_HISTORY
-        nsAndroidHistory::NotifyURIVisited(nsString(curEvent->Characters()));
+        nsCOMPtr<IHistory> history = services::GetHistoryService();
+        nsCOMPtr<nsIURI> visitedURI;
+        if (history &&
+            NS_SUCCEEDED(NS_NewURI(getter_AddRefs(visitedURI),
+                                   nsString(curEvent->Characters())))) {
+            history->NotifyVisited(visitedURI);
+        }
 #endif
         break;
     }
 
     case AndroidGeckoEvent::NETWORK_CHANGED: {
         hal::NotifyNetworkChange(hal::NetworkInformation(curEvent->Bandwidth(),
                                                          curEvent->CanBeMetered()));
         break;