diff options
author | jknotten@chromium.org <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-14 17:45:50 +0000 |
---|---|---|
committer | jknotten@chromium.org <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-14 17:45:50 +0000 |
commit | ffd0abdc00f3c8e8e711d86c8633976db3963f42 (patch) | |
tree | 0f8e55a221d3eaa3f18af47b61dae31c078890b3 /webkit | |
parent | 52dd1112a84d627fa45b7c5051f14b5b118f5a83 (diff) | |
download | chromium_src-ffd0abdc00f3c8e8e711d86c8633976db3963f42.zip chromium_src-ffd0abdc00f3c8e8e711d86c8633976db3963f42.tar.gz chromium_src-ffd0abdc00f3c8e8e711d86c8633976db3963f42.tar.bz2 |
Client-based geolocation support.
Add in support for client-based geolocation in WebKit.
Default to disabled (ENABLE_CLIENT_BASED_GEOLOCATION=0) in features_override.gypi
until all the WebKit patches (see https://bugs.webkit.org/show_bug.cgi?id=45752)
have landed. When we switch over to client-based geolocation, we should remove
the old non-client-based geolocation code.
BUG=55907
Review URL: http://codereview.chromium.org/5612005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69156 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 24 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 17 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.gypi | 3 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 13 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.h | 10 |
6 files changed, 74 insertions, 1 deletions
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 16d7bcd..3ddfaab 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -26,7 +26,11 @@ #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) +#include "third_party/WebKit/WebKit/chromium/public/WebGeolocationClientMock.h" +#else #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationServiceMock.h" +#endif #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" @@ -52,13 +56,16 @@ using std::wstring; using WebKit::WebBindings; using WebKit::WebConsoleMessage; using WebKit::WebElement; -using WebKit::WebGeolocationServiceMock; using WebKit::WebScriptSource; using WebKit::WebSecurityPolicy; using WebKit::WebSize; using WebKit::WebString; using WebKit::WebURL; +#if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) +using WebKit::WebGeolocationServiceMock; +#endif + TestShell* LayoutTestController::shell_ = NULL; // Most of these flags need to be cleared in Reset() so that they get turned // off between each test run. @@ -1493,7 +1500,12 @@ void LayoutTestController::setGeolocationPermission(const CppArgumentList& args, CppVariant* result) { if (args.size() < 1 || !args[0].isBool()) return; +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) + shell_->geolocation_client_mock()->setPermission( + args[0].ToBoolean()); +#else shell_->delegate()->SetGeolocationPermission(args[0].ToBoolean()); +#endif } void LayoutTestController::setMockGeolocationPosition( @@ -1501,16 +1513,26 @@ void LayoutTestController::setMockGeolocationPosition( if (args.size() < 3 || !args[0].isNumber() || !args[1].isNumber() || !args[2].isNumber()) return; +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) + shell_->geolocation_client_mock()->setPosition( + args[0].ToDouble(), args[1].ToDouble(), args[2].ToDouble()); +#else WebGeolocationServiceMock::setMockGeolocationPosition( args[0].ToDouble(), args[1].ToDouble(), args[2].ToDouble()); +#endif } void LayoutTestController::setMockGeolocationError(const CppArgumentList& args, CppVariant* result) { if (args.size() < 2 || !args[0].isNumber() || !args[1].isString()) return; +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) + shell_->geolocation_client_mock()->setError( + args[0].ToInt32(), WebString::fromUTF8(args[1].ToString())); +#else WebGeolocationServiceMock::setMockGeolocationError( args[0].ToInt32(), WebString::fromUTF8(args[1].ToString())); +#endif } void LayoutTestController::markerTextForListItem(const CppArgumentList& args, diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index fcd1773..96d5415 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -34,6 +34,9 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClientMock.h" +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) +#include "third_party/WebKit/WebKit/chromium/public/WebGeolocationClientMock.h" +#endif #include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputControllerMock.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" @@ -649,6 +652,10 @@ void TestShell::ResetTestController() { event_sending_controller_->Reset(); notification_presenter_->Reset(); delegate_->Reset(); +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) + if (geolocation_client_mock_.get()) + geolocation_client_mock_->resetMock(); +#endif } void TestShell::LoadFile(const FilePath& file) { @@ -788,6 +795,16 @@ TestShell::speech_input_controller_mock() { return speech_input_controller_mock_.get(); } +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) +WebKit::WebGeolocationClientMock* TestShell::geolocation_client_mock() { + if (!geolocation_client_mock_.get()) { + geolocation_client_mock_.reset( + WebKit::WebGeolocationClientMock::create()); + } + return geolocation_client_mock_.get(); +} +#endif + //----------------------------------------------------------------------------- namespace webkit_glue { diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi index d265a69..088773f 100644 --- a/webkit/tools/test_shell/test_shell.gypi +++ b/webkit/tools/test_shell/test_shell.gypi @@ -160,6 +160,9 @@ 'drop_delegate.cc', ], }], + ['"ENABLE_CLIENT_BASED_GEOLOCATION=1" in feature_defines', { + 'defines': [ 'ENABLE_CLIENT_BASED_GEOLOCATION=1' ] + }], ], }, { diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index 56ade05..29d3d1f 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -67,6 +67,7 @@ class StringPiece; namespace WebKit { class WebDeviceOrientationClientMock; +class WebGeolocationClientMock; class WebSpeechInputControllerMock; class WebSpeechInputListener; } @@ -372,6 +373,10 @@ public: WebKit::WebSpeechInputListener* listener); WebKit::WebSpeechInputControllerMock* speech_input_controller_mock(); +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) + WebKit::WebGeolocationClientMock* geolocation_client_mock(); +#endif + protected: void CreateDevToolsClient(TestShellDevToolsAgent* agent); bool Initialize(const GURL& starting_url); @@ -456,6 +461,9 @@ private: scoped_ptr<WebKit::WebSpeechInputControllerMock> speech_input_controller_mock_; +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) + scoped_ptr<WebKit::WebGeolocationClientMock> geolocation_client_mock_; +#endif const TestParams* test_params_; // True while a test is preparing to run diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index cd95bad..b791cf2 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -33,6 +33,9 @@ #include "third_party/WebKit/WebKit/chromium/public/WebFileError.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) +#include "third_party/WebKit/WebKit/chromium/public/WebGeolocationClientMock.h" +#endif #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" @@ -654,9 +657,15 @@ WebNotificationPresenter* TestWebViewDelegate::notificationPresenter() { return shell_->notification_presenter(); } +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) +WebKit::WebGeolocationClient* TestWebViewDelegate::geolocationClient() { + return shell_->geolocation_client_mock(); +} +#else WebKit::WebGeolocationService* TestWebViewDelegate::geolocationService() { return GetTestGeolocationService(); } +#endif WebKit::WebDeviceOrientationClient* TestWebViewDelegate::deviceOrientationClient() { @@ -1207,9 +1216,11 @@ void TestWebViewDelegate::WaitForPolicyDelegate() { policy_delegate_should_notify_done_ = true; } +#if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) void TestWebViewDelegate::SetGeolocationPermission(bool allowed) { GetTestGeolocationService()->SetGeolocationPermission(allowed); } +#endif // Private methods ----------------------------------------------------------- @@ -1331,11 +1342,13 @@ std::wstring TestWebViewDelegate::GetFrameDescription(WebFrame* webframe) { } } +#if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) TestGeolocationService* TestWebViewDelegate::GetTestGeolocationService() { if (!test_geolocation_service_.get()) test_geolocation_service_.reset(new TestGeolocationService); return test_geolocation_service_.get(); } +#endif void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { fake_rect_ = rect; diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index 3c7f38d..f5d81ad 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -141,7 +141,11 @@ class TestWebViewDelegate : public WebKit::WebViewClient, virtual void focusAccessibilityObject( const WebKit::WebAccessibilityObject& object); virtual WebKit::WebNotificationPresenter* notificationPresenter(); +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) + WebKit::WebGeolocationClient* geolocationClient(); +#else virtual WebKit::WebGeolocationService* geolocationService(); +#endif virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient(); virtual WebKit::WebSpeechInputController* speechInputController( WebKit::WebSpeechInputListener*); @@ -323,7 +327,9 @@ class TestWebViewDelegate : public WebKit::WebViewClient, edit_command_value_.clear(); } +#if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) void SetGeolocationPermission(bool allowed); +#endif void ClearContextMenuData(); @@ -379,8 +385,10 @@ class TestWebViewDelegate : public WebKit::WebViewClient, // Get a string suitable for dumping a frame to the console. std::wstring GetFrameDescription(WebKit::WebFrame* webframe); +#if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) // Returns a TestGeolocationService owned by this delegate. TestGeolocationService* GetTestGeolocationService(); +#endif // Causes navigation actions just printout the intended navigation instead // of taking you to the page. This is used for cases like mailto, where you @@ -459,7 +467,9 @@ class TestWebViewDelegate : public WebKit::WebViewClient, // The mock spellchecker used in TestWebViewDelegate::spellCheck(). MockSpellCheck mock_spellcheck_; +#if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) scoped_ptr<TestGeolocationService> test_geolocation_service_; +#endif DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); }; |