Add CefBrowserHost::GetNavigationEntries for retrieving a snapshot of navigation history (issue #1442).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1924 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2014-11-24 19:23:26 +00:00
parent 70ed757e5a
commit 8eb14dd71f
24 changed files with 1272 additions and 3 deletions

View File

@ -957,6 +957,8 @@
'libcef/browser/menu_model_impl.h',
'libcef/browser/navigate_params.cc',
'libcef/browser/navigate_params.h',
'libcef/browser/navigation_entry_impl.cc',
'libcef/browser/navigation_entry_impl.h',
'libcef/browser/origin_whitelist_impl.cc',
'libcef/browser/origin_whitelist_impl.h',
'libcef/browser/path_util_impl.cc',

View File

@ -37,6 +37,7 @@
'include/cef_life_span_handler.h',
'include/cef_load_handler.h',
'include/cef_menu_model.h',
'include/cef_navigation_entry.h',
'include/cef_origin_whitelist.h',
'include/cef_path_util.h',
'include/cef_print_handler.h',
@ -91,6 +92,7 @@
'include/capi/cef_life_span_handler_capi.h',
'include/capi/cef_load_handler_capi.h',
'include/capi/cef_menu_model_capi.h',
'include/capi/cef_navigation_entry_capi.h',
'include/capi/cef_origin_whitelist_capi.h',
'include/capi/cef_path_util_capi.h',
'include/capi/cef_print_handler_capi.h',
@ -202,6 +204,10 @@
'libcef_dll/ctocpp/load_handler_ctocpp.h',
'libcef_dll/cpptoc/menu_model_cpptoc.cc',
'libcef_dll/cpptoc/menu_model_cpptoc.h',
'libcef_dll/cpptoc/navigation_entry_cpptoc.cc',
'libcef_dll/cpptoc/navigation_entry_cpptoc.h',
'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.cc',
'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h',
'libcef_dll/cpptoc/post_data_cpptoc.cc',
'libcef_dll/cpptoc/post_data_cpptoc.h',
'libcef_dll/cpptoc/post_data_element_cpptoc.cc',
@ -368,6 +374,10 @@
'libcef_dll/cpptoc/load_handler_cpptoc.h',
'libcef_dll/ctocpp/menu_model_ctocpp.cc',
'libcef_dll/ctocpp/menu_model_ctocpp.h',
'libcef_dll/ctocpp/navigation_entry_ctocpp.cc',
'libcef_dll/ctocpp/navigation_entry_ctocpp.h',
'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.cc',
'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h',
'libcef_dll/ctocpp/post_data_ctocpp.cc',
'libcef_dll/ctocpp/post_data_ctocpp.h',
'libcef_dll/ctocpp/post_data_element_ctocpp.cc',

View File

@ -41,6 +41,7 @@
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_drag_data_capi.h"
#include "include/capi/cef_frame_capi.h"
#include "include/capi/cef_navigation_entry_capi.h"
#include "include/capi/cef_process_message_capi.h"
#include "include/capi/cef_request_context_capi.h"
@ -204,6 +205,29 @@ typedef struct _cef_run_file_dialog_callback_t {
} cef_run_file_dialog_callback_t;
///
// Callback structure for cef_browser_host_t::GetNavigationEntries. The
// functions of this structure will be called on the browser process UI thread.
///
typedef struct _cef_navigation_entry_visitor_t {
///
// Base structure.
///
cef_base_t base;
///
// Method that will be executed. Do not keep a reference to |entry| outside of
// this callback. Return true (1) to continue visiting entries or false (0) to
// stop. |current| is true (1) if this entry is the currently loaded
// navigation entry. |index| is the 0-based index of this entry and |total| is
// the total number of entries.
///
int (CEF_CALLBACK *visit)(struct _cef_navigation_entry_visitor_t* self,
struct _cef_navigation_entry_t* entry, int current, int index,
int total);
} cef_navigation_entry_visitor_t;
///
// Structure used to represent the browser process aspects of a browser window.
// The functions of this structure can only be called in the browser process.
@ -348,6 +372,16 @@ typedef struct _cef_browser_host_t {
///
void (CEF_CALLBACK *close_dev_tools)(struct _cef_browser_host_t* self);
///
// Retrieve a snapshot of current navigation entries as values sent to the
// specified visitor. If |current_only| is true (1) only the current
// navigation entry will be sent, otherwise all navigation entries will be
// sent.
///
///
void (CEF_CALLBACK *get_navigation_entries)(struct _cef_browser_host_t* self,
struct _cef_navigation_entry_visitor_t* visitor, int current_only);
///
// Set whether mouse cursor change is disabled.
///

View File

@ -0,0 +1,134 @@
// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_NAVIGATION_ENTRY_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_NAVIGATION_ENTRY_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Structure used to represent an entry in navigation history.
///
typedef struct _cef_navigation_entry_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns true (1) if this object is valid. Do not call any other functions
// if this function returns false (0).
///
int (CEF_CALLBACK *is_valid)(struct _cef_navigation_entry_t* self);
///
// Returns the actual URL of the page. For some pages this may be data: URL or
// similar. Use get_display_url() to return a display-friendly version.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_url)(
struct _cef_navigation_entry_t* self);
///
// Returns a display-friendly version of the URL.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_display_url)(
struct _cef_navigation_entry_t* self);
///
// Returns the original URL that was entered by the user before any redirects.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_original_url)(
struct _cef_navigation_entry_t* self);
///
// Returns the title set by the page. This value may be NULL.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_title)(
struct _cef_navigation_entry_t* self);
///
// Returns the transition type which indicates what the user did to move to
// this page from the previous page.
///
cef_transition_type_t (CEF_CALLBACK *get_transition_type)(
struct _cef_navigation_entry_t* self);
///
// Returns true (1) if this navigation includes post data.
///
int (CEF_CALLBACK *has_post_data)(struct _cef_navigation_entry_t* self);
///
// Returns the name of the sub-frame that navigated or an NULL value if the
// main frame navigated.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_frame_name)(
struct _cef_navigation_entry_t* self);
///
// Returns the time for the last known successful navigation completion. A
// navigation may be completed more than once if the page is reloaded. May be
// 0 if the navigation has not yet completed.
///
cef_time_t (CEF_CALLBACK *get_completion_time)(
struct _cef_navigation_entry_t* self);
///
// Returns the HTTP status code for the last known successful navigation
// response. May be 0 if the response has not yet been received or if the
// navigation has not yet completed.
///
int (CEF_CALLBACK *get_http_status_code)(
struct _cef_navigation_entry_t* self);
} cef_navigation_entry_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_NAVIGATION_ENTRY_CAPI_H_

