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 void Geolocation::requestPermission() { | 416 void Geolocation::requestPermission() { |
417 if (m_geolocationPermission != PermissionUnknown) | 417 if (m_geolocationPermission != PermissionUnknown) |
418 return; | 418 return; |
419 | 419 |
420 LocalFrame* frame = this->frame(); | 420 LocalFrame* frame = this->frame(); |
421 if (!frame) | 421 if (!frame) |
422 return; | 422 return; |
423 | 423 |
424 m_geolocationPermission = PermissionRequested; | 424 m_geolocationPermission = PermissionRequested; |
425 frame->interfaceProvider()->getInterface( | 425 frame->interfaceProvider()->getInterface( |
426 mojo::GetProxy(&m_permissionService)); | 426 mojo::MakeRequest(&m_permissionService)); |
427 m_permissionService.set_connection_error_handler( | 427 m_permissionService.set_connection_error_handler( |
428 convertToBaseCallback(WTF::bind(&Geolocation::onPermissionConnectionError, | 428 convertToBaseCallback(WTF::bind(&Geolocation::onPermissionConnectionError, |
429 wrapWeakPersistent(this)))); | 429 wrapWeakPersistent(this)))); |
430 | 430 |
431 // Ask the embedder: it maintains the geolocation challenge policy itself. | 431 // Ask the embedder: it maintains the geolocation challenge policy itself. |
432 m_permissionService->RequestPermission( | 432 m_permissionService->RequestPermission( |
433 createPermissionDescriptor(mojom::blink::PermissionName::GEOLOCATION), | 433 createPermissionDescriptor(mojom::blink::PermissionName::GEOLOCATION), |
434 getExecutionContext()->getSecurityOrigin(), | 434 getExecutionContext()->getSecurityOrigin(), |
435 UserGestureIndicator::processingUserGesture(), | 435 UserGestureIndicator::processingUserGesture(), |
436 convertToBaseCallback(WTF::bind( | 436 convertToBaseCallback(WTF::bind( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 if (!getExecutionContext() || !page() || !page()->isPageVisible() || | 488 if (!getExecutionContext() || !page() || !page()->isPageVisible() || |
489 !m_updating) { | 489 !m_updating) { |
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()->interfaceProvider()->getInterface( | 497 frame()->interfaceProvider()->getInterface( |
498 mojo::GetProxy(&m_geolocationService)); | 498 mojo::MakeRequest(&m_geolocationService)); |
499 m_geolocationService.set_connection_error_handler(convertToBaseCallback( | 499 m_geolocationService.set_connection_error_handler(convertToBaseCallback( |
500 WTF::bind(&Geolocation::onGeolocationConnectionError, | 500 WTF::bind(&Geolocation::onGeolocationConnectionError, |
501 wrapWeakPersistent(this)))); | 501 wrapWeakPersistent(this)))); |
502 if (m_enableHighAccuracy) | 502 if (m_enableHighAccuracy) |
503 m_geolocationService->SetHighAccuracy(true); | 503 m_geolocationService->SetHighAccuracy(true); |
504 queryNextPosition(); | 504 queryNextPosition(); |
505 } | 505 } |
506 | 506 |
507 void Geolocation::queryNextPosition() { | 507 void Geolocation::queryNextPosition() { |
508 m_geolocationService->QueryNextPosition(convertToBaseCallback( | 508 m_geolocationService->QueryNextPosition(convertToBaseCallback( |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 // be called. In that case, blink has already shut down so do nothing. | 546 // be called. In that case, blink has already shut down so do nothing. |
547 // | 547 // |
548 // TODO(sammc): Remove this once renderer shutdown is no longer graceful. | 548 // TODO(sammc): Remove this once renderer shutdown is no longer graceful. |
549 if (!Platform::current()) | 549 if (!Platform::current()) |
550 return; | 550 return; |
551 | 551 |
552 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); | 552 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); |
553 } | 553 } |
554 | 554 |
555 } // namespace blink | 555 } // namespace blink |
OLD | NEW |