| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 if (m_geolocationPermission != PermissionUnknown) | 414 if (m_geolocationPermission != PermissionUnknown) |
| 415 return; | 415 return; |
| 416 | 416 |
| 417 LocalFrame* frame = this->frame(); | 417 LocalFrame* frame = this->frame(); |
| 418 if (!frame) | 418 if (!frame) |
| 419 return; | 419 return; |
| 420 | 420 |
| 421 m_geolocationPermission = PermissionRequested; | 421 m_geolocationPermission = PermissionRequested; |
| 422 frame->serviceRegistry()->connectToRemoteService( | 422 frame->serviceRegistry()->connectToRemoteService( |
| 423 mojo::GetProxy(&m_permissionService)); | 423 mojo::GetProxy(&m_permissionService)); |
| 424 m_permissionService.set_connection_error_handler(sameThreadBindForMojo(&Geol
ocation::onPermissionConnectionError, this)); | 424 m_permissionService.set_connection_error_handler(createBaseCallback(bind(&Ge
olocation::onPermissionConnectionError, WeakPersistentThisPointer<Geolocation>(t
his)))); |
| 425 | 425 |
| 426 // Ask the embedder: it maintains the geolocation challenge policy itself. | 426 // Ask the embedder: it maintains the geolocation challenge policy itself. |
| 427 m_permissionService->RequestPermission( | 427 m_permissionService->RequestPermission( |
| 428 mojom::blink::PermissionName::GEOLOCATION, | 428 mojom::blink::PermissionName::GEOLOCATION, |
| 429 getExecutionContext()->getSecurityOrigin()->toString(), | 429 getExecutionContext()->getSecurityOrigin()->toString(), |
| 430 sameThreadBindForMojo(&Geolocation::onGeolocationPermissionUpdated, this
)); | 430 createBaseCallback(bind<mojom::blink::PermissionStatus>(&Geolocation::on
GeolocationPermissionUpdated, this))); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void Geolocation::makeSuccessCallbacks() | 433 void Geolocation::makeSuccessCallbacks() |
| 434 { | 434 { |
| 435 ASSERT(m_lastPosition); | 435 ASSERT(m_lastPosition); |
| 436 ASSERT(isAllowed()); | 436 ASSERT(isAllowed()); |
| 437 | 437 |
| 438 GeoNotifierVector oneShotsCopy; | 438 GeoNotifierVector oneShotsCopy; |
| 439 copyToVector(m_oneShots, oneShotsCopy); | 439 copyToVector(m_oneShots, oneShotsCopy); |
| 440 | 440 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 { | 485 { |
| 486 if (!getExecutionContext() || !page() || !page()->isPageVisible() || !m_upda
ting) { | 486 if (!getExecutionContext() || !page() || !page()->isPageVisible() || !m_upda
ting) { |
| 487 m_geolocationService.reset(); | 487 m_geolocationService.reset(); |
| 488 m_disconnectedGeolocationService = true; | 488 m_disconnectedGeolocationService = true; |
| 489 return; | 489 return; |
| 490 } | 490 } |
| 491 if (m_geolocationService) | 491 if (m_geolocationService) |
| 492 return; | 492 return; |
| 493 | 493 |
| 494 frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_geoloca
tionService)); | 494 frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_geoloca
tionService)); |
| 495 m_geolocationService.set_connection_error_handler(sameThreadBindForMojo(&Geo
location::onGeolocationConnectionError, this)); | 495 m_geolocationService.set_connection_error_handler(createBaseCallback(bind(&G
eolocation::onGeolocationConnectionError, WeakPersistentThisPointer<Geolocation>
(this)))); |
| 496 if (m_enableHighAccuracy) | 496 if (m_enableHighAccuracy) |
| 497 m_geolocationService->SetHighAccuracy(true); | 497 m_geolocationService->SetHighAccuracy(true); |
| 498 queryNextPosition(); | 498 queryNextPosition(); |
| 499 } | 499 } |
| 500 | 500 |
| 501 void Geolocation::queryNextPosition() | 501 void Geolocation::queryNextPosition() |
| 502 { | 502 { |
| 503 m_geolocationService->QueryNextPosition( | 503 m_geolocationService->QueryNextPosition(createBaseCallback(bind<mojom::blink
::GeopositionPtr>(&Geolocation::onPositionUpdated, this))); |
| 504 sameThreadBindForMojo(&Geolocation::onPositionUpdated, this)); | |
| 505 } | 504 } |
| 506 | 505 |
| 507 void Geolocation::onPositionUpdated(mojom::blink::GeopositionPtr position) | 506 void Geolocation::onPositionUpdated(mojom::blink::GeopositionPtr position) |
| 508 { | 507 { |
| 509 m_disconnectedGeolocationService = false; | 508 m_disconnectedGeolocationService = false; |
| 510 if (position->valid) { | 509 if (position->valid) { |
| 511 m_lastPosition = createGeoposition(*position); | 510 m_lastPosition = createGeoposition(*position); |
| 512 positionChanged(); | 511 positionChanged(); |
| 513 } else { | 512 } else { |
| 514 handleError(createPositionError(position->error_code, position->error_me
ssage)); | 513 handleError(createPositionError(position->error_code, position->error_me
ssage)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 528 error->setIsFatal(true); | 527 error->setIsFatal(true); |
| 529 handleError(error); | 528 handleError(error); |
| 530 } | 529 } |
| 531 | 530 |
| 532 void Geolocation::onPermissionConnectionError() | 531 void Geolocation::onPermissionConnectionError() |
| 533 { | 532 { |
| 534 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); | 533 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); |
| 535 } | 534 } |
| 536 | 535 |
| 537 } // namespace blink | 536 } // namespace blink |
| OLD | NEW |