| 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 15 matching lines...) Expand all Loading... |
| 26 */ | 26 */ |
| 27 | 27 |
| 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/mojo/MojoHelper.h" | 37 #include "platform/mojo/MojoHelper.h" |
| 37 #include "public/platform/ServiceRegistry.h" | 38 #include "public/platform/ServiceRegistry.h" |
| 38 #include "wtf/Assertions.h" | 39 #include "wtf/Assertions.h" |
| 39 #include "wtf/CurrentTime.h" | 40 #include "wtf/CurrentTime.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 namespace { | 43 namespace { |
| 43 | 44 |
| 44 static const char permissionDeniedErrorMessage[] = "User denied Geolocation"; | 45 static const char permissionDeniedErrorMessage[] = "User denied Geolocation"; |
| 45 static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocat
ion service"; | 46 static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocat
ion service"; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 422 |
| 422 m_geolocationPermission = PermissionRequested; | 423 m_geolocationPermission = PermissionRequested; |
| 423 frame->serviceRegistry()->connectToRemoteService( | 424 frame->serviceRegistry()->connectToRemoteService( |
| 424 mojo::GetProxy(&m_permissionService)); | 425 mojo::GetProxy(&m_permissionService)); |
| 425 m_permissionService.set_connection_error_handler(createBaseCallback(bind(&Ge
olocation::onPermissionConnectionError, WeakPersistentThisPointer<Geolocation>(t
his)))); | 426 m_permissionService.set_connection_error_handler(createBaseCallback(bind(&Ge
olocation::onPermissionConnectionError, WeakPersistentThisPointer<Geolocation>(t
his)))); |
| 426 | 427 |
| 427 // Ask the embedder: it maintains the geolocation challenge policy itself. | 428 // Ask the embedder: it maintains the geolocation challenge policy itself. |
| 428 m_permissionService->RequestPermission( | 429 m_permissionService->RequestPermission( |
| 429 mojom::blink::PermissionName::GEOLOCATION, | 430 mojom::blink::PermissionName::GEOLOCATION, |
| 430 getExecutionContext()->getSecurityOrigin()->toString(), | 431 getExecutionContext()->getSecurityOrigin()->toString(), |
| 432 UserGestureIndicator::processingUserGesture(), |
| 431 createBaseCallback(bind<mojom::blink::PermissionStatus>(&Geolocation::on
GeolocationPermissionUpdated, this))); | 433 createBaseCallback(bind<mojom::blink::PermissionStatus>(&Geolocation::on
GeolocationPermissionUpdated, this))); |
| 432 } | 434 } |
| 433 | 435 |
| 434 void Geolocation::makeSuccessCallbacks() | 436 void Geolocation::makeSuccessCallbacks() |
| 435 { | 437 { |
| 436 DCHECK(m_lastPosition); | 438 DCHECK(m_lastPosition); |
| 437 DCHECK(isAllowed()); | 439 DCHECK(isAllowed()); |
| 438 | 440 |
| 439 GeoNotifierVector oneShotsCopy; | 441 GeoNotifierVector oneShotsCopy; |
| 440 copyToVector(m_oneShots, oneShotsCopy); | 442 copyToVector(m_oneShots, oneShotsCopy); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 error->setIsFatal(true); | 530 error->setIsFatal(true); |
| 529 handleError(error); | 531 handleError(error); |
| 530 } | 532 } |
| 531 | 533 |
| 532 void Geolocation::onPermissionConnectionError() | 534 void Geolocation::onPermissionConnectionError() |
| 533 { | 535 { |
| 534 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); | 536 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); |
| 535 } | 537 } |
| 536 | 538 |
| 537 } // namespace blink | 539 } // namespace blink |
| OLD | NEW |