Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/Source/modules/geolocation/Geolocation.cpp

Issue 2255933002: Add PermissionDescriptor to the permissions Mojo interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_notification_dispatcher
Patch Set: Collect utility functions into PermissionUtils.h. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 "modules/permissions/PermissionUtils.h"
36 #include "platform/UserGestureIndicator.h" 37 #include "platform/UserGestureIndicator.h"
37 #include "platform/mojo/MojoHelper.h"
38 #include "public/platform/InterfaceProvider.h" 38 #include "public/platform/InterfaceProvider.h"
39 #include "public/platform/Platform.h" 39 #include "public/platform/Platform.h"
40 #include "wtf/Assertions.h" 40 #include "wtf/Assertions.h"
41 #include "wtf/CurrentTime.h" 41 #include "wtf/CurrentTime.h"
42 42
43 namespace blink { 43 namespace blink {
44 namespace { 44 namespace {
45 45
46 static const char permissionDeniedErrorMessage[] = "User denied Geolocation"; 46 static const char permissionDeniedErrorMessage[] = "User denied Geolocation";
47 static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocat ion service"; 47 static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocat ion service";
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(mojo::GetProxy(&m_permissionService )); 425 frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_permissionService ));
426 m_permissionService.set_connection_error_handler(convertToBaseCallback(WTF:: bind(&Geolocation::onPermissionConnectionError, wrapWeakPersistent(this)))); 426 m_permissionService.set_connection_error_handler(convertToBaseCallback(WTF:: bind(&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 createPermissionDescriptor(mojom::blink::PermissionName::GEOLOCATION),
431 getExecutionContext()->getSecurityOrigin(), 431 getExecutionContext()->getSecurityOrigin(),
432 UserGestureIndicator::processingUserGesture(), 432 UserGestureIndicator::processingUserGesture(),
433 convertToBaseCallback(WTF::bind(&Geolocation::onGeolocationPermissionUpd ated, wrapPersistent(this)))); 433 convertToBaseCallback(WTF::bind(&Geolocation::onGeolocationPermissionUpd ated, 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
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 // be called. In that case, blink has already shut down so do nothing. 544 // be called. In that case, blink has already shut down so do nothing.
545 // 545 //
546 // TODO(sammc): Remove this once renderer shutdown is no longer graceful. 546 // TODO(sammc): Remove this once renderer shutdown is no longer graceful.
547 if (!Platform::current()) 547 if (!Platform::current())
548 return; 548 return;
549 549
550 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); 550 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED);
551 } 551 }
552 552
553 } // namespace blink 553 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698