cef类SimpleHandler没有成员

时间:2017-08-30 15:53:18

标签: c++ chromium-embedded

我在扩展 cefsimple 应用程序时遇到了什么错误,与其中一个函数出现相同的错误:

#1 class" SimpleHandler"没有会员" OnContextCreated"

simple_handler.h

#include "include/cef_render_process_handler.h"
class SimpleHandler : /*...*/ public CefRenderProcessHandler
// ...
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() {
return this; }
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser, 
CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) OVERRIDE;

simple_handler.cc

void SimpleHandler::OnContextCreated(CefRefPtr<CefBrowser> browser, 
CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) { /*do stuff*/ }

#2 class&#34; SimpleHandler&#34;没有会员&#34; OnBeforeBrowse&#34;

simple_handler.h

class SimpleHandler : /*...*/ public CefRequestHandler
// ...
virtual CefRefPtr<CefRequestHandler> GetRequestHandler() OVERRIDE { return 
this; }
virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser, 
CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request, bool is_redirect) OVERRIDE

simple_handler.cc

bool SimpleHandler::OnBeforeBrowse(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request, bool is_redirect) { /*do stuff*/ }

1 个答案:

答案 0 :(得分:0)

将所有内容重新安装到最新版本并且有效,以供参考,如果有人遇到同样的问题。

simple_handler.h

class SimpleHandler :  /* ... */ public CefRequestHandler {
  /* ... */
  virtual CefRefPtr<CefRequestHandler> GetRequestHandler() OVERRIDE { return this; }
  // CefRequestHandler methods:
  bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
                      CefRefPtr<CefFrame> frame,
                      CefRefPtr<CefRequest> request,
                      bool is_redirect) OVERRIDE;
}

simple_handler.cc

bool SimpleHandler::OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
                                   CefRefPtr<CefFrame> frame,
                                   CefRefPtr<CefRequest> request,
                                   bool is_redirect) {
                                   CEF_REQUIRE_UI_THREAD();

return true; // disable links
}