View File

@ -41,6 +41,7 @@
#include "include/cef_base.h"
#include "include/cef_drag_data.h"
#include "include/cef_frame.h"
#include "include/cef_navigation_entry.h"
#include "include/cef_process_message.h"
#include "include/cef_request_context.h"
#include <vector>
@ -210,6 +211,28 @@ class CefRunFileDialogCallback : public virtual CefBase {
};
///
// Callback interface for CefBrowserHost::GetNavigationEntries. The methods of
// this class will be called on the browser process UI thread.
///
/*--cef(source=client)--*/
class CefNavigationEntryVisitor : public virtual CefBase {
public:
///
// Method that will be executed. Do not keep a reference to |entry| outside of
// this callback. Return true to continue visiting entries or false to stop.
// |current| is true if this entry is the currently loaded navigation entry.
// |index| is the 0-based index of this entry and |total| is the total number
// of entries.
///
/*--cef()--*/
virtual bool Visit(CefRefPtr<CefNavigationEntry> entry,
bool current,
int index,
int total) =0;
};
///
// Class used to represent the browser process aspects of a browser window. The
// methods of this class can only be called in the browser process. They may be
@ -394,6 +417,17 @@ class CefBrowserHost : public virtual CefBase {
/*--cef()--*/
virtual void CloseDevTools() =0;
///
// Retrieve a snapshot of current navigation entries as values sent to the
// specified visitor. If |current_only| is true only the current navigation
// entry will be sent, otherwise all navigation entries will be sent.
///
///
/*--cef()--*/
virtual void GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) =0;
///
// Set whether mouse cursor change is disabled.
///

View File

@ -0,0 +1,120 @@
// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_NAVIGATION_ENTRY_H_
#define CEF_INCLUDE_CEF_NAVIGATION_ENTRY_H_
#pragma once
#include "include/cef_base.h"
///
// Class used to represent an entry in navigation history.
///
/*--cef(source=library)--*/
class CefNavigationEntry : public virtual CefBase {
public:
typedef cef_transition_type_t TransitionType;
///
// Returns true if this object is valid. Do not call any other methods if this
// function returns false.
///
/*--cef()--*/
virtual bool IsValid() =0;
///
// Returns the actual URL of the page. For some pages this may be data: URL or
// similar. Use GetDisplayURL() to return a display-friendly version.
///
/*--cef()--*/
virtual CefString GetURL() =0;
///
// Returns a display-friendly version of the URL.
///
/*--cef()--*/
virtual CefString GetDisplayURL() =0;
///
// Returns the original URL that was entered by the user before any redirects.
///
/*--cef()--*/
virtual CefString GetOriginalURL() =0;
///
// Returns the title set by the page. This value may be empty.
///
/*--cef()--*/
virtual CefString GetTitle() =0;
///
// Returns the transition type which indicates what the user did to move to
// this page from the previous page.
///
/*--cef(default_retval=TT_EXPLICIT)--*/
virtual TransitionType GetTransitionType() =0;
///
// Returns true if this navigation includes post data.
///
/*--cef()--*/
virtual bool HasPostData() =0;
///
// Returns the name of the sub-frame that navigated or an empty value if the
// main frame navigated.
///
/*--cef()--*/
virtual CefString GetFrameName() =0;
///
// Returns the time for the last known successful navigation completion. A
// navigation may be completed more than once if the page is reloaded. May be
// 0 if the navigation has not yet completed.
///
/*--cef()--*/
virtual CefTime GetCompletionTime() =0;
///
// Returns the HTTP status code for the last known successful navigation
// response. May be 0 if the response has not yet been received or if the
// navigation has not yet completed.
///
/*--cef()--*/
virtual int GetHttpStatusCode() =0;
};
#endif // CEF_INCLUDE_CEF_NAVIGATION_ENTRY_H_

