2010-11-23 John Knottenbelt <jknotten@chromium.org>

        Reviewed by Darin Fisher.

        [Chromium] Introduce wrapper types for WebCore::GeolocationError, WebCore::GeolocationPosition.
        https://bugs.webkit.org/show_bug.cgi?id=49735

        Introduce WebKit API types so that the browser implementation can feed
        position and error updates to the WebCore::GeolocationController.

        * WebKit.gyp:
        * public/WebGeolocationError.h: Added.
        (WebKit::WebGeolocationError::WebGeolocationError):
        (WebKit::WebGeolocationError::~WebGeolocationError):
        * public/WebGeolocationPosition.h: Added.
        (WebKit::WebGeolocationPosition::WebGeolocationPosition):
        (WebKit::WebGeolocationPosition::~WebGeolocationPosition):
        * src/WebGeolocationError.cpp: Added.
        (WebKit::WebGeolocationError::assign):
        (WebKit::WebGeolocationError::reset):
        (WebKit::WebGeolocationError::WebGeolocationError):
        (WebKit::WebGeolocationError::operator=):
        (WebKit::WebGeolocationError::operator WTF::PassRefPtr<WebCore::GeolocationError>):
        * src/WebGeolocationPosition.cpp: Added.
        (WebKit::WebGeolocationPosition::assign):
        (WebKit::WebGeolocationPosition::reset):
        (WebKit::WebGeolocationPosition::operator=):
        (WebKit::WebGeolocationPosition::operator PassRefPtr<WebCore::GeolocationPosition>):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e4f54c9f
