| 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 17 matching lines...) Expand all Loading... |
| 28 #include "modules/geolocation/Geolocation.h" | 28 #include "modules/geolocation/Geolocation.h" |
| 29 | 29 |
| 30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
| 31 #include "core/frame/Deprecation.h" | 31 #include "core/frame/Deprecation.h" |
| 32 #include "core/frame/HostsUsingFeatures.h" | 32 #include "core/frame/HostsUsingFeatures.h" |
| 33 #include "core/frame/Settings.h" | 33 #include "core/frame/Settings.h" |
| 34 #include "modules/geolocation/Coordinates.h" | 34 #include "modules/geolocation/Coordinates.h" |
| 35 #include "modules/geolocation/GeolocationError.h" | 35 #include "modules/geolocation/GeolocationError.h" |
| 36 #include "platform/UserGestureIndicator.h" | 36 #include "platform/UserGestureIndicator.h" |
| 37 #include "platform/mojo/MojoHelper.h" | 37 #include "platform/mojo/MojoHelper.h" |
| 38 #include "public/platform/ServiceRegistry.h" | 38 #include "public/platform/InterfaceProvider.h" |
| 39 #include "wtf/Assertions.h" | 39 #include "wtf/Assertions.h" |
| 40 #include "wtf/CurrentTime.h" | 40 #include "wtf/CurrentTime.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 static const char permissionDeniedErrorMessage[] = "User denied Geolocation"; | 45 static const char permissionDeniedErrorMessage[] = "User denied Geolocation"; |
| 46 static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocat
ion service"; | 46 static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocat
ion service"; |
| 47 static const char framelessDocumentErrorMessage[] = "Geolocation cannot be used
in frameless documents"; | 47 static const char framelessDocumentErrorMessage[] = "Geolocation cannot be used
in frameless documents"; |
| 48 | 48 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 void Geolocation::requestPermission() | 414 void Geolocation::requestPermission() |
| 415 { | 415 { |
| 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->interfaceProvider()->getInterface(mojo::GetProxy(&m_permissionService
)); |
| 425 mojo::GetProxy(&m_permissionService)); | |
| 426 m_permissionService.set_connection_error_handler(convertToBaseCallback(WTF::
bind(&Geolocation::onPermissionConnectionError, wrapWeakPersistent(this)))); | 425 m_permissionService.set_connection_error_handler(convertToBaseCallback(WTF::
bind(&Geolocation::onPermissionConnectionError, wrapWeakPersistent(this)))); |
| 427 | 426 |
| 428 // Ask the embedder: it maintains the geolocation challenge policy itself. | 427 // Ask the embedder: it maintains the geolocation challenge policy itself. |
| 429 m_permissionService->RequestPermission( | 428 m_permissionService->RequestPermission( |
| 430 mojom::blink::PermissionName::GEOLOCATION, | 429 mojom::blink::PermissionName::GEOLOCATION, |
| 431 getExecutionContext()->getSecurityOrigin()->toString(), | 430 getExecutionContext()->getSecurityOrigin()->toString(), |
| 432 UserGestureIndicator::processingUserGesture(), | 431 UserGestureIndicator::processingUserGesture(), |
| 433 convertToBaseCallback(WTF::bind(&Geolocation::onGeolocationPermissionUpd
ated, wrapPersistent(this)))); | 432 convertToBaseCallback(WTF::bind(&Geolocation::onGeolocationPermissionUpd
ated, wrapPersistent(this)))); |
| 434 } | 433 } |
| 435 | 434 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 void Geolocation::updateGeolocationServiceConnection() | 486 void Geolocation::updateGeolocationServiceConnection() |
| 488 { | 487 { |
| 489 if (!getExecutionContext() || !page() || !page()->isPageVisible() || !m_upda
ting) { | 488 if (!getExecutionContext() || !page() || !page()->isPageVisible() || !m_upda
ting) { |
| 490 m_geolocationService.reset(); | 489 m_geolocationService.reset(); |
| 491 m_disconnectedGeolocationService = true; | 490 m_disconnectedGeolocationService = true; |
| 492 return; | 491 return; |
| 493 } | 492 } |
| 494 if (m_geolocationService) | 493 if (m_geolocationService) |
| 495 return; | 494 return; |
| 496 | 495 |
| 497 frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_geoloca
tionService)); | 496 frame()->interfaceProvider()->getInterface(mojo::GetProxy(&m_geolocationServ
ice)); |
| 498 m_geolocationService.set_connection_error_handler(convertToBaseCallback(WTF:
:bind(&Geolocation::onGeolocationConnectionError, wrapWeakPersistent(this)))); | 497 m_geolocationService.set_connection_error_handler(convertToBaseCallback(WTF:
:bind(&Geolocation::onGeolocationConnectionError, wrapWeakPersistent(this)))); |
| 499 if (m_enableHighAccuracy) | 498 if (m_enableHighAccuracy) |
| 500 m_geolocationService->SetHighAccuracy(true); | 499 m_geolocationService->SetHighAccuracy(true); |
| 501 queryNextPosition(); | 500 queryNextPosition(); |
| 502 } | 501 } |
| 503 | 502 |
| 504 void Geolocation::queryNextPosition() | 503 void Geolocation::queryNextPosition() |
| 505 { | 504 { |
| 506 m_geolocationService->QueryNextPosition(convertToBaseCallback(WTF::bind(&Geo
location::onPositionUpdated, wrapPersistent(this)))); | 505 m_geolocationService->QueryNextPosition(convertToBaseCallback(WTF::bind(&Geo
location::onPositionUpdated, wrapPersistent(this)))); |
| 507 } | 506 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 530 error->setIsFatal(true); | 529 error->setIsFatal(true); |
| 531 handleError(error); | 530 handleError(error); |
| 532 } | 531 } |
| 533 | 532 |
| 534 void Geolocation::onPermissionConnectionError() | 533 void Geolocation::onPermissionConnectionError() |
| 535 { | 534 { |
| 536 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); | 535 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); |
| 537 } | 536 } |
| 538 | 537 |
| 539 } // namespace blink | 538 } // namespace blink |
| OLD | NEW |