View File

@ -18,6 +18,7 @@
#include "libcef/browser/devtools_frontend.h"
#include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/navigate_params.h"
#include "libcef/browser/navigation_entry_impl.h"
#include "libcef/browser/printing/print_view_manager.h"
#include "libcef/browser/render_widget_host_view_osr.h"
#include "libcef/browser/request_context_impl.h"
@ -857,6 +858,46 @@ void CefBrowserHostImpl::CloseDevTools() {
}
}
void CefBrowserHostImpl::GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) {
DCHECK(visitor.get());
if (!visitor.get())
return;
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::GetNavigationEntries, this, visitor,
current_only));
return;
}
if (!web_contents())
return;
const content::NavigationController& controller =
web_contents()->GetController();
const int total = controller.GetEntryCount();
const int current = controller.GetCurrentEntryIndex();
if (current_only) {
// Visit only the current entry.
CefRefPtr<CefNavigationEntryImpl> entry =
new CefNavigationEntryImpl(controller.GetEntryAtIndex(current));
visitor->Visit(entry.get(), true, current, total);
entry->Detach(NULL);
} else {
// Visit all entries.
bool cont = true;
for (int i = 0; i < total && cont; ++i) {
CefRefPtr<CefNavigationEntryImpl> entry =
new CefNavigationEntryImpl(controller.GetEntryAtIndex(i));
cont = visitor->Visit(entry.get(), (i == current), i, total);
entry->Detach(NULL);
}
}
}
void CefBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) {
base::AutoLock lock_scope(state_lock_);
mouse_cursor_change_disabled_ = disabled;

View File

@ -155,6 +155,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
const CefBrowserSettings& settings,
const CefPoint& inspect_element_at) override;
void CloseDevTools() override;
void GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) override;
void SetMouseCursorChangeDisabled(bool disabled) override;
bool IsMouseCursorChangeDisabled() override;
bool IsWindowRenderingDisabled() override;

View File

@ -0,0 +1,69 @@
// Copyright (c) 2014 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.
#include "libcef/browser/navigation_entry_impl.h"
#include "libcef/common/time_util.h"
#include "content/public/browser/navigation_entry.h"
#include "url/gurl.h"
CefNavigationEntryImpl::CefNavigationEntryImpl(content::NavigationEntry* value)
: CefValueBase<CefNavigationEntry, content::NavigationEntry>(
value, NULL, kOwnerNoDelete, true,
new CefValueControllerNonThreadSafe()) {
// Indicate that this object owns the controller.
SetOwnsController();
}
bool CefNavigationEntryImpl::IsValid() {
return !detached();
}
CefString CefNavigationEntryImpl::GetURL() {
CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().GetURL().spec();
}
CefString CefNavigationEntryImpl::GetDisplayURL() {
CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().GetVirtualURL().spec();
}
CefString CefNavigationEntryImpl::GetOriginalURL() {
CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().GetUserTypedURL().spec();
}
CefString CefNavigationEntryImpl::GetTitle() {
CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().GetTitle();
}
CefNavigationEntry::TransitionType CefNavigationEntryImpl::GetTransitionType() {
CEF_VALUE_VERIFY_RETURN(false, TT_EXPLICIT);
return static_cast<TransitionType>(const_value().GetTransitionType());
}
bool CefNavigationEntryImpl::HasPostData() {
CEF_VALUE_VERIFY_RETURN(false, false);
return const_value().GetHasPostData();
}
CefString CefNavigationEntryImpl::GetFrameName() {
CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().GetFrameToNavigate();
}
CefTime CefNavigationEntryImpl::GetCompletionTime() {
CefTime time;
CEF_VALUE_VERIFY_RETURN(false, time);
cef_time_from_basetime(const_value().GetTimestamp(), time);
return time;
}
int CefNavigationEntryImpl::GetHttpStatusCode() {
CEF_VALUE_VERIFY_RETURN(false, 0);
return const_value().GetHttpStatusCode();
}

