cef

1. 删除cef3浏览器的右键菜单

// client_handler.cpp

void ClientHandler::OnBeforeContextMenu(
    CefRefPtr<CefBrowser> browser,
    CefRefPtr<CefFrame> frame,
    CefRefPtr<CefContextMenuParams> params,
    CefRefPtr<CefMenuModel> model) {
        model->Clear();
        return;
}
View Code

2. 禁止cef3浏览器鼠标形状变化

  当网页加载完毕后,将鼠标放在超链接上,鼠标会变成小手型状。如果你不希望它变化,想让鼠标一直显示箭头的形状则可以将参数(mouse_cursor_change_disabled_)设置为true,不过我个人一般是设置为false。

// client_handler.cpp

ClientHandler::ClientHandler()
  : browser_id_(0),
    is_closing_(false),
    main_handle_(NULL),
    edit_handle_(NULL),
    back_handle_(NULL),
    forward_handle_(NULL),
    stop_handle_(NULL),
    reload_handle_(NULL),
    focus_on_editable_field_(false) {
#if defined(OS_LINUX)
  gtk_dialog_ = NULL;
#endif

  // Read command line settings.
  CefRefPtr<CefCommandLine> command_line =
      CefCommandLine::GetGlobalCommandLine();

  if (command_line->HasSwitch(cefclient::kUrl))
    startup_url_ = command_line->GetSwitchValue(cefclient::kUrl);
  if (startup_url_.empty())
    //startup_url_ = "http://www.google.com/";
    startup_url_ = "http://www.baidu.com/";

  mouse_cursor_change_disabled_ = true;     // 禁止鼠标形状变化
  // mouse_cursor_change_disabled_ = false; // 运行鼠标形状变化。我一般都设置为false,这样鼠标放到带url的文字上会变成手型
}
View Code

 

test:

http://microlink.im/x.html

http://tests/window

http://localhost/test2.php   http://localhost/test2.html

http://localhost/window.html

http://localhost/window-31.html

http://localhost/window-32.html

posted @ 2015-09-09 16:25  hezhixiong  阅读(618)  评论(0编辑  收藏  举报