Merge a=blockers

This commit is contained in:
Robert Sayre 2010-10-18 12:03:45 -05:00
commit 8134438166
9 changed files with 207 additions and 6 deletions

View File

@ -536,6 +536,7 @@ MOZ_QT_CFLAGS = @MOZ_QT_CFLAGS@
MOZ_QT_LIBS = @MOZ_QT_LIBS@
MOZ_ENABLE_QTNETWORK = @MOZ_ENABLE_QTNETWORK@
MOZ_ENABLE_MEEGOTOUCH = @MOZ_ENABLE_MEEGOTOUCH@
MOZ_ENABLE_MEEGOTOUCHSHARE = @MOZ_ENABLE_MEEGOTOUCHSHARE@
MOZ_DBUS_CFLAGS = @MOZ_DBUS_CFLAGS@
MOZ_DBUS_LIBS = @MOZ_DBUS_LIBS@

View File

@ -1048,3 +1048,6 @@ contentaction/contentaction.h
#ifndef MOZ_TREE_PIXMAN
pixman.h
#endif
#if MOZ_ENABLE_MEEGOTOUCHSHARE
shareuiinterface.h
#endif

View File

@ -7008,6 +7008,17 @@ if test $MOZ_PLATFORM_MAEMO; then
fi
AC_SUBST(MOZ_MAEMO_LIBLOCATION)
PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
if test "$_LIB_FOUND"; then
MOZ_ENABLE_MEEGOTOUCHSHARE=1
AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
else
AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
fi
AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
fi

View File

