- 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:
Marshall Greenblatt
2011-11-14 23:43:52 +00:00
parent 0e4c6a648c
commit cc175e4fbe
21 changed files with 1383 additions and 43 deletions

View File

@@ -206,6 +206,9 @@ void CefBrowserCToCpp::GetFrameNames(std::vector<CefString>& names)
return;
cef_string_list_t list = cef_string_list_alloc();
if (!list)
return;
struct_->get_frame_names(struct_, list);
transfer_string_list_contents(list, names);

View 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

View File

@@ -0,0 +1,54 @@
// 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.
//
// -------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef _COMMANDLINE_CTOCPP_H
#define _COMMANDLINE_CTOCPP_H
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef.h"
#include "include/cef_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefCommandLineCToCpp
: public CefCToCpp<CefCommandLineCToCpp, CefCommandLine, cef_command_line_t>
{
public:
CefCommandLineCToCpp(cef_command_line_t* str)
: CefCToCpp<CefCommandLineCToCpp, CefCommandLine, cef_command_line_t>(
str) {}
virtual ~CefCommandLineCToCpp() {}
// CefCommandLine methods
virtual void InitFromArgv(int argc, const char* const* argv) OVERRIDE;
virtual void InitFromString(const CefString& command_line) OVERRIDE;
virtual CefString GetCommandLineString() OVERRIDE;
virtual CefString GetProgram() OVERRIDE;
virtual void SetProgram(const CefString& program) OVERRIDE;
virtual bool HasSwitches() OVERRIDE;
virtual bool HasSwitch(const CefString& name) OVERRIDE;
virtual CefString GetSwitchValue(const CefString& name) OVERRIDE;
virtual void GetSwitches(SwitchMap& switches) OVERRIDE;
virtual void AppendSwitch(const CefString& name) OVERRIDE;
virtual void AppendSwitchWithValue(const CefString& name,
const CefString& value) OVERRIDE;
virtual bool HasArguments() OVERRIDE;
virtual void GetArguments(ArgumentList& arguments) OVERRIDE;
virtual void AppendArgument(const CefString& argument) OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // _COMMANDLINE_CTOCPP_H

View File

@@ -134,6 +134,9 @@ bool CefDragDataCToCpp::GetFileNames(std::vector<CefString>& names)
return false;
cef_string_list_t list = cef_string_list_alloc();
if (!list)
return false;
if(struct_->get_file_names(struct_, list)) {
transfer_string_list_contents(list, names);
cef_string_list_free(list);

View File

@@ -353,6 +353,9 @@ bool CefV8ValueCToCpp::GetKeys(std::vector<CefString>& keys)
return false;
cef_string_list_t list = cef_string_list_alloc();
if (!list)
return false;
if(struct_->get_keys(struct_, list)) {
transfer_string_list_contents(list, keys);
cef_string_list_free(list);