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

This commit is contained in:
Chris Kitching
2013-11-12 10:41:01 -08:00
parent 86e0f2f22e
commit e115439e46
43 changed files with 457 additions and 1086 deletions

View File

@@ -14,6 +14,7 @@
using namespace mozilla::dom;
using namespace mozilla::hal;
using namespace mozilla::widget::android;
namespace mozilla {
namespace hal_impl {
@@ -54,97 +55,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
@@ -181,8 +140,7 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
bool
LockScreenOrientation(const ScreenOrientation& aOrientation)
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
if (!AndroidBridge::Bridge()) {
return false;
}
@@ -195,7 +153,7 @@ LockScreenOrientation(const ScreenOrientation& aOrientation)
case eScreenOrientation_LandscapeSecondary:
case eScreenOrientation_LandscapePrimary | eScreenOrientation_LandscapeSecondary:
case eScreenOrientation_Default:
bridge->LockScreenOrientation(aOrientation);
GeckoAppShell::LockScreenOrientation(aOrientation);
return true;
default:
return false;
@@ -205,12 +163,7 @@ LockScreenOrientation(const ScreenOrientation& aOrientation)
void
UnlockScreenOrientation()
{
AndroidBridge* bridge = AndroidBridge::Bridge();
if (!bridge) {
return;
}
bridge->UnlockScreenOrientation();
GeckoAppShell::UnlockScreenOrientation();
}
} // hal_impl