Changeset 133247 in webkit
- Timestamp:
- Nov 1, 2012 6:17:27 PM (11 years ago)
- Location:
- trunk/Source/WebKit/blackberry
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/blackberry/Api/WebPageClient.h
r133199 r133247 161 161 virtual void cursorChanged(Platform::CursorType, const char* url, int x, int y) = 0; 162 162 163 virtual void requestGlobalLocalServicePermission(Platform::GeoTrackerListener*, const BlackBerry::Platform::String& origin) = 0; 164 163 165 virtual void requestGeolocationPermission(Platform::GeoTrackerListener*, const BlackBerry::Platform::String& origin) = 0; 164 166 virtual void cancelGeolocationPermission() = 0; -
trunk/Source/WebKit/blackberry/ChangeLog
r133199 r133247 1 2012-11-01 Otto Derek Cheung <otcheung@rim.com> 2 3 [BlackBerry] Add a prompt to enable global location services 4 https://bugs.webkit.org/show_bug.cgi?id=100992 5 6 PR 227897 7 8 Reviewed by Rob Buis. 9 10 Adding a dialog to let the user know location services isn't enabled. 11 Currently, the browser app does not check whether the global setting for 12 location service is enabled. This patch adds a dialog to allow the user 13 to open the settings app and change that setting. This infobar will only 14 show once per session. If the user fails to turn on location services after 15 the first prompt, all geolocation requests will automatically fail. 16 17 Also, adapting GeolocationClientBlackBerry to the removal of GeoTracker. 18 The class now talks directly to the geo handler singleton. 19 20 * Api/WebPageClient.h: 21 * WebCoreSupport/GeolocationClientBlackBerry.cpp: 22 (GeolocationClientBlackBerry::GeolocationClientBlackBerry): 23 (GeolocationClientBlackBerry::geolocationDestroyed): 24 (GeolocationClientBlackBerry::startUpdating): 25 (GeolocationClientBlackBerry::stopUpdating): 26 (GeolocationClientBlackBerry::requestPermission): 27 (GeolocationClientBlackBerry::setEnableHighAccuracy): 28 * WebCoreSupport/GeolocationClientBlackBerry.h: 29 (WebCore::GeolocationClientBlackBerry::requiresHighAccuracy): 30 (GeolocationClientBlackBerry): 31 1 32 2012-11-01 Michael Matovsky <mmatovsky@rim.com> 2 33 -
trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp
r132440 r133247 40 40 GeolocationClientBlackBerry::GeolocationClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate) 41 41 : m_webPagePrivate(webPagePrivate) 42 , m_tracker(0)43 42 , m_accuracy(false) 43 , m_isActive(false) 44 44 { 45 45 } … … 47 47 void GeolocationClientBlackBerry::geolocationDestroyed() 48 48 { 49 if (m_tracker)50 m_tracker->destroy();51 49 delete this; 52 50 } … … 54 52 void GeolocationClientBlackBerry::startUpdating() 55 53 { 56 if (m_tracker) 57 m_tracker->resume(); 58 else 59 m_tracker = BlackBerry::Platform::GeoTracker::create(this, m_accuracy); 54 if (!m_isActive) 55 BlackBerry::Platform::GeolocationHandler::instance()->addListener(this, false); 56 m_isActive = true; 60 57 } 61 58 62 59 void GeolocationClientBlackBerry::stopUpdating() 63 60 { 64 if (m_tracker) 65 m_tracker->suspend(); 61 if (m_isActive) 62 BlackBerry::Platform::GeolocationHandler::instance()->removeListener(this); 63 m_isActive = false; 66 64 } 67 65 … … 76 74 if (!frame) 77 75 return; 76 77 // FIXME: The geolocation setting for WebSettings is always true. Nothing ever toggles that setting. 78 78 if (!m_webPagePrivate->m_webSettings->isGeolocationEnabled()) { 79 79 location->setIsAllowed(false); 80 80 return; 81 81 } 82 82 83 DOMWindow* window = frame->document()->domWindow(); 83 84 if (!window) … … 86 87 const BlackBerry::Platform::String origin = frameOrigin(frame); 87 88 m_pendingPermissionGeolocation = location; 89 90 // Check global location setting, if it is off then we request an infobar that invokes a location settings card. 91 // If it's on, then we request an infobar that allows the site to have permission to use geolocation. 92 if (!BlackBerry::Platform::GeolocationHandler::instance()->isGlobalServiceActive()) { 93 // We only want to ask them once per session. If we get here again, automatically fail the request. 94 if (!BlackBerry::Platform::GeolocationHandler::instance()->didAskUserForGlobalPermission()) { 95 m_webPagePrivate->m_client->requestGlobalLocalServicePermission(this, origin); 96 BlackBerry::Platform::GeolocationHandler::instance()->setAskedUserForGlobalPermission(); 97 } else 98 onPermission(false); 99 return; 100 } 101 88 102 m_webPagePrivate->m_client->requestGeolocationPermission(this, origin); 89 103 } … … 116 130 void GeolocationClientBlackBerry::setEnableHighAccuracy(bool newAccuracy) 117 131 { 118 if (m_accuracy == newAccuracy) 119 return; 120 132 // FIXME: we have to implement high accuracy on our side too 121 133 m_accuracy = newAccuracy; 122 123 if (m_tracker)124 m_tracker->setRequiresHighAccuracy(m_accuracy);125 134 } 126 135 -
trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.h
r132440 r133247 45 45 virtual void cancelPermissionRequest(Geolocation*); 46 46 47 virtual bool requiresHighAccuracy() { return m_accuracy; } 47 48 virtual void onLocationUpdate(double timestamp, double latitude, double longitude, double accuracy, double altitude, bool altitudeValid, double altitudeAccuracy, 48 49 bool altitudeAccuracyValid, double speed, bool speedValid, double heading, bool headingValid); 49 50 virtual void onLocationError(const char* error); 50 51 virtual void onPermission(bool isAllowed); 51 BlackBerry::Platform::GeoTracker* tracker() const { return m_tracker; }52 52 53 53 private: 54 54 BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate; 55 BlackBerry::Platform::GeoTracker* m_tracker;56 55 RefPtr<Geolocation> m_pendingPermissionGeolocation; 57 56 RefPtr<GeolocationPosition> m_lastPosition; 58 57 bool m_accuracy; 58 bool m_isActive; 59 59 }; 60 60 }
Note: See TracChangeset
for help on using the changeset viewer.