# Copyright (C) 2012 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1.  Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
# 2.  Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#if ENABLE(NETWORK_PROCESS)

messages -> NetworkProcess LegacyReceiver {
    # Initializes the network process.
    InitializeNetworkProcess(WebKit::NetworkProcessCreationParameters processCreationParameters)

    # Creates a connection for communication with a WebProcess
    CreateNetworkConnectionToWebProcess()

    EnsurePrivateBrowsingSession()
    DestroyPrivateBrowsingSession()

    DownloadRequest(uint64_t downloadID, WebCore::ResourceRequest request)
    CancelDownload(uint64_t downloadID)

#if PLATFORM(MAC)
    SetProcessSuppressionEnabled(bool flag)
#endif

    AllowSpecificHTTPSCertificateForHost(WebKit::PlatformCertificateInfo certificate, WTF::String host)
    
    GetNetworkProcessStatistics(uint64_t callbackID)
    
    ClearCacheForAllOrigins(uint32_t cachesToClear)
}

#endif // ENABLE(NETWORK_PROCESS)
