| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_GEOLOCATION_SERVICE_H_ | 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_GEOLOCATION_SERVICE_H_ |
| 6 #define WEBKIT_TOOLS_TEST_SHELL_TEST_GEOLOCATION_SERVICE_H_ | 6 #define WEBKIT_TOOLS_TEST_SHELL_TEST_GEOLOCATION_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "base/timer.h" | 9 #include "base/timer.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationService.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationService.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 void SetGeolocationPermission(bool allowed); | 39 void SetGeolocationPermission(bool allowed); |
| 40 | 40 |
| 41 virtual void requestPermissionForFrame(int bridgeId, | 41 virtual void requestPermissionForFrame(int bridgeId, |
| 42 const WebKit::WebURL& url); | 42 const WebKit::WebURL& url); |
| 43 | 43 |
| 44 virtual int attachBridge(WebKit::WebGeolocationServiceBridge* bridge); | 44 virtual int attachBridge(WebKit::WebGeolocationServiceBridge* bridge); |
| 45 virtual void detachBridge(int bridgeId); | 45 virtual void detachBridge(int bridgeId); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 void TryToSendPermissions(); |
| 48 void SendPermission(); | 49 void SendPermission(); |
| 49 | 50 |
| 51 // Holds the value of |allowed| in most recent SetGeolocationPermission call. |
| 50 bool allowed_; | 52 bool allowed_; |
| 53 // Remains false until the first SetGeolocationPermission call. |
| 54 bool permission_set_; |
| 51 | 55 |
| 52 IDMap<WebKit::WebGeolocationServiceBridge> bridges_map_; | 56 IDMap<WebKit::WebGeolocationServiceBridge> bridges_map_; |
| 53 | 57 |
| 54 base::OneShotTimer<TestGeolocationService> permission_timer_; | 58 base::OneShotTimer<TestGeolocationService> permission_timer_; |
| 55 | 59 |
| 56 std::vector<std::pair<int, bool> > pending_permissions_; | 60 // In-order vector of pending bridge IDs. Is not pumped by |
| 61 // TryToSendPermissions until the first call to SetGeolocationPermission. |
| 62 std::vector<int> pending_permissions_; |
| 57 | 63 |
| 58 DISALLOW_COPY_AND_ASSIGN(TestGeolocationService); | 64 DISALLOW_COPY_AND_ASSIGN(TestGeolocationService); |
| 59 }; | 65 }; |
| 60 | 66 |
| 61 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_GEOLOCATION_SERVICE_H_ | 67 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_GEOLOCATION_SERVICE_H_ |
| OLD | NEW |