View File

@ -0,0 +1,38 @@
// Copyright (c) 2014 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.
#ifndef CEF_LIBCEF_BROWSER_NAVIGATION_ENTRY_IMPL_H_
#define CEF_LIBCEF_BROWSER_NAVIGATION_ENTRY_IMPL_H_
#pragma once
#include "include/cef_navigation_entry.h"
#include "libcef/common/value_base.h"
namespace content {
class NavigationEntry;
}
// CefDownloadItem implementation
class CefNavigationEntryImpl
: public CefValueBase<CefNavigationEntry, content::NavigationEntry> {
public:
explicit CefNavigationEntryImpl(content::NavigationEntry* value);
// CefNavigationEntry methods.
bool IsValid() override;
CefString GetURL() override;
CefString GetDisplayURL() override;
CefString GetOriginalURL() override;
CefString GetTitle() override;
TransitionType GetTransitionType() override;
bool HasPostData() override;
CefString GetFrameName() override;
CefTime GetCompletionTime() override;
int GetHttpStatusCode() override;
private:
DISALLOW_COPY_AND_ASSIGN(CefNavigationEntryImpl);
};
#endif // CEF_LIBCEF_BROWSER_NAVIGATION_ENTRY_IMPL_H_

View File

@ -15,6 +15,7 @@
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
#include "libcef_dll/ctocpp/client_ctocpp.h"
#include "libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h"
#include "libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.h"
#include "libcef_dll/transfer_util.h"
@ -389,6 +390,25 @@ void CEF_CALLBACK browser_host_close_dev_tools(
CefBrowserHostCppToC::Get(self)->CloseDevTools();
}
void CEF_CALLBACK browser_host_get_navigation_entries(
struct _cef_browser_host_t* self, cef_navigation_entry_visitor_t* visitor,
int current_only) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: visitor; type: refptr_diff
DCHECK(visitor);
if (!visitor)
return;
// Execute
CefBrowserHostCppToC::Get(self)->GetNavigationEntries(
CefNavigationEntryVisitorCToCpp::Wrap(visitor),
current_only?true:false);
}
void CEF_CALLBACK browser_host_set_mouse_cursor_change_disabled(
struct _cef_browser_host_t* self, int disabled) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -830,6 +850,7 @@ CefBrowserHostCppToC::CefBrowserHostCppToC(CefBrowserHost* cls)
struct_.struct_.stop_finding = browser_host_stop_finding;
struct_.struct_.show_dev_tools = browser_host_show_dev_tools;
struct_.struct_.close_dev_tools = browser_host_close_dev_tools;
struct_.struct_.get_navigation_entries = browser_host_get_navigation_entries;
struct_.struct_.set_mouse_cursor_change_disabled =
browser_host_set_mouse_cursor_change_disabled;
struct_.struct_.is_mouse_cursor_change_disabled =

View File