@ -63,6 +63,8 @@
#include "nsISelectionController.h"
#include "nsIMutationObserver.h"
#include "nsContentEventHandler.h"
#include "nsIObserverService.h"
#include "mozilla/Services.h"
/******************************************************************/
/* nsIMEStateManager */
@ -235,6 +237,28 @@ nsIMEStateManager::GetNewIMEState(nsPresContext* aPresContext,
return aContent->GetDesiredIMEState();
}
// Helper class, used for IME enabled state change notification
class IMEEnabledStateChangedEvent : public nsRunnable {
public:
IMEEnabledStateChangedEvent(PRUint32 aState)
: mState(aState)
{
}
NS_IMETHOD Run() {
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
if (observerService) {
nsAutoString state;
state.AppendInt(mState);
observerService->NotifyObservers(nsnull, "ime-enabled-state-changed", state.get());
}
return NS_OK;
}
private:
PRUint32 mState;
};
void
nsIMEStateManager::SetIMEState(PRUint32 aState,
nsIWidget* aWidget)
@ -243,6 +267,8 @@ nsIMEStateManager::SetIMEState(PRUint32 aState,
PRUint32 state =
nsContentUtils::GetWidgetStatusFromIMEStatus(aState);
aWidget->SetIMEEnabled(state);
nsContentUtils::AddScriptRunner(new IMEEnabledStateChangedEvent(state));
}
if (aState & nsIContent::IME_STATUS_MASK_OPENED) {
PRBool open = !!(aState & nsIContent::IME_STATUS_OPEN);

View File

@ -57,7 +57,7 @@
#ifdef MOZ_ENABLE_DBUS
#include "nsDBusHandlerApp.h"
#endif
#ifdef ANDROID
#if defined(ANDROID) || defined(MOZ_ENABLE_MEEGOTOUCHSHARE)
#include "nsExternalSharingAppService.h"
#endif
@ -113,7 +113,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(PlatformLocalHandlerApp_t)
#ifdef MOZ_ENABLE_DBUS
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDBusHandlerApp)
#endif
#ifdef ANDROID
#if defined(ANDROID) || defined(MOZ_ENABLE_MEEGOTOUCHSHARE)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalSharingAppService)
#endif
@ -140,7 +140,7 @@ NS_DEFINE_NAMED_CID(NS_LOCALHANDLERAPP_CID);
#ifdef MOZ_ENABLE_DBUS
NS_DEFINE_NAMED_CID(NS_DBUSHANDLERAPP_CID);
#endif
#ifdef ANDROID
#if defined(ANDROID) || defined(MOZ_ENABLE_MEEGOTOUCHSHARE)
NS_DEFINE_NAMED_CID(NS_EXTERNALSHARINGAPPSERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(NS_SHENTRY_CID);
@ -167,7 +167,7 @@ const mozilla::Module::CIDEntry kDocShellCIDs[] = {
#ifdef MOZ_ENABLE_DBUS
{ &kNS_DBUSHANDLERAPP_CID, false, NULL, nsDBusHandlerAppConstructor },
#endif
#ifdef ANDROID
#if defined(ANDROID) || defined(MOZ_ENABLE_MEEGOTOUCHSHARE)
{ &kNS_EXTERNALSHARINGAPPSERVICE_CID, false, NULL, nsExternalSharingAppServiceConstructor },
#endif
{ &kNS_SHENTRY_CID, false, NULL, nsSHEntryConstructor },
@ -212,7 +212,7 @@ const mozilla::Module::ContractIDEntry kDocShellContracts[] = {
#ifdef MOZ_ENABLE_DBUS
{ NS_DBUSHANDLERAPP_CONTRACTID, &kNS_DBUSHANDLERAPP_CID },
#endif
#ifdef ANDROID
#if defined(ANDROID) || defined(MOZ_ENABLE_MEEGOTOUCHSHARE)
{ NS_EXTERNALSHARINGAPPSERVICE_CONTRACTID, &kNS_EXTERNALSHARINGAPPSERVICE_CID },
#endif
{ NS_SHENTRY_CONTRACTID, &kNS_SHENTRY_CID },

View File

@ -530,8 +530,17 @@ bool
TabParent::RecvSetIMEEnabled(const PRUint32& aValue)
{
nsCOMPtr<nsIWidget> widget = GetWidget();
if (widget)
if (widget) {
widget->SetIMEEnabled(aValue);
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
if (observerService) {
nsAutoString state;
state.AppendInt(aValue);
observerService->NotifyObservers(nsnull, "ime-enabled-state-changed", state.get());
}
}
return true;
}

View File

@ -169,6 +169,13 @@ LOCAL_INCLUDES += $(TK_CFLAGS) $(MOZ_DBUS_CFLAGS)
EXTRA_DSO_LDOPTS += $(MOZ_DBUS_LIBS)
endif
ifdef MOZ_ENABLE_MEEGOTOUCHSHARE
OSHELPER += nsMeegoExternalSharingAppService.cpp
LOCAL_INCLUDES += $(MOZ_PLATFORM_MAEMO_CFLAGS)
EXTRA_DSO_LDOPTS += $(MOZ_PLATFORM_MAEMO_LIBS)
EXPORTS += nsExternalSharingAppService.h
endif
ifeq ($(MOZ_PLATFORM_MAEMO),5)
ifdef MOZ_ENABLE_GNOMEVFS
LOCAL_INCLUDES += $(MOZ_GNOMEVFS_CFLAGS)

View File

@ -0,0 +1,62 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Nokia Corporation Code.
*
* The Initial Developer of the Original Code is Nokia Corporation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef NS_EXTERNAL_SHARING_APP_SERVICE_H
#define NS_EXTERNAL_SHARING_APP_SERVICE_H
#include "nsIExternalSharingAppService.h"
#include "nsAutoPtr.h"
class ShareUiInterface;
#define NS_EXTERNALSHARINGAPPSERVICE_CID \
{0xea782c90, 0xc6ec, 0x11df, \
{0xbd3, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66, 0x74}}
class nsExternalSharingAppService : public nsIExternalSharingAppService
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIEXTERNALSHARINGAPPSERVICE
nsExternalSharingAppService();
private:
~nsExternalSharingAppService();
protected:
nsAutoPtr<ShareUiInterface> mShareUi;
};
#endif

View File

@ -0,0 +1,82 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Nokia Corporation Code.
*
* The Initial Developer of the Original Code is Nokia Corporation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "shareuiinterface.h"
#include <MDataUri>
#include "nsExternalSharingAppService.h"
#include "nsString.h"
NS_IMPL_ISUPPORTS1(nsExternalSharingAppService, nsIExternalSharingAppService)
nsExternalSharingAppService::nsExternalSharingAppService()
: mShareUi(nsnull)
{
}
nsExternalSharingAppService::~nsExternalSharingAppService()
{
}
NS_IMETHODIMP
nsExternalSharingAppService::ShareWithDefault(const nsAString & aData,
const nsAString & aMime,
const nsAString & aTitle)
{
if (!mShareUi)
mShareUi = new ShareUiInterface();
if (!mShareUi || !mShareUi->isValid())
return NS_ERROR_NOT_AVAILABLE;
if (aData.IsEmpty())
return NS_ERROR_INVALID_ARG;
MDataUri uri;
uri.setTextData(QString::fromUtf16(aData.BeginReading(), aData.Length()));
uri.setMimeType(QString::fromUtf16(aMime.BeginReading(), aMime.Length()));
uri.setAttribute("title", QString::fromUtf16(aTitle.BeginReading(), 0));
mShareUi->share(QStringList(uri.toString()));
return NS_OK;
}
NS_IMETHODIMP
nsExternalSharingAppService::GetSharingApps(const nsAString & aMIMEType,
PRUint32 *aLen NS_OUTPARAM,
nsISharingHandlerApp ***aHandlers NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}