コード例 #1
0
ファイル: cefclient.cpp プロジェクト: adobe/brackets-shell
// 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;
  }
}
コード例 #2
0
ファイル: app.cpp プロジェクト: ARSrabon/phpdesktop
/*--cef(optional_param=process_type)--*/
void App::OnBeforeCommandLineProcessing(
        const CefString& process_type,
        CefRefPtr<CefCommandLine> command_line) {
    // May be called on any thread?
    if (process_type.empty()) {
        // Browser process.
        json_value* appSettings = GetApplicationSettings();
        json_value switches = (*appSettings)["chrome"]["command_line_switches"];
        if (switches.type == json_object) {
            int length = switches.u.object.length;
            for (int i = 0; i < length; i++) {
                std::string name = switches.u.object.values[i].name;
                std::string value = (*switches.u.object.values[i].value);
                if (name.find("-") == 0) {
                    LOG_WARNING << "Invalid command line switch: " << name;
                    continue;
                }
                if (command_line->HasSwitch(name)) {
                    if (value.empty()) {
                        // Switch already set, do nothing.
                    } else {
                        std::string oldValue = command_line->GetSwitchValue(name);
                        if (oldValue != value) {
                            // Overwrite the switch with a new value.
                            command_line->AppendSwitchWithValue(name, value);
                        }
                    }
                } else {
                    if (value.empty()) {
                        command_line->AppendSwitch(name);
                    } else {
                        command_line->AppendSwitchWithValue(name, value);
                    }
                }
            }
        }
    }
    std::string process_name = "browser";
    if (!process_type.empty()) {
        process_name = process_type;
    }
    LOG_DEBUG << "Command line string for the " << process_name << " process: "
              << command_line->GetCommandLineString().ToString();
}
コード例 #3
0
ファイル: WebBrowserApp.cpp プロジェクト: johndpope/UE4
void FWebBrowserApp::OnBeforeChildProcessLaunch(CefRefPtr<CefCommandLine> CommandLine)
{
    std::string x = CommandLine->GetCommandLineString();
    std::string a = "d"+x;
}