chromium 去掉客户区鼠标右键的检查
因为通过文案搜索,有.h或者test.cc之类的,干脆自己搞个筛选的
#include<unistd.h> #include<stdio.h> #include<string.h> #include<stdlib.h> #include<sys/types.h> #include<dirent.h> #include<sys/stat.h> #include<unistd.h> #include<iostream > #include<fstream> using namespace std; void showUrl(const char* path) { DIR* dirp = opendir(path); struct dirent* de = NULL; //获取文件夹目录属性 struct stat st; //获取文件属性 char targetPath[500]; while(de = readdir(dirp)) { if(strcmp(de->d_name,".")==0 || strcmp(de->d_name,"..")==0) continue; // printf("%s\n",de->d_name); strcpy(targetPath,path); strcat(targetPath,"/"); strcat(targetPath,de->d_name); stat(targetPath,&st); if(S_ISDIR(st.st_mode)) { showUrl(targetPath); }else //不是目录!!!! { int len = strlen(targetPath); if((targetPath[len - 3] == '.') && (targetPath[len - 2] == 'c') && (targetPath[len - 1] == 'c')) { if((targetPath[len - 7] == 't') && (targetPath[len - 6] == 'e') && (targetPath[len - 5] == 's') && (targetPath[len - 4] == 't')); else { ifstream in(targetPath, ios::in); istreambuf_iterator<char> beg(in), end; string strdata(beg, end); in.close(); // if ((strdata.find("AddItem")!=string::npos) || (strdata.find("AddChildView")!=string::npos)){ // printf("%s\n",targetPath) ; // //cout<<strdata<<endl; // } if ((strdata.find("AddSeparator")!=string::npos)){ printf("%s\n",targetPath) ; //cout<<strdata<<endl; } } } } } closedir(dirp); } int main(){ //showUrl("C:/feikua/chromium/src/ui"); showUrl("C:/feikua/chromium/src/chrome/browser"); return 0; }
但是筛选AddItem,AddChildView太多了没法搞...........
也可以在这打断点去找src\ui\views\controls\menu\menu_runner.ccRunMenuAt....我没找到
发现鼠标右键点击后的菜单!每个菜单都有若干个分隔符...
文案搜索分隔符
在:C:\feikua\chromium\src\chrome\browser\renderer_context_menu\render_view_context_menu.cc
注释掉
去掉链接上的新窗口打开,隐身新窗口打开
//if (!in_app) {
// menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW,
// IDS_CONTENT_CONTEXT_OPENLINKNEWWINDOW);
//}
//menu_model_.AddItemWithStringId(
// IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD,
// in_app ? IDS_CONTENT_CONTEXT_OPENLINKOFFTHERECORD_INAPP
// : IDS_CONTENT_CONTEXT_OPENLINKOFFTHERECORD);
去掉鼠标右键的检查
//menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_INSPECTELEMENT,
// IDS_CONTENT_CONTEXT_INSPECTELEMENT);
//这啥???? 感觉不是好东西....
//menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE,
// IDS_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE);
顺带在ExecuteCommand去掉相对应的功能
//case IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW:
// OpenURLWithExtraHeaders(params_.link_url, GetDocumentURL(params_),
// WindowOpenDisposition::NEW_WINDOW,
// ui::PAGE_TRANSITION_LINK, "" /* extra_headers */,
// true /* started_from_context_menu */);
// break;
//case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD:
// OpenURLWithExtraHeaders(params_.link_url, GURL(),
// WindowOpenDisposition::OFF_THE_RECORD,
// ui::PAGE_TRANSITION_LINK, "" /* extra_headers */,
// true /* started_from_context_menu */);
// break;
//case IDC_CONTENT_CONTEXT_INSPECTELEMENT:
// ExecInspectElement();
// break;
//case IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE:
// ExecInspectBackgroundPage();
// break;