1370b559b082915acb99b185ed8c8e317fc654db6Steve Block/*
2370b559b082915acb99b185ed8c8e317fc654db6Steve Block * Copyright (C) 2009 Apple Inc. All rights reserved.
3370b559b082915acb99b185ed8c8e317fc654db6Steve Block *
4370b559b082915acb99b185ed8c8e317fc654db6Steve Block * Redistribution and use in source and binary forms, with or without
5370b559b082915acb99b185ed8c8e317fc654db6Steve Block * modification, are permitted provided that the following conditions
6370b559b082915acb99b185ed8c8e317fc654db6Steve Block * are met:
7370b559b082915acb99b185ed8c8e317fc654db6Steve Block * 1. Redistributions of source code must retain the above copyright
8370b559b082915acb99b185ed8c8e317fc654db6Steve Block *    notice, this list of conditions and the following disclaimer.
9370b559b082915acb99b185ed8c8e317fc654db6Steve Block * 2. Redistributions in binary form must reproduce the above copyright
10370b559b082915acb99b185ed8c8e317fc654db6Steve Block *    notice, this list of conditions and the following disclaimer in the
11370b559b082915acb99b185ed8c8e317fc654db6Steve Block *    documentation and/or other materials provided with the distribution.
12370b559b082915acb99b185ed8c8e317fc654db6Steve Block *
13370b559b082915acb99b185ed8c8e317fc654db6Steve Block * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14370b559b082915acb99b185ed8c8e317fc654db6Steve Block * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15370b559b082915acb99b185ed8c8e317fc654db6Steve Block * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16370b559b082915acb99b185ed8c8e317fc654db6Steve Block * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17370b559b082915acb99b185ed8c8e317fc654db6Steve Block * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18370b559b082915acb99b185ed8c8e317fc654db6Steve Block * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19370b559b082915acb99b185ed8c8e317fc654db6Steve Block * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20370b559b082915acb99b185ed8c8e317fc654db6Steve Block * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21370b559b082915acb99b185ed8c8e317fc654db6Steve Block * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22370b559b082915acb99b185ed8c8e317fc654db6Steve Block * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23370b559b082915acb99b185ed8c8e317fc654db6Steve Block * THE POSSIBILITY OF SUCH DAMAGE.
24370b559b082915acb99b185ed8c8e317fc654db6Steve Block */
25370b559b082915acb99b185ed8c8e317fc654db6Steve Block
26370b559b082915acb99b185ed8c8e317fc654db6Steve Block#ifndef GeolocationError_h
27370b559b082915acb99b185ed8c8e317fc654db6Steve Block#define GeolocationError_h
28370b559b082915acb99b185ed8c8e317fc654db6Steve Block
29370b559b082915acb99b185ed8c8e317fc654db6Steve Block#if ENABLE(CLIENT_BASED_GEOLOCATION)
30370b559b082915acb99b185ed8c8e317fc654db6Steve Block
31370b559b082915acb99b185ed8c8e317fc654db6Steve Block#include "PlatformString.h"
32370b559b082915acb99b185ed8c8e317fc654db6Steve Block#include <wtf/PassRefPtr.h>
33d0825bca7fe65beaee391d30da42e937db621564Steve Block#include <wtf/RefCounted.h>
34370b559b082915acb99b185ed8c8e317fc654db6Steve Block#include <wtf/RefPtr.h>
35370b559b082915acb99b185ed8c8e317fc654db6Steve Block
36370b559b082915acb99b185ed8c8e317fc654db6Steve Blocknamespace WebCore {
37370b559b082915acb99b185ed8c8e317fc654db6Steve Block
38370b559b082915acb99b185ed8c8e317fc654db6Steve Blockclass GeolocationError : public RefCounted<GeolocationError> {
39370b559b082915acb99b185ed8c8e317fc654db6Steve Blockpublic:
40370b559b082915acb99b185ed8c8e317fc654db6Steve Block    enum ErrorCode {
41370b559b082915acb99b185ed8c8e317fc654db6Steve Block        PermissionDenied,
42370b559b082915acb99b185ed8c8e317fc654db6Steve Block        PositionUnavailable
43370b559b082915acb99b185ed8c8e317fc654db6Steve Block    };
44370b559b082915acb99b185ed8c8e317fc654db6Steve Block
45370b559b082915acb99b185ed8c8e317fc654db6Steve Block    static PassRefPtr<GeolocationError> create(ErrorCode code, const String& message) { return adoptRef(new GeolocationError(code, message)); }
46370b559b082915acb99b185ed8c8e317fc654db6Steve Block
47370b559b082915acb99b185ed8c8e317fc654db6Steve Block    ErrorCode code() const { return m_code; }
48370b559b082915acb99b185ed8c8e317fc654db6Steve Block    const String& message() const { return m_message; }
49370b559b082915acb99b185ed8c8e317fc654db6Steve Block
50370b559b082915acb99b185ed8c8e317fc654db6Steve Blockprivate:
51d0825bca7fe65beaee391d30da42e937db621564Steve Block    GeolocationError(ErrorCode code, const String& message)
52d0825bca7fe65beaee391d30da42e937db621564Steve Block        : m_code(code)
53d0825bca7fe65beaee391d30da42e937db621564Steve Block        , m_message(message)
54d0825bca7fe65beaee391d30da42e937db621564Steve Block    {
55d0825bca7fe65beaee391d30da42e937db621564Steve Block    }
56370b559b082915acb99b185ed8c8e317fc654db6Steve Block
57370b559b082915acb99b185ed8c8e317fc654db6Steve Block    ErrorCode m_code;
58370b559b082915acb99b185ed8c8e317fc654db6Steve Block    String m_message;
59370b559b082915acb99b185ed8c8e317fc654db6Steve Block};
60370b559b082915acb99b185ed8c8e317fc654db6Steve Block
61370b559b082915acb99b185ed8c8e317fc654db6Steve Block} // namespace WebCore
62370b559b082915acb99b185ed8c8e317fc654db6Steve Block
63370b559b082915acb99b185ed8c8e317fc654db6Steve Block#endif // ENABLE(CLIENT_BASED_GEOLOCATION)
64370b559b082915acb99b185ed8c8e317fc654db6Steve Block
65370b559b082915acb99b185ed8c8e317fc654db6Steve Block#endif // GeolocationError_h
66