Bug 913985: Part 5 - Refactor the Bridge to use the generated code. r=kats

This commit is contained in:
Chris Kitching
2013-09-27 10:10:37 -04:00
parent 17dfbc09a5
commit 7f31c5a3c8
43 changed files with 461 additions and 1087 deletions

View File

@@ -13,6 +13,7 @@
using namespace mozilla::dom;
using namespace mozilla::hal;
using namespace mozilla::widget::android;
namespace mozilla {
namespace hal_impl {
@@ -53,97 +54,55 @@ CancelVibrate(const WindowIdentifier &)
{
// Ignore WindowIdentifier parameter.
AndroidBridge* b = AndroidBridge::Bridge();
if (b)
b->CancelVibrate();
GeckoAppShell::CancelVibrate();
}
void
EnableBatteryNotifications()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->EnableBatteryNotifications();
GeckoAppShell::EnableBatteryNotifications();
}
void
DisableBatteryNotifications()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->DisableBatteryNotifications();
GeckoAppShell::DisableBatteryNotifications();
}
void
GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo)
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->GetCurrentBatteryInformation(aBatteryInfo);
AndroidBridge::Bridge()->GetCurrentBatteryInformation(aBatteryInfo);
}
void
EnableNetworkNotifications()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->EnableNetworkNotifications();
GeckoAppShell::EnableNetworkNotifications();
}
void
DisableNetworkNotifications()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->DisableNetworkNotifications();
GeckoAppShell::DisableNetworkNotifications();
}
void
GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo)
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->GetCurrentNetworkInformation(aNetworkInfo);
AndroidBridge::Bridge()->GetCurrentNetworkInformation(aNetworkInfo);
}
void
EnableScreenConfigurationNotifications()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->EnableScreenOrientationNotifications();
GeckoAppShell::EnableScreenOrientationNotifications();
}
void
DisableScreenConfigurationNotifications()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->DisableScreenOrientationNotifications();
GeckoAppShell::DisableScreenOrientationNotifications();
}
void
@@ -180,8 +139,7 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
bool
LockScreenOrientation(const ScreenOrientation& aOrientation)
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
if (!AndroidBridge::Bridge()) {
return false;
}
@@ -193,7 +151,7 @@ LockScreenOrientation(const ScreenOrientation& aOrientation)
case eScreenOrientation_LandscapePrimary:
case eScreenOrientation_LandscapeSecondary:
case eScreenOrientation_LandscapePrimary | eScreenOrientation_LandscapeSecondary:
bridge->LockScreenOrientation(aOrientation);
GeckoAppShell::LockScreenOrientation(aOrientation);
return true;
default:
return false;
@@ -203,12 +161,7 @@ LockScreenOrientation(const ScreenOrientation& aOrientation)
void
UnlockScreenOrientation()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->UnlockScreenOrientation();
GeckoAppShell::UnlockScreenOrientation();
}
} // hal_impl