//Replace keyStroke with replaceString bool fixupKey(ExtensionString& key, ExtensionString keyStroke, ExtensionString replaceString) { size_t idx = key.find(keyStroke, 0); if (idx != ExtensionString::npos) { key = key.replace(idx, keyStroke.size(), replaceString); return true; } return false; }
// CefCommandLine::HasSwitch is unable to report the presense of switches, // in the command line properly. This is a generic function that could be // used to check for any particular switch, passed as a command line argument. bool HasSwitch(CefRefPtr<CefCommandLine> command_line , CefString& switch_name) { if (command_line) { ExtensionString cmdLine = command_line->GetCommandLineString(); size_t idx = cmdLine.find(switch_name); return idx > 0 && idx < cmdLine.length(); } else { return false; } }