2010-05-24 Marcus Bulach <bulach@chromium.org>
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 May 2010 04:10:48 +0000 (04:10 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 May 2010 04:10:48 +0000 (04:10 +0000)
        Reviewed by Kent Tamura.

        [chromium] Adds WebGeolocationServiceMockImpl to remove public dependency on wtf/HashMap.h
        https://bugs.webkit.org/show_bug.cgi?id=39587

        * public/WebGeolocationServiceMock.h:
        * src/WebGeolocationServiceMock.cpp:
        (WebKit::WebGeolocationServiceMockImpl::~WebGeolocationServiceMockImpl):
        (WebKit::WebGeolocationServiceMock::createWebGeolocationServiceMock):
        (WebKit::WebGeolocationServiceMockImpl::requestPermissionForFrame):
        (WebKit::WebGeolocationServiceMockImpl::attachBridge):
        (WebKit::WebGeolocationServiceMockImpl::detachBridge):
2010-05-24  Marcus Bulach  <bulach@chromium.org>

        Reviewed by Kent Tamura.

        [chromium] Adds WebGeolocationServiceMockImpl to remove public dependency on wtf/HashMap.h
        https://bugs.webkit.org/show_bug.cgi?id=39587

        * DumpRenderTree/chromium/WebViewHost.cpp:
        (WebViewHost::geolocationService):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@60121 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/chromium/ChangeLog
WebKit/chromium/public/WebGeolocationServiceMock.h
WebKit/chromium/src/WebGeolocationServiceMock.cpp
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp

index 30b7b5d..3e72627 100644 (file)
@@ -1,3 +1,18 @@
+2010-05-24  Marcus Bulach  <bulach@chromium.org>
+
+        Reviewed by Kent Tamura.
+
+        [chromium] Adds WebGeolocationServiceMockImpl to remove public dependency on wtf/HashMap.h
+        https://bugs.webkit.org/show_bug.cgi?id=39587
+
+        * public/WebGeolocationServiceMock.h:
+        * src/WebGeolocationServiceMock.cpp:
+        (WebKit::WebGeolocationServiceMockImpl::~WebGeolocationServiceMockImpl):
+        (WebKit::WebGeolocationServiceMock::createWebGeolocationServiceMock):
+        (WebKit::WebGeolocationServiceMockImpl::requestPermissionForFrame):
+        (WebKit::WebGeolocationServiceMockImpl::attachBridge):
+        (WebKit::WebGeolocationServiceMockImpl::detachBridge):
+
 2010-05-24  Tony Chang  <tony@chromium.org>
 
         Not reviewed, build fix.
index 285f70c..d1a146b 100644 (file)
@@ -32,7 +32,6 @@
 #define WebGeolocationServiceMock_h
 
 #include "WebGeolocationService.h"
-#include <wtf/HashMap.h>
 
 namespace WebKit {
 
@@ -40,18 +39,12 @@ class WebString;
 
 class WebGeolocationServiceMock : public WebGeolocationService {
 public:
+    static WebGeolocationServiceMock* createWebGeolocationServiceMock();
     static void setMockGeolocationPermission(bool allowed);
     static void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
     static void setMockGeolocationError(int errorCode, const WebString& message);
 
-    virtual void requestPermissionForFrame(int bridgeId, const WebURL& url);
-    virtual int attachBridge(WebGeolocationServiceBridge*);
-    virtual void detachBridge(int bridgeId);
-
-private:
-    typedef HashMap<int, WebGeolocationServiceBridge*> IdToBridgeMap;
-    IdToBridgeMap m_idToBridgeMap;
-
+protected:
     static bool s_mockGeolocationPermission;
 };
 
index 2eed352..00d819b 100644 (file)
@@ -36,6 +36,7 @@
 #include "GeolocationServiceMock.h"
 #include "WebString.h"
 #include <wtf/CurrentTime.h>
+#include <wtf/HashMap.h>
 
 #if ENABLE(GEOLOCATION)
 
@@ -121,8 +122,25 @@ void GeolocationServiceChromiumMock::geolocationServiceErrorOccurred(Geolocation
 
 namespace WebKit {
 
+class WebGeolocationServiceMockImpl : public WebGeolocationServiceMock {
+public:
+    virtual ~WebGeolocationServiceMockImpl() { }
+    virtual void requestPermissionForFrame(int bridgeId, const WebURL& url);
+    virtual int attachBridge(WebGeolocationServiceBridge*);
+    virtual void detachBridge(int bridgeId);
+
+private:
+    typedef HashMap<int, WebGeolocationServiceBridge*> IdToBridgeMap;
+    IdToBridgeMap m_idToBridgeMap;
+};
+
 bool WebGeolocationServiceMock::s_mockGeolocationPermission = false;
 
+WebGeolocationServiceMock* WebGeolocationServiceMock::createWebGeolocationServiceMock()
+{
+    return new WebGeolocationServiceMockImpl;
+}
+
 void WebGeolocationServiceMock::setMockGeolocationPermission(bool allowed)
 {
     s_mockGeolocationPermission = allowed;
@@ -142,7 +160,7 @@ void WebGeolocationServiceMock::setMockGeolocationError(int errorCode, const Web
     GeolocationServiceMock::setError(positionError);
 }
 
-void WebGeolocationServiceMock::requestPermissionForFrame(int bridgeId, const WebURL& url)
+void WebGeolocationServiceMockImpl::requestPermissionForFrame(int bridgeId, const WebURL& url)
 {
     IdToBridgeMap::iterator iter = m_idToBridgeMap.find(bridgeId);
     if (iter == m_idToBridgeMap.end())
@@ -150,7 +168,7 @@ void WebGeolocationServiceMock::requestPermissionForFrame(int bridgeId, const We
     iter->second->setIsAllowed(s_mockGeolocationPermission);
 }
 
-int WebGeolocationServiceMock::attachBridge(WebGeolocationServiceBridge* bridge)
+int WebGeolocationServiceMockImpl::attachBridge(WebGeolocationServiceBridge* bridge)
 {
     static int nextAvailableWatchId = 1;
     // In case of overflow, make sure the ID remains positive, but reuse the ID values.
@@ -160,7 +178,7 @@ int WebGeolocationServiceMock::attachBridge(WebGeolocationServiceBridge* bridge)
     return nextAvailableWatchId++;
 }
 
-void WebGeolocationServiceMock::detachBridge(int bridgeId)
+void WebGeolocationServiceMockImpl::detachBridge(int bridgeId)
 {
     m_idToBridgeMap.remove(bridgeId);
 }
index 4392d1c..d38c518 100644 (file)
@@ -1,3 +1,13 @@
+2010-05-24  Marcus Bulach  <bulach@chromium.org>
+
+        Reviewed by Kent Tamura.
+
+        [chromium] Adds WebGeolocationServiceMockImpl to remove public dependency on wtf/HashMap.h
+        https://bugs.webkit.org/show_bug.cgi?id=39587
+
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::geolocationService):
+
 2010-05-24  Robert Hogan  <robert@webkit.org>
 
         Reviewed by Laszlo Gombos.
index eb44c2a..1a13ace 100644 (file)
@@ -531,7 +531,7 @@ WebNotificationPresenter* WebViewHost::notificationPresenter()
 WebKit::WebGeolocationService* WebViewHost::geolocationService()
 {
     if (!m_geolocationServiceMock.get())
-        m_geolocationServiceMock.set(new WebGeolocationServiceMock);
+        m_geolocationServiceMock.set(WebGeolocationServiceMock::createWebGeolocationServiceMock());
     return m_geolocationServiceMock.get();
 }