# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.

Headers = [
    '/layout/build/nsLayoutModule.h',
]

UnloadFunc = 'nsLayoutModuleDtor'

# This module's unload function needs to be called as late as possible.
Priority = 100

content_types = [
    'application/mathml+xml',
    'application/rdf+xml',
    'application/vnd.wap.xhtml+xml',
    'application/x-view-source',
    'application/xhtml+xml',
    'application/xml',
    'image/svg+xml',
    'text/html',
    'text/plain',
    'text/rdf',
    'text/vtt',
    'text/xml',

    'image/apng',
    'image/bmp',
    'image/gif',
    'image/icon',
    'image/jpeg',
    'image/jpg',
    'image/pjpeg',
    'image/png',
    'image/vnd.microsoft.icon',
    'image/webp',
    'image/x-icon',
    'image/x-ms-bmp',
    'image/x-png',
]

if defined('MOZ_WEBM'):
    content_types += [
        "audio/webm",
        "video/webm",
    ]

Classes = [
    {
        'cid': '{574ce83e-fe9f-4095-b85c-7909abbf7c37}',
        'type': 'nsJSURI::Mutator',
        'headers': ['nsJSProtocolHandler.h'],
    },
    {
        'cid': '{58f089ee-512a-42d2-a935-d0c874128930}',
        'type': 'nsJSURI::Mutator',
        'headers': ['nsJSProtocolHandler.h'],
    },
    {
        'cid': '{48118355-e9a5-4452-ab18-59cc426fb817}',
        'type': 'nsIDocumentViewer',
    },
    {
        'cid': '{f4fecc26-02fe-46dc-935c-4d6f9acb18a6}',
        'type': 'nsOpenWindowInfo',
        'headers': ['nsOpenWindowInfo.h']
    },
    {
        'cid': '{bbe50ef2-80eb-469d-b70d-02858275389f}',
        'type': 'mozilla::dom::BlobURL::Mutator',
        'headers': ['mozilla/dom/BlobURL.h'],
    },
    {
        'cid': '{f5475c51-59a7-4757-b3d9-e211a9410872}',
        'type': 'mozilla::dom::BlobURL::Mutator',
        'headers': ['mozilla/dom/BlobURL.h'],
    },
    {
        'js_name': 'cpmm',
        'cid': '{fe0ff7c3-8e97-448b-9a8a-86afdb9fbbb6}',
        'contract_ids': ['@mozilla.org/childprocessmessagemanager;1'],
        'legacy_constructor': 'CreateChildMessageManager',
    },
    {
        'cid': '{fc886801-e768-11d4-9885-00c04fa0cf4b}',
        'contract_ids': ['@mozilla.org/content/document-loader-factory;1'],
        'type': 'nsIDocumentLoaderFactory',
        'categories': {
            'Gecko-Content-Viewers': {
                'name': content_types,
                'backgroundtasks': BackgroundTasksSelector.ALL_TASKS,
            }
        },
    },
    {
        'cid': '{0ddf4df8-4dbb-4133-8b79-9afb966514f5}',
        'contract_ids': ['@mozilla.org/content/plugin/document-loader-factory;1'],
        'type': 'nsIDocumentLoaderFactory',
    },
    {
        'cid': '{3b55e72e-ab7e-431b-89c0-3b06a8b14016}',
        'contract_ids': ['@mozilla.org/content/style-sheet-service;1'],
        'type': 'nsStyleSheetService',
        'headers': ['nsStyleSheetService.h'],
        'init_method': 'Init',
    },
    {
        'name': 'ContentSecurityManager',
        'cid': '{cdcc1ab8-3cea-4e6c-a294-a651fa35227f}',
        'contract_ids': ['@mozilla.org/contentsecuritymanager;1'],
        'type': 'nsContentSecurityManager',
        'headers': ['mozilla/dom/nsContentSecurityManager.h'],
    },
    {
        'cid': '{09d9ed1a-e5d4-4004-bfe0-27ceb923d9ac}',
        'contract_ids': ['@mozilla.org/cspcontext;1'],
        'type': 'nsCSPContext',
        'headers': ['mozilla/dom/nsCSPContext.h'],
    },
    {
        'cid': '{8d2f40b2-4875-4c95-97d9-3f7dca2cb460}',
        'contract_ids': ['@mozilla.org/cspservice;1'],
        'type': 'CSPService',
        'headers': ['mozilla/dom/nsCSPService.h'],
        'categories': {'content-policy': 'CSPService', 'net-channel-event-sinks': 'CSPService'},
    },
    {
        'cid': '{4812ff32-1bff-423b-97fc-40a5696dad22}',
        'contract_ids': ['@mozilla.org/integritypolicy;1'],
        'type': 'mozilla::dom::IntegrityPolicy',
        'headers': ['mozilla/dom/IntegrityPolicy.h'],
    },
    {
        'cid': '{3662958c-0e34-4f57-bc6d-2accdeb4342e}',
        'contract_ids': ['@mozilla.org/integritypolicyservice;1'],
        'type': 'mozilla::dom::IntegrityPolicyService',
        'headers': ['mozilla/dom/IntegrityPolicyService.h'],
        'categories': {'content-policy': '@mozilla.org/integritypolicyservice;1'},
    },
    {
        'cid': '{1147d32c-215b-4014-b180-07fe7aedf915}',
        'contract_ids': ['@mozilla.org/data-document-content-policy;1'],
        'type': 'nsDataDocumentContentPolicy',
        'headers': ['/dom/base/nsDataDocumentContentPolicy.h'],
        'categories': {'content-policy': '@mozilla.org/data-document-content-policy;1'},
    },
    {
        'cid': '{ecba5203-77da-465a-865e-78b7af10d8f7}',
        'contract_ids': ['@mozilla.org/devicesensors;1'],
        'type': 'nsDeviceSensors',
        'headers': ['nsDeviceSensors.h'],
    },
    {
        'cid': '{38bd0634-0fd4-46f0-b85f-13ced889eeec}',
        'contract_ids': ['@mozilla.org/docshell/structured-clone-container;1'],
        'type': 'nsStructuredCloneContainer',
        'headers': ['nsStructuredCloneContainer.h'],
    },
    {
        'js_name': 'domStorageManager',
        'cid': '{656db07c-aa80-49e4-bce8-e431baae697d}',
        'contract_ids': ['@mozilla.org/dom/localStorage-manager;1'],
        'interfaces': ['nsIDOMStorageManager', 'nsILocalStorageManager'],
        'legacy_constructor': 'LocalStorageManagerConstructor',
    },
    {
        'cid': '{64e4bf03-773e-408e-939a-e11652fdfd28}',
        'contract_ids': ['@mozilla.org/dom/sessionStorage-manager;1'],
        'legacy_constructor': 'SessionStorageManagerConstructor',
    },
    {
        'js_name': 'qms',
        'cid': '{5a75c25a-5e7e-4d90-8f7c-07eb15cc0aa8}',
        'contract_ids': ['@mozilla.org/dom/quota-manager-service;1'],
        'interfaces': ['nsIQuotaManagerService'],
        'singleton': True,
        'type': 'mozilla::dom::quota::QuotaManagerService',
        'headers': ['mozilla/dom/quota/QuotaManagerService.h'],
        'constructor': 'mozilla::dom::quota::QuotaManagerService::FactoryCreate',
        'categories': {'idle-daily': 'QuotaManagerService'},
    },
    {
        'cid': '{ae2793c0-2ba3-4adb-9c5e-c23525812c64}',
        'contract_ids': ['@mozilla.org/dom/sdb-connection;1'],
        'legacy_constructor': 'mozilla::dom::SDBConnection::Create',
        'headers': ['mozilla/dom/SDBConnection.h'],
    },
    {
        'cid': '{62ec8731-55ad-4246-b2ea-f26c1fe19d2d}',
        'contract_ids': ['@mozilla.org/dom/workers/workerdebuggermanager;1'],
        'singleton': True,
        'type': 'mozilla::dom::WorkerDebuggerManager',
        'headers': ['mozilla/dom/WorkerDebuggerManager.h'],
        'constructor': 'mozilla::dom::WorkerDebuggerManager::GetInstance',
    },
    {
        'js_name': 'els',
        'cid': '{baa34652-f1f1-4185-b224-244ee82a413a}',
        'contract_ids': ['@mozilla.org/eventlistenerservice;1'],
        'interfaces': ['nsIEventListenerService'],
        'type': 'nsIEventListenerService',
    },
    {
        'cid': '{e8ee88b0-5571-4086-a45b-39a716906bdb}',
        'contract_ids': [],
        'type': 'ExpandedPrincipal::Deserializer',
        'headers': ['/caps/ExpandedPrincipal.h'],
    },
    {
        'js_name': 'focus',
        'cid': '{cf7fd51f-aba2-44c1-9ff0-11f7508efcd4}',
        'contract_ids': ['@mozilla.org/focus-manager;1'],
        'interfaces': ['nsIFocusManager'],
        'type': 'nsIFocusManager',
    },
    {
        'cid': '{7b121f7e-ebe4-43ab-9410-dc9087a1dba6}',
        'contract_ids': ['@mozilla.org/gecko-media-plugin-service;1'],
        'singleton': True,
        'type': 'mozilla::gmp::GeckoMediaPluginService',
        'headers': ['GMPService.h'],
        'constructor': 'mozilla::gmp::GeckoMediaPluginService::GetGeckoMediaPluginService',
    },
    {
        'cid': '{01e1c3ff-094a-d048-44b4-62d29c7b4f39}',
        'contract_ids': ['@mozilla.org/geolocation;1'],
        'singleton': True,
        'type': 'mozilla::dom::Geolocation',
        'headers': ['/dom/geolocation/Geolocation.h'],
        'constructor': 'mozilla::dom::Geolocation::NonWindowSingleton',
    },
    {
        'js_name': 'mm',
        'cid': '{130b016f-fad7-4526-bc7f-827dabf79265}',
        'contract_ids': ['@mozilla.org/globalmessagemanager;1'],
        'legacy_constructor': 'CreateGlobalMessageManager',
    },
    {
        'cid': '{bfcb82c2-5611-4318-90d6-baf4a7864252}',
        'contract_ids': ['@mozilla.org/inspector/deep-tree-walker;1'],
        'type': 'inDeepTreeWalker',
        'headers': ['/layout/inspector/inDeepTreeWalker.h'],
    },
    {
        'cid': '{0e3afd3d-eb60-4c2b-963b-56d7c439f124}',
        'contract_ids': ['@mozilla.org/layout/content-policy;1'],
        'legacy_constructor': 'CreateContentPolicy',
    },
    {
        'cid': '{4aef38b7-6364-4e23-a5e7-12f837fbbd9c}',
        'contract_ids': [
            '@mozilla.org/layout/contentserializer;1?mimetype=application/vnd.mozilla.xul+xml',
            '@mozilla.org/layout/contentserializer;1?mimetype=application/xml',
            '@mozilla.org/layout/contentserializer;1?mimetype=image/svg+xml',
            '@mozilla.org/layout/contentserializer;1?mimetype=text/xml',
        ],
        'type': 'nsIContentSerializer',
        'legacy_constructor': 'CreateXMLContentSerializer',
    },
    {
        'cid': '{e7c2aaf5-c11a-4954-9dbf-e28edec1fd91}',
        'contract_ids': ['@mozilla.org/layout/contentserializer;1?mimetype=application/xhtml+xml'],
        'legacy_constructor': 'CreateXHTMLContentSerializer',
    },
    {
        'cid': '{9d3f70da-86e9-11d4-95ec-00b0d03e37b7}',
        'contract_ids': ['@mozilla.org/layout/contentserializer;1?mimetype=text/html'],
        'type': 'nsIContentSerializer',
        'legacy_constructor': 'CreateHTMLContentSerializer',
    },
    {
        'cid': '{6030f7ef-32ed-46a7-9a63-6a5d3f90445f}',
        'contract_ids': ['@mozilla.org/layout/contentserializer;1?mimetype=text/plain'],
        'legacy_constructor': 'CreatePlainTextSerializer',
    },
    {
        'cid': '{abc622ea-9655-4123-80d9-22621bdd5465}',
        'contract_ids': ['@mozilla.org/mediaManagerService;1'],
        'singleton': True,
        'type': 'nsIMediaManagerService',
        'headers': ['mozilla/MediaManager.h'],
        'constructor': 'mozilla::MediaManager::GetInstance',
    },
    {
        'cid': '{daf1461b-bf29-4f88-8d0e-4bcdf332c862}',
        'contract_ids': ['@mozilla.org/mixedcontentblocker;1'],
        'type': 'nsMixedContentBlocker',
        'headers': ['mozilla/dom/nsMixedContentBlocker.h'],
        'categories': {
            'content-policy': {
                'name': '@mozilla.org/mixedcontentblocker;1',
                'backgroundtasks': BackgroundTasksSelector.ALL_TASKS,
            },
            'net-channel-event-sinks': {
                'name': '@mozilla.org/mixedcontentblocker;1',
                'backgroundtasks': BackgroundTasksSelector.ALL_TASKS,
            },
        },
    },
    {
        'cid': '{041a129f-10ce-4bda-a60d-e027a26d5ed0}',
        'contract_ids': ['@mozilla.org/referrer-info;1'],
        'type': 'mozilla::dom::ReferrerInfo',
        'headers': ['mozilla/dom/ReferrerInfo.h'],
    },
    {
        'cid': '{bfc310d2-38a0-11d3-8cd3-0060b0fc14a3}',
        'contract_ids': ['@mozilla.org/network/protocol;1?name=javascript'],
        'type': 'nsJSProtocolHandler',
        'headers': ['nsJSProtocolHandler.h'],
        'protocol_config': {
            'scheme': 'javascript',
            'flags': [
                'URI_NORELATIVE',
                'URI_NOAUTH',
                'URI_INHERITS_SECURITY_CONTEXT',
                'URI_LOADABLE_BY_ANYONE',
                'URI_NON_PERSISTABLE',
                'URI_OPENING_EXECUTES_SCRIPT',
            ],
        },
    },
    {
        'cid': '{ac9e3e82-bfbd-4f26-941e-f58c8ee178c1}',
        'contract_ids': ['@mozilla.org/no-data-protocol-content-policy;1'],
        'type': 'nsNoDataProtocolContentPolicy',
        'headers': ['/dom/base/nsNoDataProtocolContentPolicy.h'],
        'categories': {'content-policy': '@mozilla.org/no-data-protocol-content-policy;1'},
    },
    {
        'cid': '{bd066e5f-146f-4472-8331-7bfd05b1ed90}',
        'contract_ids': [],
        'type': 'mozilla::NullPrincipal::Deserializer',
        'headers': ['/caps/NullPrincipal.h'],
    },
    {
        'js_name': 'ppmm',
        'cid': '{2a058404-fb85-44ec-8cfd-e8cbdc988dc1}',
        'contract_ids': ['@mozilla.org/parentprocessmessagemanager;1'],
        'legacy_constructor': 'CreateParentMessageManager',
    },
    {
        'cid': '{af7b24cb-893f-41bb-961f-5a69388e27c3}',
        'contract_ids': ['@mozilla.org/parserutils;1'],
        'type': 'nsParserUtils',
        'headers': ['nsParserUtils.h'],
    },
    {
        'cid': '{653e0e4d-3ee4-45fa-b272-97c20bc01eb8}',
        'contract_ids': [],
        'type': 'mozilla::ContentPrincipal::Deserializer',
        'headers': ['/caps/ContentPrincipal.h'],
    },
    {
        'cid': '{2fc2d3e3-020f-404e-b06a-6ecf3ea2334a}',
        'contract_ids': ['@mozilla.org/push/Notifier;1'],
        'type': 'mozilla::dom::PushNotifier',
        'headers': ['mozilla/dom/PushNotifier.h'],
    },
    {
        'cid': '{f68037ec-2790-44c5-8e5f-df5da58b93a7}',
        'contract_ids': ['@mozilla.org/scriptable-content-iterator;1'],
        'type': 'ScriptableContentIterator',
        'headers': ['mozilla/ScriptableContentIterator.h'],
    },
    {
        'cid': '{1950539a-90f0-4d22-b5af-71329c68fa35}',
        'contract_ids': ['@mozilla.org/scripterror;1'],
        'type': 'nsScriptError',
        'headers': ['/dom/bindings/nsScriptError.h'],
    },
    {
        'name': 'ScriptSecurityManager',
        'js_name': 'scriptSecurityManager',
        'cid': '{7ee2a4c0-4b93-17d3-ba18-0060b0f199a2}',
        'contract_ids': ['@mozilla.org/scriptsecuritymanager;1'],
        'interfaces': ['nsIScriptSecurityManager'],
        'legacy_constructor': 'Construct_nsIScriptSecurityManager',
    },
    {
        'name': 'ServiceWorkerManager',
        'cid': '{c74bde32-bcc7-4840-8430-c733351b212a}',
        'contract_ids': ['@mozilla.org/serviceworkers/manager;1'],
        'singleton': True,
        'type': 'mozilla::dom::ServiceWorkerManager',
        'headers': ['mozilla/dom/ServiceWorkerManager.h'],
        'constructor': 'mozilla::dom::ServiceWorkerManager::GetInstance',
    },
    {
        'cid': '{69da374a-fda3-4a93-9fbc-d9304f66a7fe}',
        'contract_ids': ['@mozilla.org/storage/activity-service;1'],
        'singleton': True,
        'type': 'mozilla::dom::StorageActivityService',
        'headers': ['mozilla/StaticPtr.h', 'mozilla/dom/StorageActivityService.h'],
        'constructor': 'mozilla::dom::StorageActivityService::GetOrCreate',
    },
    {
        'cid': '{4a6212db-accb-11d3-b765-0060b0b6cecb}',
        'contract_ids': ['@mozilla.org/systemprincipal;1'],
        'singleton': True,
        'type': 'nsIPrincipal',
        'headers': ['nsScriptSecurityManager.h', '/caps/SystemPrincipal.h'],
        'constructor': 'nsScriptSecurityManager::SystemPrincipalSingletonConstructor',
    },
    {
        'cid': '{caaab47f-1e31-478e-8919-970904e9cb72}',
        'contract_ids': ['@mozilla.org/text-input-processor;1'],
        'type': 'mozilla::TextInputProcessor',
        'headers': ['mozilla/TextInputProcessor.h'],
    },
    {
        'name': 'ThirdPartyUtil',
        'cid': '{08c6cc8b-cfb0-421d-b1f7-683ff2989681}',
        'contract_ids': ['@mozilla.org/thirdpartyutil;1'],
        'type': 'ThirdPartyUtil',
        'headers': ['/dom/base/ThirdPartyUtil.h'],
        'init_method': 'Init',
    },
    {
        'cid': '{31689828-da66-49a6-870c-df62b83fe789}',
        'contract_ids': ['@mozilla.org/websocketevent/service;1'],
        'singleton': True,
        'type': 'mozilla::net::WebSocketEventService',
        'headers': ['mozilla/net/WebSocketEventService.h'],
        'constructor': 'mozilla::net::WebSocketEventService::GetOrCreate',
    },
    {
        'cid': '{abfbb785-5a44-49cf-88db-2f300bf727c9}',
        'contract_ids': ['@mozilla.org/eventsourceevent/service;1'],
        'singleton': True,
        'type': 'mozilla::dom::EventSourceEventService',
        'headers': ['mozilla/dom/EventSourceEventService.h'],
        'constructor': 'mozilla::dom::EventSourceEventService::GetOrCreate',
    },
]

