Files
cefsharp/CefSharp.Wpf.Example/Handlers/GeolocationHandler.cs
T
amaitland 52791957d5 Update callback usage examples
Add some comments in example RequestHandler about disposing of callbacks
2015-09-09 09:18:27 +10:00

29 lines
1.1 KiB
C#

// Copyright © 2010-2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Windows;
namespace CefSharp.Wpf.Example.Handlers
{
internal class GeolocationHandler : IGeolocationHandler
{
public bool OnRequestGeolocationPermission(IWebBrowser browserControl, IBrowser browser, string requestingUrl, int requestId, IGeolocationCallback callback)
{
using (callback)
{
var result = MessageBox.Show(String.Format("{0} wants to use your computer's location. Allow? ** You must set your Google API key in CefExample.Init() for this to work. **", requestingUrl), "Geolocation", MessageBoxButton.YesNo);
callback.Continue(result == MessageBoxResult.Yes);
return result == MessageBoxResult.Yes;
}
}
public void OnCancelGeolocationPermission(IWebBrowser browserControl, IBrowser browser, string requestingUrl, int requestId)
{
}
}
}