Add geolocation support (issue #365).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@780 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-09-14 19:04:45 +00:00
parent 2705f19cf6
commit 3cf6d92539
35 changed files with 1219 additions and 4 deletions

View File

@@ -15,6 +15,7 @@
#include "libcef_dll/ctocpp/drag_handler_ctocpp.h"
#include "libcef_dll/ctocpp/find_handler_ctocpp.h"
#include "libcef_dll/ctocpp/focus_handler_ctocpp.h"
#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h"
#include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h"
#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h"
#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h"
@@ -211,6 +212,20 @@ CefRefPtr<CefDragHandler> CefClientCToCpp::GetDragHandler() {
return CefDragHandlerCToCpp::Wrap(_retval);
}
CefRefPtr<CefGeolocationHandler> CefClientCToCpp::GetGeolocationHandler() {
if (CEF_MEMBER_MISSING(struct_, get_geolocation_handler))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_geolocation_handler_t* _retval = struct_->get_geolocation_handler(
struct_);
// Return type: refptr_same
return CefGeolocationHandlerCToCpp::Wrap(_retval);
}
#ifndef NDEBUG
template<> long CefCToCpp<CefClientCToCpp, CefClient,

View File

@@ -46,6 +46,7 @@ class CefClientCToCpp
virtual CefRefPtr<CefV8ContextHandler> GetV8ContextHandler() OVERRIDE;
virtual CefRefPtr<CefRenderHandler> GetRenderHandler() OVERRIDE;
virtual CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE;
virtual CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() OVERRIDE;
};
#endif // BUILDING_CEF_SHARED

View File

@@ -0,0 +1,34 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/geolocation_callback_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
void CefGeolocationCallbackCToCpp::Continue(bool allow) {
if (CEF_MEMBER_MISSING(struct_, cont))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
struct_->cont(struct_,
allow);
}
#ifndef NDEBUG
template<> long CefCToCpp<CefGeolocationCallbackCToCpp, CefGeolocationCallback,
cef_geolocation_callback_t>::DebugObjCt = 0;
#endif

View File

@@ -0,0 +1,42 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_CALLBACK_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_CALLBACK_CTOCPP_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_geolocation_handler.h"
#include "include/capi/cef_geolocation_handler_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefGeolocationCallbackCToCpp
: public CefCToCpp<CefGeolocationCallbackCToCpp, CefGeolocationCallback,
cef_geolocation_callback_t> {
public:
explicit CefGeolocationCallbackCToCpp(cef_geolocation_callback_t* str)
: CefCToCpp<CefGeolocationCallbackCToCpp, CefGeolocationCallback,
cef_geolocation_callback_t>(str) {}
virtual ~CefGeolocationCallbackCToCpp() {}
// CefGeolocationCallback methods
virtual void Continue(bool allow) OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_CALLBACK_CTOCPP_H_

View File

@@ -0,0 +1,78 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/geolocation_callback_cpptoc.h"
#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
void CefGeolocationHandlerCToCpp::OnRequestGeolocationPermission(
CefRefPtr<CefBrowser> browser, const CefString& requesting_url,
int request_id, CefRefPtr<CefGeolocationCallback> callback) {
if (CEF_MEMBER_MISSING(struct_, on_request_geolocation_permission))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return;
// Verify param: requesting_url; type: string_byref_const
DCHECK(!requesting_url.empty());
if (requesting_url.empty())
return;
// Verify param: callback; type: refptr_diff
DCHECK(callback.get());
if (!callback.get())
return;
// Execute
struct_->on_request_geolocation_permission(struct_,
CefBrowserCppToC::Wrap(browser),
requesting_url.GetStruct(),
request_id,
CefGeolocationCallbackCppToC::Wrap(callback));
}
void CefGeolocationHandlerCToCpp::OnCancelGeolocationPermission(
CefRefPtr<CefBrowser> browser, const CefString& requesting_url,
int request_id) {
if (CEF_MEMBER_MISSING(struct_, on_cancel_geolocation_permission))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return;
// Verify param: requesting_url; type: string_byref_const
DCHECK(!requesting_url.empty());
if (requesting_url.empty())
return;
// Execute
struct_->on_cancel_geolocation_permission(struct_,
CefBrowserCppToC::Wrap(browser),
requesting_url.GetStruct(),
request_id);
}
#ifndef NDEBUG
template<> long CefCToCpp<CefGeolocationHandlerCToCpp, CefGeolocationHandler,
cef_geolocation_handler_t>::DebugObjCt = 0;
#endif

View File

@@ -0,0 +1,46 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_HANDLER_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_HANDLER_CTOCPP_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_geolocation_handler.h"
#include "include/capi/cef_geolocation_handler_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefGeolocationHandlerCToCpp
: public CefCToCpp<CefGeolocationHandlerCToCpp, CefGeolocationHandler,
cef_geolocation_handler_t> {
public:
explicit CefGeolocationHandlerCToCpp(cef_geolocation_handler_t* str)
: CefCToCpp<CefGeolocationHandlerCToCpp, CefGeolocationHandler,
cef_geolocation_handler_t>(str) {}
virtual ~CefGeolocationHandlerCToCpp() {}
// CefGeolocationHandler methods
virtual void OnRequestGeolocationPermission(CefRefPtr<CefBrowser> browser,
const CefString& requesting_url, int request_id,
CefRefPtr<CefGeolocationCallback> callback) OVERRIDE;
virtual void OnCancelGeolocationPermission(CefRefPtr<CefBrowser> browser,
const CefString& requesting_url, int request_id) OVERRIDE;
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_HANDLER_CTOCPP_H_