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

--HG--
rename : toolkit/components/places/nsAndroidHistory.cpp => mobile/android/components/build/nsAndroidHistory.cpp
rename : toolkit/components/places/nsAndroidHistory.h => mobile/android/components/build/nsAndroidHistory.h
This commit is contained in:
Marco Bonardo 2012-11-09 10:55:59 +01:00
Родитель f5d87462b2
Коммит 1206805572
8 изменённых файлов: 50 добавлений и 14 удалений

Просмотреть файл

@ -5068,11 +5068,13 @@ 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)
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 ========================================================

Просмотреть файл

@ -28,4 +28,12 @@ CPPSRCS = \
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

Просмотреть файл

@ -113,13 +113,16 @@ nsAndroidHistory::SetURITitle(nsIURI *aURI, const nsAString& aTitle)
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

Просмотреть файл

@ -28,7 +28,6 @@ public:
static nsAndroidHistory* GetSingleton();
nsAndroidHistory();
static void NotifyURIVisited(const nsString& str);
private:
static nsAndroidHistory* sHistory;

Просмотреть файл

@ -7,16 +7,34 @@
#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 }
};

Просмотреть файл

@ -23,11 +23,11 @@ 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

Просмотреть файл

@ -69,7 +69,6 @@ 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 \

Просмотреть файл

@ -41,7 +41,8 @@
#include "sampler.h"
#ifdef MOZ_ANDROID_HISTORY
#include "nsAndroidHistory.h"
#include "nsNetUtil.h"
#include "IHistory.h"
#endif
#ifdef MOZ_LOGGING
@ -571,7 +572,13 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
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;
}