if defined('MOZ_WEBSPEECH'):
    Classes += [
        {
            'cid': '{7090524d-5574-4492-a77f-d8d558ced59d}',
            'contract_ids': ['@mozilla.org/synth-voice-registry;1'],
            'singleton': True,
            'type': 'mozilla::dom::nsSynthVoiceRegistry',
            'headers': ['mozilla/dom/nsSynthVoiceRegistry.h'],
            'constructor': 'mozilla::dom::nsSynthVoiceRegistry::GetInstanceForService',
        },
        {
            'cid': '{0ff5ce56-5b09-4db8-adc6-8266af95f864}',
            'contract_ids': ['@mozilla.org/webspeech/service;1?name=online'],
            'type': 'mozilla::OnlineSpeechRecognitionService',
            'headers': ['mozilla/dom/OnlineSpeechRecognitionService.h'],
        },
    ]

if defined('MOZ_WEBSPEECH_TEST_BACKEND'):
    Classes += [
        {
            'cid': '{48c345e7-9929-4f9a-a563-f478222dabcd}',
            'contract_ids': ['@mozilla.org/webspeech/service;1?name=fake'],
            'type': 'mozilla::FakeSpeechRecognitionService',
            'headers': ['mozilla/dom/FakeSpeechRecognitionService.h'],
        },
    ]

if defined('ACCESSIBILITY'):
    Classes += [
        {
            'cid': '{3b265b69-f813-48ff-880d-d88d101af404}',
            'contract_ids': ['@mozilla.org/accessibilityService;1'],
            'type': 'nsIAccessibilityService',
        },
    ]

if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'android':
    Classes += [
        {
            'cid': '{1f15dbc8-bfaa-45de-8a46-08e2e26326b0}',
            'contract_ids': ['@mozilla.org/widget/hapticfeedback;1'],
            'type': 'nsHapticFeedback',
            'headers': ['/dom/system/nsHapticFeedback.h'],
        },
    ]