@ -0,0 +1,191 @@
// Copyright (c) 2014 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/navigation_entry_cpptoc.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK navigation_entry_is_valid(
struct _cef_navigation_entry_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefNavigationEntryCppToC::Get(self)->IsValid();
// Return type: bool
return _retval;
}
cef_string_userfree_t CEF_CALLBACK navigation_entry_get_url(
struct _cef_navigation_entry_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefNavigationEntryCppToC::Get(self)->GetURL();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK navigation_entry_get_display_url(
struct _cef_navigation_entry_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefNavigationEntryCppToC::Get(self)->GetDisplayURL();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK navigation_entry_get_original_url(
struct _cef_navigation_entry_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefNavigationEntryCppToC::Get(self)->GetOriginalURL();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK navigation_entry_get_title(
struct _cef_navigation_entry_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefNavigationEntryCppToC::Get(self)->GetTitle();
// Return type: string
return _retval.DetachToUserFree();
}
cef_transition_type_t CEF_CALLBACK navigation_entry_get_transition_type(
struct _cef_navigation_entry_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return TT_EXPLICIT;
// Execute
cef_transition_type_t _retval = CefNavigationEntryCppToC::Get(
self)->GetTransitionType();
// Return type: simple
return _retval;
}
int CEF_CALLBACK navigation_entry_has_post_data(
struct _cef_navigation_entry_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefNavigationEntryCppToC::Get(self)->HasPostData();
// Return type: bool
return _retval;
}
cef_string_userfree_t CEF_CALLBACK navigation_entry_get_frame_name(
struct _cef_navigation_entry_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefNavigationEntryCppToC::Get(self)->GetFrameName();
// Return type: string
return _retval.DetachToUserFree();
}
cef_time_t CEF_CALLBACK navigation_entry_get_completion_time(
struct _cef_navigation_entry_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefTime();
// Execute
cef_time_t _retval = CefNavigationEntryCppToC::Get(self)->GetCompletionTime();
// Return type: simple
return _retval;
}
int CEF_CALLBACK navigation_entry_get_http_status_code(
struct _cef_navigation_entry_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefNavigationEntryCppToC::Get(self)->GetHttpStatusCode();
// Return type: simple
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.
CefNavigationEntryCppToC::CefNavigationEntryCppToC(CefNavigationEntry* cls)
: CefCppToC<CefNavigationEntryCppToC, CefNavigationEntry,
cef_navigation_entry_t>(cls) {
struct_.struct_.is_valid = navigation_entry_is_valid;
struct_.struct_.get_url = navigation_entry_get_url;
struct_.struct_.get_display_url = navigation_entry_get_display_url;
struct_.struct_.get_original_url = navigation_entry_get_original_url;
struct_.struct_.get_title = navigation_entry_get_title;
struct_.struct_.get_transition_type = navigation_entry_get_transition_type;
struct_.struct_.has_post_data = navigation_entry_has_post_data;
struct_.struct_.get_frame_name = navigation_entry_get_frame_name;
struct_.struct_.get_completion_time = navigation_entry_get_completion_time;
struct_.struct_.get_http_status_code = navigation_entry_get_http_status_code;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCppToC<CefNavigationEntryCppToC,
CefNavigationEntry, cef_navigation_entry_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,36 @@
// Copyright (c) 2014 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_CPPTOC_NAVIGATION_ENTRY_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_NAVIGATION_ENTRY_CPPTOC_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_navigation_entry.h"
#include "include/capi/cef_navigation_entry_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefNavigationEntryCppToC
: public CefCppToC<CefNavigationEntryCppToC, CefNavigationEntry,
cef_navigation_entry_t> {
public:
explicit CefNavigationEntryCppToC(CefNavigationEntry* cls);
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_NAVIGATION_ENTRY_CPPTOC_H_

View File

@ -0,0 +1,59 @@
// Copyright (c) 2014 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/navigation_entry_visitor_cpptoc.h"
#include "libcef_dll/ctocpp/navigation_entry_ctocpp.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK navigation_entry_visitor_visit(
struct _cef_navigation_entry_visitor_t* self,
struct _cef_navigation_entry_t* entry, int current, int index,
int total) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: entry; type: refptr_diff
DCHECK(entry);
if (!entry)
return 0;
// Execute
bool _retval = CefNavigationEntryVisitorCppToC::Get(self)->Visit(
CefNavigationEntryCToCpp::Wrap(entry),
current?true:false,
index,
total);
// Return type: bool
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.
CefNavigationEntryVisitorCppToC::CefNavigationEntryVisitorCppToC(
CefNavigationEntryVisitor* cls)
: CefCppToC<CefNavigationEntryVisitorCppToC, CefNavigationEntryVisitor,
cef_navigation_entry_visitor_t>(cls) {
struct_.struct_.visit = navigation_entry_visitor_visit;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCppToC<CefNavigationEntryVisitorCppToC,
CefNavigationEntryVisitor, cef_navigation_entry_visitor_t>::DebugObjCt =
0;
#endif

View File

@ -0,0 +1,38 @@
// Copyright (c) 2014 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_CPPTOC_NAVIGATION_ENTRY_VISITOR_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_NAVIGATION_ENTRY_VISITOR_CPPTOC_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_browser.h"
#include "include/capi/cef_browser_capi.h"
#include "include/cef_client.h"
#include "include/capi/cef_client_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefNavigationEntryVisitorCppToC
: public CefCppToC<CefNavigationEntryVisitorCppToC,
CefNavigationEntryVisitor, cef_navigation_entry_visitor_t> {
public:
explicit CefNavigationEntryVisitorCppToC(CefNavigationEntryVisitor* cls);
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_NAVIGATION_ENTRY_VISITOR_CPPTOC_H_

View File

@ -11,6 +11,7 @@
//
#include "libcef_dll/cpptoc/client_cpptoc.h"
#include "libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h"
#include "libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h"
#include "libcef_dll/ctocpp/browser_ctocpp.h"
#include "libcef_dll/ctocpp/browser_host_ctocpp.h"
@ -310,6 +311,24 @@ void CefBrowserHostCToCpp::CloseDevTools() {
struct_->close_dev_tools(struct_);
}
void CefBrowserHostCToCpp::GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor, bool current_only) {
if (CEF_MEMBER_MISSING(struct_, get_navigation_entries))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: visitor; type: refptr_diff
DCHECK(visitor.get());
if (!visitor.get())
return;
// Execute
struct_->get_navigation_entries(struct_,
CefNavigationEntryVisitorCppToC::Wrap(visitor),
current_only);
}
void CefBrowserHostCToCpp::SetMouseCursorChangeDisabled(bool disabled) {
if (CEF_MEMBER_MISSING(struct_, set_mouse_cursor_change_disabled))
return;

View File

@ -59,6 +59,9 @@ class CefBrowserHostCToCpp
CefRefPtr<CefClient> client, const CefBrowserSettings& settings,
const CefPoint& inspect_element_at) OVERRIDE;
virtual void CloseDevTools() OVERRIDE;
virtual void GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) OVERRIDE;
virtual void SetMouseCursorChangeDisabled(bool disabled) OVERRIDE;
virtual bool IsMouseCursorChangeDisabled() OVERRIDE;
virtual void ReplaceMisspelling(const CefString& word) OVERRIDE;

View File

@ -0,0 +1,164 @@
// Copyright (c) 2014 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/navigation_entry_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
bool CefNavigationEntryCToCpp::IsValid() {
if (CEF_MEMBER_MISSING(struct_, is_valid))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_valid(struct_);
// Return type: bool
return _retval?true:false;
}
CefString CefNavigationEntryCToCpp::GetURL() {
if (CEF_MEMBER_MISSING(struct_, get_url))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_url(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefNavigationEntryCToCpp::GetDisplayURL() {
if (CEF_MEMBER_MISSING(struct_, get_display_url))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_display_url(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefNavigationEntryCToCpp::GetOriginalURL() {
if (CEF_MEMBER_MISSING(struct_, get_original_url))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_original_url(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefNavigationEntryCToCpp::GetTitle() {
if (CEF_MEMBER_MISSING(struct_, get_title))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_title(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefNavigationEntry::TransitionType CefNavigationEntryCToCpp::GetTransitionType(
) {
if (CEF_MEMBER_MISSING(struct_, get_transition_type))
return TT_EXPLICIT;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_transition_type_t _retval = struct_->get_transition_type(struct_);
// Return type: simple
return _retval;
}
bool CefNavigationEntryCToCpp::HasPostData() {
if (CEF_MEMBER_MISSING(struct_, has_post_data))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->has_post_data(struct_);
// Return type: bool
return _retval?true:false;
}
CefString CefNavigationEntryCToCpp::GetFrameName() {
if (CEF_MEMBER_MISSING(struct_, get_frame_name))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_frame_name(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefTime CefNavigationEntryCToCpp::GetCompletionTime() {
if (CEF_MEMBER_MISSING(struct_, get_completion_time))
return CefTime();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_time_t _retval = struct_->get_completion_time(struct_);
// Return type: simple
return _retval;
}
int CefNavigationEntryCToCpp::GetHttpStatusCode() {
if (CEF_MEMBER_MISSING(struct_, get_http_status_code))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->get_http_status_code(struct_);
// Return type: simple
return _retval;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCToCpp<CefNavigationEntryCToCpp,
CefNavigationEntry, cef_navigation_entry_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,50 @@
// Copyright (c) 2014 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_NAVIGATION_ENTRY_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_NAVIGATION_ENTRY_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_navigation_entry.h"
#include "include/capi/cef_navigation_entry_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 CefNavigationEntryCToCpp
: public CefCToCpp<CefNavigationEntryCToCpp, CefNavigationEntry,
cef_navigation_entry_t> {
public:
explicit CefNavigationEntryCToCpp(cef_navigation_entry_t* str)
: CefCToCpp<CefNavigationEntryCToCpp, CefNavigationEntry,
cef_navigation_entry_t>(str) {}
// CefNavigationEntry methods
virtual bool IsValid() OVERRIDE;
virtual CefString GetURL() OVERRIDE;
virtual CefString GetDisplayURL() OVERRIDE;
virtual CefString GetOriginalURL() OVERRIDE;
virtual CefString GetTitle() OVERRIDE;
virtual TransitionType GetTransitionType() OVERRIDE;
virtual bool HasPostData() OVERRIDE;
virtual CefString GetFrameName() OVERRIDE;
virtual CefTime GetCompletionTime() OVERRIDE;
virtual int GetHttpStatusCode() OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_NAVIGATION_ENTRY_CTOCPP_H_

View File

@ -0,0 +1,48 @@
// Copyright (c) 2014 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/navigation_entry_cpptoc.h"
#include "libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
bool CefNavigationEntryVisitorCToCpp::Visit(CefRefPtr<CefNavigationEntry> entry,
bool current, int index, int total) {
if (CEF_MEMBER_MISSING(struct_, visit))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: entry; type: refptr_diff
DCHECK(entry.get());
if (!entry.get())
return false;
// Execute
int _retval = struct_->visit(struct_,
CefNavigationEntryCppToC::Wrap(entry),
current,
index,
total);
// Return type: bool
return _retval?true:false;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCToCpp<CefNavigationEntryVisitorCToCpp,
CefNavigationEntryVisitor, cef_navigation_entry_visitor_t>::DebugObjCt =
0;
#endif

View File

@ -0,0 +1,44 @@
// Copyright (c) 2014 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_NAVIGATION_ENTRY_VISITOR_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_NAVIGATION_ENTRY_VISITOR_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_browser.h"
#include "include/capi/cef_browser_capi.h"
#include "include/cef_client.h"
#include "include/capi/cef_client_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 CefNavigationEntryVisitorCToCpp
: public CefCToCpp<CefNavigationEntryVisitorCToCpp,
CefNavigationEntryVisitor, cef_navigation_entry_visitor_t> {
public:
explicit CefNavigationEntryVisitorCToCpp(cef_navigation_entry_visitor_t* str)
: CefCToCpp<CefNavigationEntryVisitorCToCpp, CefNavigationEntryVisitor,
cef_navigation_entry_visitor_t>(str) {}
// CefNavigationEntryVisitor methods
bool Visit(CefRefPtr<CefNavigationEntry> entry, bool current, int index,
int total) override;
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_NAVIGATION_ENTRY_VISITOR_CTOCPP_H_

View File

@ -53,6 +53,7 @@
#include "libcef_dll/cpptoc/jsdialog_callback_cpptoc.h"
#include "libcef_dll/cpptoc/list_value_cpptoc.h"
#include "libcef_dll/cpptoc/menu_model_cpptoc.h"
#include "libcef_dll/cpptoc/navigation_entry_cpptoc.h"
#include "libcef_dll/cpptoc/print_dialog_callback_cpptoc.h"
#include "libcef_dll/cpptoc/print_job_callback_cpptoc.h"
#include "libcef_dll/cpptoc/print_settings_cpptoc.h"
@ -89,6 +90,7 @@
#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h"
#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h"
#include "libcef_dll/ctocpp/load_handler_ctocpp.h"
#include "libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h"
#include "libcef_dll/ctocpp/print_handler_ctocpp.h"
#include "libcef_dll/ctocpp/read_handler_ctocpp.h"
#include "libcef_dll/ctocpp/render_handler_ctocpp.h"
@ -221,6 +223,9 @@ CEF_EXPORT void cef_shutdown() {
DCHECK(base::AtomicRefCountIsZero(&CefListValueCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefLoadHandlerCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefMenuModelCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefNavigationEntryCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(
&CefNavigationEntryVisitorCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefPrintDialogCallbackCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefPrintHandlerCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefPrintJobCallbackCppToC::DebugObjCt));

View File

@ -51,6 +51,7 @@
#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h"
#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h"
#include "libcef_dll/cpptoc/load_handler_cpptoc.h"
#include "libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h"
#include "libcef_dll/cpptoc/print_handler_cpptoc.h"
#include "libcef_dll/cpptoc/read_handler_cpptoc.h"
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
@ -89,6 +90,7 @@
#include "libcef_dll/ctocpp/jsdialog_callback_ctocpp.h"
#include "libcef_dll/ctocpp/list_value_ctocpp.h"
#include "libcef_dll/ctocpp/menu_model_ctocpp.h"
#include "libcef_dll/ctocpp/navigation_entry_ctocpp.h"
#include "libcef_dll/ctocpp/print_dialog_callback_ctocpp.h"
#include "libcef_dll/ctocpp/print_job_callback_ctocpp.h"
#include "libcef_dll/ctocpp/print_settings_ctocpp.h"
@ -213,6 +215,9 @@ CEF_GLOBAL void CefShutdown() {
DCHECK(base::AtomicRefCountIsZero(&CefListValueCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefLoadHandlerCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefMenuModelCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefNavigationEntryCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(
&CefNavigationEntryVisitorCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefPrintDialogCallbackCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefPrintHandlerCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefPrintJobCallbackCToCpp::DebugObjCt));

View File

@ -251,6 +251,93 @@ class HistoryNavRendererTest : public ClientApp::RenderDelegate,
IMPLEMENT_REFCOUNTING(HistoryNavRendererTest);
};
class NavigationEntryVisitor : public CefNavigationEntryVisitor {
public:
NavigationEntryVisitor(int nav, TrackCallback* callback)
: nav_(nav),
callback_(callback),
expected_total_(0),
expected_current_index_(-1),
expected_forwardback_(),
callback_count_(0) {
// Determine the expected values.
for (int i = 0; i <= nav_; ++i) {
if (kHNavList[i].action == NA_LOAD) {
expected_total_++;
expected_current_index_++;
} else if (kHNavList[i].action == NA_BACK) {
expected_current_index_--;
} else if (kHNavList[i].action == NA_FORWARD) {
expected_current_index_++;
}
expected_forwardback_[expected_current_index_] =
(kHNavList[i].action != NA_LOAD);
}
}
~NavigationEntryVisitor() override {
EXPECT_EQ(callback_count_, expected_total_);
callback_->yes();
}
bool Visit(CefRefPtr<CefNavigationEntry> entry,
bool current,
int index,
int total) override {
// Only 3 loads total.
EXPECT_LT(index, 3);
EXPECT_LE(total, 3);
EXPECT_EQ((expected_current_index_ == index), current);
EXPECT_EQ(callback_count_, index);
EXPECT_EQ(expected_total_, total);
std::string expected_url;
std::string expected_title;
if (index == 0) {
expected_url = kHNav1;
expected_title = "Nav1";
} else if (index == 1) {
expected_url = kHNav2;
expected_title = "Nav2";
} else if (index == 2) {
expected_url = kHNav3;
expected_title = "Nav3";
}
EXPECT_TRUE(entry->IsValid());
EXPECT_STREQ(expected_url.c_str(), entry->GetURL().ToString().c_str());
EXPECT_STREQ(expected_url.c_str(),
entry->GetDisplayURL().ToString().c_str());
EXPECT_STREQ(expected_url.c_str(),
entry->GetOriginalURL().ToString().c_str());
EXPECT_STREQ(expected_title.c_str(), entry->GetTitle().ToString().c_str());
if (expected_forwardback_[index])
EXPECT_EQ(TT_EXPLICIT | TT_FORWARD_BACK_FLAG, entry->GetTransitionType());
else
EXPECT_EQ(TT_EXPLICIT, entry->GetTransitionType());
EXPECT_FALSE(entry->HasPostData());
EXPECT_TRUE(entry->GetFrameName().empty());
EXPECT_GT(entry->GetCompletionTime().GetTimeT(), 0);
EXPECT_EQ(200, entry->GetHttpStatusCode());
callback_count_++;
return true;
}
private:
const int nav_;
TrackCallback* callback_;
int expected_total_;
int expected_current_index_;
bool expected_forwardback_[3]; // Only 3 loads total.
int callback_count_;
IMPLEMENT_REFCOUNTING(NavigationEntryVisitor);
};
// Browser side.
class HistoryNavTestHandler : public TestHandler {
public:
@ -261,9 +348,15 @@ class HistoryNavTestHandler : public TestHandler {
void RunTest() override {
// Add the resources that we will navigate to/from.
AddResource(kHNav1, "<html>Nav1</html>", "text/html");
AddResource(kHNav2, "<html>Nav2</html>", "text/html");
AddResource(kHNav3, "<html>Nav3</html>", "text/html");
AddResource(kHNav1,
"<html><head><title>Nav1</title></head><body>Nav1</body></html>",
"text/html");
AddResource(kHNav2,
"<html><head><title>Nav2</title><body>Nav2</body></html>",
"text/html");
AddResource(kHNav3,
"<html><head><title>Nav3</title><body>Nav3</body></html>",
"text/html");
// Create the browser.
CreateBrowser(CefString());
@ -404,6 +497,12 @@ class HistoryNavTestHandler : public TestHandler {
got_load_end_[nav_].yes();
// Test that navigation entries are correct.
CefRefPtr<NavigationEntryVisitor> visitor =
new NavigationEntryVisitor(nav_, &got_correct_history_[nav_]);
browser->GetHost()->GetNavigationEntries(visitor.get(), false);
visitor = NULL;
std::string url1 = browser->GetMainFrame()->GetURL();
std::string url2 = frame->GetURL();
if (url1 == item.target && url2 == item.target)
@ -454,6 +553,7 @@ class HistoryNavTestHandler : public TestHandler {
TrackCallback got_load_start_[NAV_LIST_SIZE()];
TrackCallback got_correct_load_start_url_[NAV_LIST_SIZE()];
TrackCallback got_load_end_[NAV_LIST_SIZE()];
TrackCallback got_correct_history_[NAV_LIST_SIZE()];
TrackCallback got_correct_load_end_url_[NAV_LIST_SIZE()];
TrackCallback got_correct_can_go_back2_[NAV_LIST_SIZE()];
TrackCallback got_correct_can_go_forward2_[NAV_LIST_SIZE()];
@ -485,6 +585,7 @@ TEST(NavigationTest, History) {
if (kHNavList[i].action != NA_CLEAR) {
ASSERT_TRUE(handler->got_load_end_[i]) << "i = " << i;
ASSERT_TRUE(handler->got_correct_history_[i]) << "i = " << i;
ASSERT_TRUE(handler->got_correct_load_end_url_[i]) << "i = " << i;
ASSERT_TRUE(handler->got_correct_can_go_back2_[i]) << "i = " << i;
ASSERT_TRUE(handler->got_correct_can_go_forward2_[i]) << "i = " << i;