mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Expose command line parsing support with a new CefCommandLine class (issue #422).
- cefclient: Add the ability to specify CefSettings and CefBrowserSettings values on the command line. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@378 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
172
libcef_dll/ctocpp/command_line_ctocpp.cc
Normal file
172
libcef_dll/ctocpp/command_line_ctocpp.cc
Normal file
@@ -0,0 +1,172 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// A portion of this file was generated by the CEF translator tool. When
|
||||
// making changes by hand only do so within the body of existing static and
|
||||
// virtual method implementations. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/command_line_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
|
||||
// STATIC METHODS - Body may be edited by hand.
|
||||
|
||||
CefRefPtr<CefCommandLine> CefCommandLine::CreateCommandLine()
|
||||
{
|
||||
cef_command_line_t* impl = cef_command_line_create();
|
||||
if(impl)
|
||||
return CefCommandLineCToCpp::Wrap(impl);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
void CefCommandLineCToCpp::InitFromArgv(int argc, const char* const* argv)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, init_from_argv))
|
||||
return;
|
||||
|
||||
struct_->init_from_argv(struct_, argc, argv);
|
||||
}
|
||||
|
||||
void CefCommandLineCToCpp::InitFromString(const CefString& command_line)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, init_from_string))
|
||||
return;
|
||||
|
||||
struct_->init_from_string(struct_, command_line.GetStruct());
|
||||
}
|
||||
|
||||
CefString CefCommandLineCToCpp::GetCommandLineString()
|
||||
{
|
||||
CefString str;
|
||||
if (CEF_MEMBER_MISSING(struct_, get_command_line_string))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_command_line_string(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
CefString CefCommandLineCToCpp::GetProgram()
|
||||
{
|
||||
CefString str;
|
||||
if (CEF_MEMBER_MISSING(struct_, get_program))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_program(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
void CefCommandLineCToCpp::SetProgram(const CefString& program)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, set_program))
|
||||
return;
|
||||
|
||||
struct_->set_program(struct_, program.GetStruct());
|
||||
}
|
||||
|
||||
bool CefCommandLineCToCpp::HasSwitches()
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, has_switches))
|
||||
return false;
|
||||
|
||||
return struct_->has_switches(struct_)?true:false;
|
||||
}
|
||||
|
||||
bool CefCommandLineCToCpp::HasSwitch(const CefString& name)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, has_switch))
|
||||
return false;
|
||||
|
||||
return struct_->has_switch(struct_, name.GetStruct())?true:false;
|
||||
}
|
||||
|
||||
CefString CefCommandLineCToCpp::GetSwitchValue(const CefString& name)
|
||||
{
|
||||
CefString str;
|
||||
if (CEF_MEMBER_MISSING(struct_, get_switch_value))
|
||||
return str;
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_switch_value(struct_,
|
||||
name.GetStruct());
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
void CefCommandLineCToCpp::GetSwitches(SwitchMap& switches)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, get_switches))
|
||||
return;
|
||||
|
||||
cef_string_map_t map = cef_string_map_alloc();
|
||||
if(!map)
|
||||
return;
|
||||
|
||||
struct_->get_switches(struct_, map);
|
||||
transfer_string_map_contents(map, switches);
|
||||
cef_string_map_free(map);
|
||||
}
|
||||
|
||||
void CefCommandLineCToCpp::AppendSwitch(const CefString& name)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, append_switch))
|
||||
return;
|
||||
|
||||
struct_->append_switch(struct_, name.GetStruct());
|
||||
}
|
||||
|
||||
void CefCommandLineCToCpp::AppendSwitchWithValue(const CefString& name,
|
||||
const CefString& value)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, append_switch_with_value))
|
||||
return;
|
||||
|
||||
struct_->append_switch_with_value(struct_, name.GetStruct(),
|
||||
value.GetStruct());
|
||||
}
|
||||
|
||||
bool CefCommandLineCToCpp::HasArguments()
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, has_arguments))
|
||||
return false;
|
||||
|
||||
return struct_->has_arguments(struct_)?true:false;
|
||||
}
|
||||
|
||||
void CefCommandLineCToCpp::GetArguments(ArgumentList& arguments)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, get_arguments))
|
||||
return;
|
||||
|
||||
cef_string_list_t list = cef_string_list_alloc();
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
struct_->get_arguments(struct_, list);
|
||||
|
||||
transfer_string_list_contents(list, arguments);
|
||||
cef_string_list_free(list);
|
||||
}
|
||||
|
||||
void CefCommandLineCToCpp::AppendArgument(const CefString& argument)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, append_argument))
|
||||
return;
|
||||
|
||||
struct_->append_argument(struct_, argument.GetStruct());
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefCommandLineCToCpp, CefCommandLine,
|
||||
cef_command_line_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user