| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009 Torch Mobile, Inc. | 3 * Copyright (C) 2009 Torch Mobile, Inc. |
| 4 * Copyright 2010, The Android Open Source Project | 4 * Copyright 2010, The Android Open Source Project |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 if (m_geolocationPermission != PermissionUnknown) | 416 if (m_geolocationPermission != PermissionUnknown) |
| 417 return; | 417 return; |
| 418 | 418 |
| 419 LocalFrame* frame = this->frame(); | 419 LocalFrame* frame = this->frame(); |
| 420 if (!frame) | 420 if (!frame) |
| 421 return; | 421 return; |
| 422 | 422 |
| 423 m_geolocationPermission = PermissionRequested; | 423 m_geolocationPermission = PermissionRequested; |
| 424 frame->serviceRegistry()->connectToRemoteService( | 424 frame->serviceRegistry()->connectToRemoteService( |
| 425 mojo::GetProxy(&m_permissionService)); | 425 mojo::GetProxy(&m_permissionService)); |
| 426 m_permissionService.set_connection_error_handler(createBaseCallback(bind(&Ge
olocation::onPermissionConnectionError, wrapWeakPersistent(this)))); | 426 m_permissionService.set_connection_error_handler(createBaseCallback(WTF::bin
d(&Geolocation::onPermissionConnectionError, wrapWeakPersistent(this)))); |
| 427 | 427 |
| 428 // Ask the embedder: it maintains the geolocation challenge policy itself. | 428 // Ask the embedder: it maintains the geolocation challenge policy itself. |
| 429 m_permissionService->RequestPermission( | 429 m_permissionService->RequestPermission( |
| 430 mojom::blink::PermissionName::GEOLOCATION, | 430 mojom::blink::PermissionName::GEOLOCATION, |
| 431 getExecutionContext()->getSecurityOrigin()->toString(), | 431 getExecutionContext()->getSecurityOrigin()->toString(), |
| 432 UserGestureIndicator::processingUserGesture(), | 432 UserGestureIndicator::processingUserGesture(), |
| 433 createBaseCallback(bind(&Geolocation::onGeolocationPermissionUpdated, wr
apPersistent(this)))); | 433 createBaseCallback(WTF::bind(&Geolocation::onGeolocationPermissionUpdate
d, wrapPersistent(this)))); |
| 434 } | 434 } |
| 435 | 435 |
| 436 void Geolocation::makeSuccessCallbacks() | 436 void Geolocation::makeSuccessCallbacks() |
| 437 { | 437 { |
| 438 DCHECK(m_lastPosition); | 438 DCHECK(m_lastPosition); |
| 439 DCHECK(isAllowed()); | 439 DCHECK(isAllowed()); |
| 440 | 440 |
| 441 GeoNotifierVector oneShotsCopy; | 441 GeoNotifierVector oneShotsCopy; |
| 442 copyToVector(m_oneShots, oneShotsCopy); | 442 copyToVector(m_oneShots, oneShotsCopy); |
| 443 | 443 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 { | 488 { |
| 489 if (!getExecutionContext() || !page() || !page()->isPageVisible() || !m_upda
ting) { | 489 if (!getExecutionContext() || !page() || !page()->isPageVisible() || !m_upda
ting) { |
| 490 m_geolocationService.reset(); | 490 m_geolocationService.reset(); |
| 491 m_disconnectedGeolocationService = true; | 491 m_disconnectedGeolocationService = true; |
| 492 return; | 492 return; |
| 493 } | 493 } |
| 494 if (m_geolocationService) | 494 if (m_geolocationService) |
| 495 return; | 495 return; |
| 496 | 496 |
| 497 frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_geoloca
tionService)); | 497 frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_geoloca
tionService)); |
| 498 m_geolocationService.set_connection_error_handler(createBaseCallback(bind(&G
eolocation::onGeolocationConnectionError, wrapWeakPersistent(this)))); | 498 m_geolocationService.set_connection_error_handler(createBaseCallback(WTF::bi
nd(&Geolocation::onGeolocationConnectionError, wrapWeakPersistent(this)))); |
| 499 if (m_enableHighAccuracy) | 499 if (m_enableHighAccuracy) |
| 500 m_geolocationService->SetHighAccuracy(true); | 500 m_geolocationService->SetHighAccuracy(true); |
| 501 queryNextPosition(); | 501 queryNextPosition(); |
| 502 } | 502 } |
| 503 | 503 |
| 504 void Geolocation::queryNextPosition() | 504 void Geolocation::queryNextPosition() |
| 505 { | 505 { |
| 506 m_geolocationService->QueryNextPosition(createBaseCallback(bind(&Geolocation
::onPositionUpdated, wrapPersistent(this)))); | 506 m_geolocationService->QueryNextPosition(createBaseCallback(WTF::bind(&Geoloc
ation::onPositionUpdated, wrapPersistent(this)))); |
| 507 } | 507 } |
| 508 | 508 |
| 509 void Geolocation::onPositionUpdated(mojom::blink::GeopositionPtr position) | 509 void Geolocation::onPositionUpdated(mojom::blink::GeopositionPtr position) |
| 510 { | 510 { |
| 511 m_disconnectedGeolocationService = false; | 511 m_disconnectedGeolocationService = false; |
| 512 if (position->valid) { | 512 if (position->valid) { |
| 513 m_lastPosition = createGeoposition(*position); | 513 m_lastPosition = createGeoposition(*position); |
| 514 positionChanged(); | 514 positionChanged(); |
| 515 } else { | 515 } else { |
| 516 handleError(createPositionError(position->error_code, position->error_me
ssage)); | 516 handleError(createPositionError(position->error_code, position->error_me
ssage)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 530 error->setIsFatal(true); | 530 error->setIsFatal(true); |
| 531 handleError(error); | 531 handleError(error); |
| 532 } | 532 } |
| 533 | 533 |
| 534 void Geolocation::onPermissionConnectionError() | 534 void Geolocation::onPermissionConnectionError() |
| 535 { | 535 { |
| 536 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); | 536 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); |
| 537 } | 537 } |
| 538 | 538 |
| 539 } // namespace blink | 539 } // namespace blink |
| OLD | NEW |