hal/HalScreenConfiguration.h
author Gabriele Svelto <gsvelto@mozilla.com>
Wed, 29 Aug 2018 20:54:56 +0000
changeset 434004 000a3f46f36c9c400d35af815c7b19a9db6f7a9a
parent 189447 fcf15eb82338c3339cb39066828467b504ccc1a1
child 448947 6f3709b3878117466168c40affa7bca0b60cf75b
permissions -rw-r--r--
Bug 1486772 - Refactor the screen-orientation types and headers r=smaug This patch removes the 'ScreenOrientationInternal' type from dom/base/ScreenOrientation.h and moves it into the HalScreenConfiguration.h header, renaming it simply to 'ScreenOrientation' in the process. This has several knock-off effects: - It allows files that needed ScreenOrientationInternal to include a much smaller header than before - It greatly reduces the number of headers pulled in when including Hal.h - It clarifies the role of the type. The 'Internal' part in the name had nothing to do with it being part of the implementation. The type was public and called that way only to avoid clashing with the 'ScreenOrientation' class. Since we moved it into a different namespace it can be renamed safely. - It allows a file that was manually re-declaring 'ScreenConfigurationInternal' type to use the original one - Finally this fixes a few files which were missing headers they actually required but that would still build because unified compilation put them into units that already had those headers thanks to ScreenConfiguration.h Differential Revision: https://phabricator.services.mozilla.com/D4458

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et ft=cpp : */
/* 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/. */

#ifndef mozilla_HalScreenConfiguration_h
#define mozilla_HalScreenConfiguration_h

#include "mozilla/Observer.h"

namespace mozilla {
namespace hal {

// Make sure that any change to ScreenOrientation values are also made in
// mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoScreenOrientation.java
typedef uint32_t ScreenOrientation;

static const ScreenOrientation eScreenOrientation_None               = 0;
static const ScreenOrientation eScreenOrientation_PortraitPrimary    = 1u << 0;
static const ScreenOrientation eScreenOrientation_PortraitSecondary  = 1u << 1;
static const ScreenOrientation eScreenOrientation_LandscapePrimary   = 1u << 2;
static const ScreenOrientation eScreenOrientation_LandscapeSecondary = 1u << 3;
//eScreenOrientation_Default will use the natural orientation for the deivce,
//it could be PortraitPrimary or LandscapePrimary depends on display resolution
static const ScreenOrientation eScreenOrientation_Default            = 1u << 4;

class ScreenConfiguration;
typedef Observer<ScreenConfiguration> ScreenConfigurationObserver;

} // namespace hal
} // namespace mozilla

#endif  // mozilla_HalScreenConfiguration_h