2010-11-23 John Knottenbelt <jknotten@chromium.org>
Reviewed by Darin Fisher.
[Chromium] Introduce wrapper types for WebCore::GeolocationError, WebCore::GeolocationPosition.
https://bugs.webkit.org/show_bug.cgi?id=49735
Introduce WebKit API types so that the browser implementation can feed
position and error updates to the WebCore::GeolocationController.
* WebKit.gyp:
* public/WebGeolocationError.h: Added.
(WebKit::WebGeolocationError::WebGeolocationError):
(WebKit::WebGeolocationError::~WebGeolocationError):
* public/WebGeolocationPosition.h: Added.
(WebKit::WebGeolocationPosition::WebGeolocationPosition):
(WebKit::WebGeolocationPosition::~WebGeolocationPosition):
* src/WebGeolocationError.cpp: Added.
(WebKit::WebGeolocationError::assign):
(WebKit::WebGeolocationError::reset):
(WebKit::WebGeolocationError::WebGeolocationError):
(WebKit::WebGeolocationError::operator=):
(WebKit::WebGeolocationError::operator WTF::PassRefPtr<WebCore::GeolocationError>):
* src/WebGeolocationPosition.cpp: Added.
(WebKit::WebGeolocationPosition::assign):
(WebKit::WebGeolocationPosition::reset):
(WebKit::WebGeolocationPosition::operator=):
(WebKit::WebGeolocationPosition::operator PassRefPtr<WebCore::GeolocationPosition>):
2010-11-23 Jonathan Backer <backer@chromium.org>
Reviewed by Kenneth Russell.
......
......@@ -173,6 +173,8 @@
'public/WebFontCache.h',
'public/WebFormControlElement.h',
'public/WebFormElement.h',
'public/WebGeolocationError.h',
'public/WebGeolocationPosition.h',
'public/WebGeolocationService.h',
'public/WebGeolocationServiceBridge.h',
'public/WebGeolocationServiceMock.h',
......@@ -442,6 +444,8 @@
'src/WebFormElement.cpp',
'src/WebFrameImpl.cpp',
'src/WebFrameImpl.h',
'src/WebGeolocationError.cpp',
'src/WebGeolocationPosition.cpp',
'src/WebGeolocationServiceBridgeImpl.cpp',
'src/WebGeolocationServiceBridgeImpl.h',
'src/WebGeolocationServiceMock.cpp',
......@@ -666,6 +670,11 @@
['exclude', 'WebGeolocationService.*$'],
['include', 'WebGeolocationServiceMock.*'],
],
}, {
'sources/': [
['exclude', 'WebGeolocationError.*'],
['exclude', 'WebGeolocationPosition.*'],
],
}]
],
},
......
/*
* Copyright (C) 2010 Google 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 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 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.
*/
#ifndef WebGeolocationError_h
#define WebGeolocationError_h
#include "WebCommon.h"
#include "WebPrivatePtr.h"
#if WEBKIT_IMPLEMENTATION
#include <wtf/PassRefPtr.h>
namespace WebCore { class GeolocationError; }
#endif
namespace WebKit {
class WebString;
class WebGeolocationError {
public:
enum Error {
ErrorPermissionDenied,
ErrorPositionUnavailable
};
WebGeolocationError(Error code, const WebString& message) { assign(code, message); }
WebGeolocationError(const WebGeolocationError& other) { assign(other); }
~WebGeolocationError() { reset(); }
WEBKIT_API void assign(Error code, const WebString& message);
WEBKIT_API void assign(const WebGeolocationError&);
WEBKIT_API void reset();
#if WEBKIT_IMPLEMENTATION
WebGeolocationError(WTF::PassRefPtr<WebCore::GeolocationError>);
WebGeolocationError& operator=(WTF::PassRefPtr<WebCore::GeolocationError>);
operator WTF::PassRefPtr<WebCore::GeolocationError>() const;
#endif
private:
WebPrivatePtr<WebCore::GeolocationError> m_private;
};
} // namespace WebKit
#endif // WebGeolocationError_h
/*
* Copyright (C) 2010 Google 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 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 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.
*/
#ifndef WebGeolocationPosition_h
#define WebGeolocationPosition_h
#include "WebCommon.h"
#include "WebPrivatePtr.h"
#if WEBKIT_IMPLEMENTATION
#include <wtf/PassRefPtr.h>
namespace WebCore { class GeolocationPosition; }
#endif
namespace WebKit {
class WebGeolocationPosition {
public:
WebGeolocationPosition() {}
WebGeolocationPosition(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
{
assign(timestamp, latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed);
}
WebGeolocationPosition(const WebGeolocationPosition& other) { assign(other); }
~WebGeolocationPosition() { reset(); }
WEBKIT_API void assign(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed);
WEBKIT_API void assign(const WebGeolocationPosition&);
WEBKIT_API void reset();
#if WEBKIT_IMPLEMENTATION
WebGeolocationPosition(WTF::PassRefPtr<WebCore::GeolocationPosition>);
WebGeolocationPosition& operator=(WTF::PassRefPtr<WebCore::GeolocationPosition>);
operator WTF::PassRefPtr<WebCore::GeolocationPosition>() const;
#endif
private:
WebPrivatePtr<WebCore::GeolocationPosition> m_private;
};
} // namespace WebKit
#endif // WebGeolocationPosition_h
......@@ -41,6 +41,8 @@
#include "FileMetadata.h"
#include "FontDescription.h"
#include "FontSmoothingMode.h"
#include "GeolocationError.h"
#include "GeolocationPosition.h"
#include "HTMLInputElement.h"
#include "IDBKey.h"
#include "MediaPlayer.h"
......@@ -62,6 +64,8 @@
#include "WebFileInfo.h"
#include "WebFileSystem.h"
#include "WebFontDescription.h"
#include "WebGeolocationError.h"
#include "WebGeolocationPosition.h"
#include "WebIDBKey.h"
#include "WebInputElement.h"
#include "WebMediaPlayer.h"
......@@ -383,3 +387,8 @@ COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorInvalidModification, FileError::INVALID
COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorQuotaExceeded, FileError::QUOTA_EXCEEDED_ERR);
COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorTypeMismatch, FileError::TYPE_MISMATCH_ERR);
COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorPathExists, FileError::PATH_EXISTS_ERR);
#if ENABLE(CLIENT_BASED_GEOLOCATION)
COMPILE_ASSERT_MATCHING_ENUM(WebGeolocationError::ErrorPermissionDenied, GeolocationError::PermissionDenied);
COMPILE_ASSERT_MATCHING_ENUM(WebGeolocationError::ErrorPositionUnavailable, GeolocationError::PositionUnavailable);
#endif
/*
* Copyright (C) 2010 Google 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 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 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.
*/
#include "config.h"
#include "WebGeolocationError.h"
#include "GeolocationError.h"
#include "WebString.h"
using namespace WebCore;
namespace WebKit {
void WebGeolocationError::assign(Error code, const WebString& message)
{
m_private = GeolocationError::create(static_cast<GeolocationError::ErrorCode>(code), message);
}
void WebGeolocationError::assign(const WebGeolocationError& other)
{
m_private = other.m_private;
}
void WebGeolocationError::reset()
{
m_private.reset();
}
WebGeolocationError::WebGeolocationError(PassRefPtr<GeolocationError> error)
{
m_private = error;
}
WebGeolocationError& WebGeolocationError::operator=(PassRefPtr<GeolocationError> error)
{
m_private = error;
return *this;
}
WebGeolocationError::operator PassRefPtr<GeolocationError>() const
{
return m_private.get();
}
}
/*
* Copyright (C) 2010 Google 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 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 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.
*/
#include "config.h"
#include "WebGeolocationPosition.h"
#include "GeolocationPosition.h"
using namespace WebCore;
namespace WebKit {
void WebGeolocationPosition::assign(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
{
m_private = GeolocationPosition::create(timestamp, latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed);
}
void WebGeolocationPosition::assign(const WebGeolocationPosition& other)
{
m_private = other.m_private;
}
void WebGeolocationPosition::reset()
{
m_private.reset();
}
WebGeolocationPosition& WebGeolocationPosition::operator=(PassRefPtr<GeolocationPosition> position)
{
m_private = position;
return *this;
}
WebGeolocationPosition::operator PassRefPtr<GeolocationPosition>() const
{
return m_private.get();
}
} // namespace WebKit
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment