mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Apply clang-format to all C, C++ and ObjC files (issue #2171)
This commit is contained in:
@@ -6,12 +6,13 @@
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
|
||||
#include <shellscalingapi.h>
|
||||
#endif
|
||||
|
||||
#include "include/internal/cef_trace_event_internal.h"
|
||||
#include "include/internal/cef_logging_internal.h"
|
||||
#include "include/internal/cef_thread_internal.h"
|
||||
#include "include/internal/cef_trace_event_internal.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
@@ -26,11 +27,10 @@ namespace {
|
||||
|
||||
// Win8.1 supports monitor-specific DPI scaling.
|
||||
bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) {
|
||||
typedef HRESULT(WINAPI *SetProcessDpiAwarenessPtr)(PROCESS_DPI_AWARENESS);
|
||||
typedef HRESULT(WINAPI * SetProcessDpiAwarenessPtr)(PROCESS_DPI_AWARENESS);
|
||||
SetProcessDpiAwarenessPtr set_process_dpi_awareness_func =
|
||||
reinterpret_cast<SetProcessDpiAwarenessPtr>(
|
||||
GetProcAddress(GetModuleHandleA("user32.dll"),
|
||||
"SetProcessDpiAwarenessInternal"));
|
||||
reinterpret_cast<SetProcessDpiAwarenessPtr>(GetProcAddress(
|
||||
GetModuleHandleA("user32.dll"), "SetProcessDpiAwarenessInternal"));
|
||||
if (set_process_dpi_awareness_func) {
|
||||
HRESULT hr = set_process_dpi_awareness_func(value);
|
||||
if (SUCCEEDED(hr)) {
|
||||
@@ -38,7 +38,7 @@ bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) {
|
||||
return true;
|
||||
} else if (hr == E_ACCESSDENIED) {
|
||||
LOG(ERROR) << "Access denied error from SetProcessDpiAwareness. "
|
||||
"Function called twice, or manifest was used.";
|
||||
"Function called twice, or manifest was used.";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -47,13 +47,11 @@ bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) {
|
||||
// This function works for Windows Vista through Win8. Win8.1 must use
|
||||
// SetProcessDpiAwareness[Wrapper].
|
||||
BOOL SetProcessDPIAwareWrapper() {
|
||||
typedef BOOL(WINAPI *SetProcessDPIAwarePtr)(VOID);
|
||||
typedef BOOL(WINAPI * SetProcessDPIAwarePtr)(VOID);
|
||||
SetProcessDPIAwarePtr set_process_dpi_aware_func =
|
||||
reinterpret_cast<SetProcessDPIAwarePtr>(
|
||||
GetProcAddress(GetModuleHandleA("user32.dll"),
|
||||
"SetProcessDPIAware"));
|
||||
return set_process_dpi_aware_func &&
|
||||
set_process_dpi_aware_func();
|
||||
GetProcAddress(GetModuleHandleA("user32.dll"), "SetProcessDPIAware"));
|
||||
return set_process_dpi_aware_func && set_process_dpi_aware_func();
|
||||
}
|
||||
|
||||
void EnableHighDPISupport() {
|
||||
@@ -79,7 +77,6 @@ void base_impl_stub() {}
|
||||
#pragma optimize("", on)
|
||||
#endif
|
||||
|
||||
|
||||
CEF_EXPORT void cef_trace_event_instant(const char* category,
|
||||
const char* name,
|
||||
const char* arg1_name,
|
||||
@@ -106,11 +103,11 @@ CEF_EXPORT void cef_trace_event_instant(const char* category,
|
||||
if (arg1_name == NULL && arg2_name == NULL) {
|
||||
TRACE_EVENT_INSTANT0(category, name, TRACE_EVENT_SCOPE_THREAD);
|
||||
} else if (arg2_name == NULL) {
|
||||
TRACE_EVENT_INSTANT1(category, name, TRACE_EVENT_SCOPE_THREAD,
|
||||
arg1_name, arg1_val);
|
||||
TRACE_EVENT_INSTANT1(category, name, TRACE_EVENT_SCOPE_THREAD, arg1_name,
|
||||
arg1_val);
|
||||
} else {
|
||||
TRACE_EVENT_INSTANT2(category, name, TRACE_EVENT_SCOPE_THREAD,
|
||||
arg1_name, arg1_val, arg2_name, arg2_val);
|
||||
TRACE_EVENT_INSTANT2(category, name, TRACE_EVENT_SCOPE_THREAD, arg1_name,
|
||||
arg1_val, arg2_name, arg2_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,8 +130,8 @@ CEF_EXPORT void cef_trace_event_begin(const char* category,
|
||||
} else if (arg2_name == NULL) {
|
||||
TRACE_EVENT_COPY_BEGIN1(category, name, arg1_name, arg1_val);
|
||||
} else {
|
||||
TRACE_EVENT_COPY_BEGIN2(category, name, arg1_name, arg1_val,
|
||||
arg2_name, arg2_val);
|
||||
TRACE_EVENT_COPY_BEGIN2(category, name, arg1_name, arg1_val, arg2_name,
|
||||
arg2_val);
|
||||
}
|
||||
} else {
|
||||
if (arg1_name == NULL && arg2_name == NULL) {
|
||||
@@ -142,8 +139,8 @@ CEF_EXPORT void cef_trace_event_begin(const char* category,
|
||||
} else if (arg2_name == NULL) {
|
||||
TRACE_EVENT_BEGIN1(category, name, arg1_name, arg1_val);
|
||||
} else {
|
||||
TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val,
|
||||
arg2_name, arg2_val);
|
||||
TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val, arg2_name,
|
||||
arg2_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,8 +163,8 @@ CEF_EXPORT void cef_trace_event_end(const char* category,
|
||||
} else if (arg2_name == NULL) {
|
||||
TRACE_EVENT_COPY_END1(category, name, arg1_name, arg1_val);
|
||||
} else {
|
||||
TRACE_EVENT_COPY_END2(category, name, arg1_name, arg1_val,
|
||||
arg2_name, arg2_val);
|
||||
TRACE_EVENT_COPY_END2(category, name, arg1_name, arg1_val, arg2_name,
|
||||
arg2_val);
|
||||
}
|
||||
} else {
|
||||
if (arg1_name == NULL && arg2_name == NULL) {
|
||||
@@ -175,8 +172,8 @@ CEF_EXPORT void cef_trace_event_end(const char* category,
|
||||
} else if (arg2_name == NULL) {
|
||||
TRACE_EVENT_END1(category, name, arg1_name, arg1_val);
|
||||
} else {
|
||||
TRACE_EVENT_END2(category, name, arg1_name, arg1_val,
|
||||
arg2_name, arg2_val);
|
||||
TRACE_EVENT_END2(category, name, arg1_name, arg1_val, arg2_name,
|
||||
arg2_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,15 +194,15 @@ CEF_EXPORT void cef_trace_counter(const char* category,
|
||||
if (value1_name == NULL && value2_name == NULL) {
|
||||
TRACE_COPY_COUNTER1(category, name, value1_val);
|
||||
} else {
|
||||
TRACE_COPY_COUNTER2(category, name, value1_name, value1_val,
|
||||
value2_name, value2_val);
|
||||
TRACE_COPY_COUNTER2(category, name, value1_name, value1_val, value2_name,
|
||||
value2_val);
|
||||
}
|
||||
} else {
|
||||
if (value1_name == NULL && value2_name == NULL) {
|
||||
TRACE_COUNTER1(category, name, value1_val);
|
||||
} else {
|
||||
TRACE_COUNTER2(category, name, value1_name, value1_val,
|
||||
value2_name, value2_val);
|
||||
TRACE_COUNTER2(category, name, value1_name, value1_val, value2_name,
|
||||
value2_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,8 +224,8 @@ CEF_EXPORT void cef_trace_counter_id(const char* category,
|
||||
if (value1_name == NULL && value2_name == NULL) {
|
||||
TRACE_COPY_COUNTER_ID1(category, name, id, value1_val);
|
||||
} else {
|
||||
TRACE_COPY_COUNTER_ID2(category, name, id, value1_name,
|
||||
value1_val, value2_name, value2_val);
|
||||
TRACE_COPY_COUNTER_ID2(category, name, id, value1_name, value1_val,
|
||||
value2_name, value2_val);
|
||||
}
|
||||
} else {
|
||||
if (value1_name == NULL && value2_name == NULL) {
|
||||
@@ -289,18 +286,19 @@ CEF_EXPORT void cef_trace_event_async_step_into(const char* category,
|
||||
if (copy) {
|
||||
if (arg1_name == NULL) {
|
||||
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_INTO,
|
||||
category, name, id, TRACE_EVENT_FLAG_COPY, "step", step);
|
||||
category, name, id,
|
||||
TRACE_EVENT_FLAG_COPY, "step", step);
|
||||
} else {
|
||||
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_INTO,
|
||||
category, name, id, TRACE_EVENT_FLAG_COPY, "step", step,
|
||||
arg1_name, arg1_val);
|
||||
INTERNAL_TRACE_EVENT_ADD_WITH_ID(
|
||||
TRACE_EVENT_PHASE_ASYNC_STEP_INTO, category, name, id,
|
||||
TRACE_EVENT_FLAG_COPY, "step", step, arg1_name, arg1_val);
|
||||
}
|
||||
} else {
|
||||
if (arg1_name == NULL) {
|
||||
TRACE_EVENT_ASYNC_STEP_INTO0(category, name, id, step);
|
||||
} else {
|
||||
TRACE_EVENT_ASYNC_STEP_INTO1(category, name, id, step,
|
||||
arg1_name, arg1_val);
|
||||
TRACE_EVENT_ASYNC_STEP_INTO1(category, name, id, step, arg1_name,
|
||||
arg1_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -320,18 +318,19 @@ CEF_EXPORT void cef_trace_event_async_step_past(const char* category,
|
||||
if (copy) {
|
||||
if (arg1_name == NULL) {
|
||||
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_PAST,
|
||||
category, name, id, TRACE_EVENT_FLAG_COPY, "step", step);
|
||||
category, name, id,
|
||||
TRACE_EVENT_FLAG_COPY, "step", step);
|
||||
} else {
|
||||
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_PAST,
|
||||
category, name, id, TRACE_EVENT_FLAG_COPY, "step", step,
|
||||
arg1_name, arg1_val);
|
||||
INTERNAL_TRACE_EVENT_ADD_WITH_ID(
|
||||
TRACE_EVENT_PHASE_ASYNC_STEP_PAST, category, name, id,
|
||||
TRACE_EVENT_FLAG_COPY, "step", step, arg1_name, arg1_val);
|
||||
}
|
||||
} else {
|
||||
if (arg1_name == NULL) {
|
||||
TRACE_EVENT_ASYNC_STEP_PAST0(category, name, id, step);
|
||||
} else {
|
||||
TRACE_EVENT_ASYNC_STEP_PAST1(category, name, id, step,
|
||||
arg1_name, arg1_val);
|
||||
TRACE_EVENT_ASYNC_STEP_PAST1(category, name, id, step, arg1_name,
|
||||
arg1_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,21 +352,19 @@ CEF_EXPORT void cef_trace_event_async_end(const char* category,
|
||||
if (arg1_name == NULL && arg2_name == NULL) {
|
||||
TRACE_EVENT_COPY_ASYNC_END0(category, name, id);
|
||||
} else if (arg2_name == NULL) {
|
||||
TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name,
|
||||
arg1_val);
|
||||
TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name, arg1_val);
|
||||
} else {
|
||||
TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name,
|
||||
arg1_val, arg2_name, arg2_val);
|
||||
TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name, arg1_val,
|
||||
arg2_name, arg2_val);
|
||||
}
|
||||
} else {
|
||||
if (arg1_name == NULL && arg2_name == NULL) {
|
||||
TRACE_EVENT_ASYNC_END0(category, name, id);
|
||||
} else if (arg2_name == NULL) {
|
||||
TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name,
|
||||
arg1_val);
|
||||
TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name, arg1_val);
|
||||
} else {
|
||||
TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name,
|
||||
arg1_val, arg2_name, arg2_val);
|
||||
TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name, arg1_val, arg2_name,
|
||||
arg2_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -392,7 +389,7 @@ CEF_EXPORT cef_platform_thread_id_t cef_get_current_platform_thread_id() {
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_platform_thread_handle_t
|
||||
cef_get_current_platform_thread_handle() {
|
||||
cef_get_current_platform_thread_handle() {
|
||||
#if defined(OS_WIN)
|
||||
return base::PlatformThread::CurrentId();
|
||||
#else
|
||||
|
@@ -17,13 +17,9 @@ class CallRecordUploadAttempt {
|
||||
public:
|
||||
CallRecordUploadAttempt(CrashReportDatabase* database,
|
||||
const CrashReportDatabase::Report* report)
|
||||
: database_(database),
|
||||
report_(report) {
|
||||
}
|
||||
: database_(database), report_(report) {}
|
||||
|
||||
~CallRecordUploadAttempt() {
|
||||
Fire();
|
||||
}
|
||||
~CallRecordUploadAttempt() { Fire(); }
|
||||
|
||||
void Fire() {
|
||||
if (report_) {
|
||||
@@ -33,12 +29,10 @@ class CallRecordUploadAttempt {
|
||||
Disarm();
|
||||
}
|
||||
|
||||
void Disarm() {
|
||||
report_ = nullptr;
|
||||
}
|
||||
void Disarm() { report_ = nullptr; }
|
||||
|
||||
private:
|
||||
CrashReportDatabase* database_; // weak
|
||||
CrashReportDatabase* database_; // weak
|
||||
const CrashReportDatabase::Report* report_; // weak
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CallRecordUploadAttempt);
|
||||
@@ -53,11 +47,9 @@ CefCrashReportUploadThread::CefCrashReportUploadThread(
|
||||
bool upload_gzip,
|
||||
int max_uploads)
|
||||
: CrashReportUploadThread(database, url, rate_limit, upload_gzip),
|
||||
max_uploads_(max_uploads) {
|
||||
}
|
||||
max_uploads_(max_uploads) {}
|
||||
|
||||
CefCrashReportUploadThread::~CefCrashReportUploadThread() {
|
||||
}
|
||||
CefCrashReportUploadThread::~CefCrashReportUploadThread() {}
|
||||
|
||||
void CefCrashReportUploadThread::ProcessPendingReports() {
|
||||
if (BackoffPending()) {
|
||||
@@ -69,7 +61,7 @@ void CefCrashReportUploadThread::ProcessPendingReports() {
|
||||
// Retrieve all completed reports.
|
||||
std::vector<CrashReportDatabase::Report> reports;
|
||||
if (database_->GetCompletedReports(&reports) !=
|
||||
CrashReportDatabase::kNoError) {
|
||||
CrashReportDatabase::kNoError) {
|
||||
// The database is sick. It might be prudent to stop trying to poke it
|
||||
// from this thread by abandoning the thread altogether. On the other
|
||||
// hand, if the problem is transient, it might be possible to talk to it
|
||||
@@ -171,8 +163,8 @@ void CefCrashReportUploadThread::ProcessPendingReport(
|
||||
bool CefCrashReportUploadThread::UploadsEnabled() const {
|
||||
Settings* const settings = database_->GetSettings();
|
||||
bool uploads_enabled;
|
||||
return !url_.empty() &&
|
||||
settings->GetUploadsEnabled(&uploads_enabled) && uploads_enabled;
|
||||
return !url_.empty() && settings->GetUploadsEnabled(&uploads_enabled) &&
|
||||
uploads_enabled;
|
||||
}
|
||||
|
||||
bool CefCrashReportUploadThread::MaxUploadsEnabled() const {
|
||||
@@ -206,12 +198,12 @@ void CefCrashReportUploadThread::IncreaseBackoff() {
|
||||
|
||||
const int kHour = 60 * 60; // 1 hour
|
||||
const int kBackoffSchedule[] = {
|
||||
kHour / 4, // 15 minutes
|
||||
kHour, // 1 hour
|
||||
kHour * 2, // 2 hours
|
||||
kHour * 4, // 4 hours
|
||||
kHour * 8, // 8 hours
|
||||
kHour * 24, // 24 hours
|
||||
kHour / 4, // 15 minutes
|
||||
kHour, // 1 hour
|
||||
kHour * 2, // 2 hours
|
||||
kHour * 4, // 4 hours
|
||||
kHour * 8, // 8 hours
|
||||
kHour * 24, // 24 hours
|
||||
};
|
||||
const int kBackoffScheduleSize =
|
||||
sizeof(kBackoffSchedule) / sizeof(kBackoffSchedule[0]);
|
||||
|
@@ -19,7 +19,7 @@ class CefCrashReportUploadThread : public crashpad::CrashReportUploadThread {
|
||||
private:
|
||||
void ProcessPendingReports() override;
|
||||
void ProcessPendingReport(
|
||||
const crashpad::CrashReportDatabase::Report& report) override;
|
||||
const crashpad::CrashReportDatabase::Report& report) override;
|
||||
|
||||
bool UploadsEnabled() const;
|
||||
|
||||
|
@@ -7,32 +7,32 @@
|
||||
#include "libcef/common/cef_message_generator.h"
|
||||
|
||||
// Generate constructors.
|
||||
#include "ipc/struct_constructor_macros.h"
|
||||
#include "chrome/common/safe_browsing/ipc_protobuf_message_null_macros.h"
|
||||
#include "ipc/struct_constructor_macros.h"
|
||||
#include "libcef/common/cef_message_generator.h"
|
||||
|
||||
// Generate destructors.
|
||||
#include "ipc/struct_destructor_macros.h"
|
||||
#include "chrome/common/safe_browsing/ipc_protobuf_message_null_macros.h"
|
||||
#include "ipc/struct_destructor_macros.h"
|
||||
#include "libcef/common/cef_message_generator.h"
|
||||
|
||||
// Generate param traits write methods.
|
||||
#include "ipc/param_traits_write_macros.h"
|
||||
#include "chrome/common/safe_browsing/protobuf_message_write_macros.h"
|
||||
#include "ipc/param_traits_write_macros.h"
|
||||
namespace IPC {
|
||||
#include "libcef/common/cef_message_generator.h"
|
||||
} // namespace IPC
|
||||
|
||||
// Generate param traits read methods.
|
||||
#include "ipc/param_traits_read_macros.h"
|
||||
#include "chrome/common/safe_browsing/protobuf_message_read_macros.h"
|
||||
#include "ipc/param_traits_read_macros.h"
|
||||
namespace IPC {
|
||||
#include "libcef/common/cef_message_generator.h"
|
||||
} // namespace IPC
|
||||
|
||||
// Generate param traits log methods.
|
||||
#include "ipc/param_traits_log_macros.h"
|
||||
#include "chrome/common/safe_browsing/protobuf_message_log_macros.h"
|
||||
#include "ipc/param_traits_log_macros.h"
|
||||
namespace IPC {
|
||||
#include "libcef/common/cef_message_generator.h"
|
||||
} // namespace IPC
|
||||
|
@@ -71,8 +71,8 @@ struct ParamTraits<net::UploadElement> {
|
||||
}
|
||||
};
|
||||
|
||||
void ParamTraits<scoped_refptr<net::UploadData> >::Write(base::Pickle* m,
|
||||
const param_type& p) {
|
||||
void ParamTraits<scoped_refptr<net::UploadData>>::Write(base::Pickle* m,
|
||||
const param_type& p) {
|
||||
WriteParam(m, p.get() != NULL);
|
||||
if (p.get()) {
|
||||
WriteParam(m, p->elements());
|
||||
@@ -82,7 +82,7 @@ void ParamTraits<scoped_refptr<net::UploadData> >::Write(base::Pickle* m,
|
||||
}
|
||||
}
|
||||
|
||||
bool ParamTraits<scoped_refptr<net::UploadData> >::Read(
|
||||
bool ParamTraits<scoped_refptr<net::UploadData>>::Read(
|
||||
const base::Pickle* m,
|
||||
base::PickleIterator* iter,
|
||||
param_type* r) {
|
||||
@@ -111,8 +111,8 @@ bool ParamTraits<scoped_refptr<net::UploadData> >::Read(
|
||||
return true;
|
||||
}
|
||||
|
||||
void ParamTraits<scoped_refptr<net::UploadData> >::Log(const param_type& p,
|
||||
std::string* l) {
|
||||
void ParamTraits<scoped_refptr<net::UploadData>>::Log(const param_type& p,
|
||||
std::string* l) {
|
||||
l->append("<net::UploadData>");
|
||||
}
|
||||
|
||||
|
@@ -14,8 +14,8 @@
|
||||
#include "base/values.h"
|
||||
#include "content/public/common/common_param_traits.h"
|
||||
#include "content/public/common/referrer.h"
|
||||
#include "ui/gfx/ipc/gfx_param_traits.h"
|
||||
#include "ipc/ipc_message_macros.h"
|
||||
#include "ui/gfx/ipc/gfx_param_traits.h"
|
||||
|
||||
// Singly-included section for enums and custom IPC traits.
|
||||
#ifndef CEF_LIBCEF_COMMON_CEF_MESSAGES_H_
|
||||
@@ -39,10 +39,11 @@ namespace IPC {
|
||||
|
||||
// Extracted from chrome/common/automation_messages.h.
|
||||
template <>
|
||||
struct ParamTraits<scoped_refptr<net::UploadData> > {
|
||||
struct ParamTraits<scoped_refptr<net::UploadData>> {
|
||||
typedef scoped_refptr<net::UploadData> param_type;
|
||||
static void Write(base::Pickle* m, const param_type& p);
|
||||
static bool Read(const base::Pickle* m, base::PickleIterator* iter,
|
||||
static bool Read(const base::Pickle* m,
|
||||
base::PickleIterator* iter,
|
||||
param_type* r);
|
||||
static void Log(const param_type& p, std::string* l);
|
||||
};
|
||||
@@ -51,7 +52,6 @@ struct ParamTraits<scoped_refptr<net::UploadData> > {
|
||||
|
||||
#endif // CEF_LIBCEF_COMMON_CEF_MESSAGES_H_
|
||||
|
||||
|
||||
// TODO(cef): Re-using the message start for extensions may be problematic in
|
||||
// the future. It would be better if ipc_message_utils.h contained a value
|
||||
// reserved for consumers of the content API.
|
||||
@@ -110,7 +110,6 @@ IPC_STRUCT_BEGIN(Cef_DraggableRegion_Params)
|
||||
IPC_STRUCT_MEMBER(bool, draggable)
|
||||
IPC_STRUCT_END()
|
||||
|
||||
|
||||
// Messages sent from the browser to the renderer.
|
||||
|
||||
// Parameters for a resource request.
|
||||
@@ -149,27 +148,22 @@ IPC_STRUCT_BEGIN(CefMsg_LoadRequest_Params)
|
||||
IPC_STRUCT_END()
|
||||
|
||||
// Tell the renderer to load a request.
|
||||
IPC_MESSAGE_ROUTED1(CefMsg_LoadRequest,
|
||||
CefMsg_LoadRequest_Params)
|
||||
IPC_MESSAGE_ROUTED1(CefMsg_LoadRequest, CefMsg_LoadRequest_Params)
|
||||
|
||||
// Sent when the browser has a request for the renderer. The renderer may
|
||||
// respond with a CefHostMsg_Response.
|
||||
IPC_MESSAGE_ROUTED1(CefMsg_Request,
|
||||
Cef_Request_Params)
|
||||
IPC_MESSAGE_ROUTED1(CefMsg_Request, Cef_Request_Params)
|
||||
|
||||
// Optional message sent in response to a CefHostMsg_Request.
|
||||
IPC_MESSAGE_ROUTED1(CefMsg_Response,
|
||||
Cef_Response_Params)
|
||||
IPC_MESSAGE_ROUTED1(CefMsg_Response, Cef_Response_Params)
|
||||
|
||||
// Optional Ack message sent to the browser to notify that a CefHostMsg_Response
|
||||
// has been processed.
|
||||
IPC_MESSAGE_ROUTED1(CefMsg_ResponseAck,
|
||||
int /* request_id */)
|
||||
IPC_MESSAGE_ROUTED1(CefMsg_ResponseAck, int /* request_id */)
|
||||
|
||||
// Tells the render frame to load all blocked plugins with the given identifier.
|
||||
// Based on ChromeViewMsg_LoadBlockedPlugins.
|
||||
IPC_MESSAGE_ROUTED1(CefViewMsg_LoadBlockedPlugins,
|
||||
std::string /* identifier */)
|
||||
IPC_MESSAGE_ROUTED1(CefViewMsg_LoadBlockedPlugins, std::string /* identifier */)
|
||||
|
||||
// Sent on process startup to indicate whether this process is running in
|
||||
// incognito mode. Based on ChromeViewMsg_SetIsIncognitoProcess.
|
||||
@@ -184,7 +178,6 @@ IPC_MESSAGE_CONTROL2(CefProcessMsg_ModifyCrossOriginWhitelistEntry,
|
||||
// Sent to child processes to clear the cross-origin whitelist.
|
||||
IPC_MESSAGE_CONTROL0(CefProcessMsg_ClearCrossOriginWhitelist)
|
||||
|
||||
|
||||
// Messages sent from the renderer to the browser.
|
||||
|
||||
// Parameters for a newly created render thread.
|
||||
@@ -268,17 +261,14 @@ IPC_MESSAGE_ROUTED4(CefHostMsg_DidFinishLoad,
|
||||
|
||||
// Sent when the renderer has a request for the browser. The browser may respond
|
||||
// with a CefMsg_Response.
|
||||
IPC_MESSAGE_ROUTED1(CefHostMsg_Request,
|
||||
Cef_Request_Params)
|
||||
IPC_MESSAGE_ROUTED1(CefHostMsg_Request, Cef_Request_Params)
|
||||
|
||||
// Optional message sent in response to a CefMsg_Request.
|
||||
IPC_MESSAGE_ROUTED1(CefHostMsg_Response,
|
||||
Cef_Response_Params)
|
||||
IPC_MESSAGE_ROUTED1(CefHostMsg_Response, Cef_Response_Params)
|
||||
|
||||
// Optional Ack message sent to the browser to notify that a CefMsg_Response
|
||||
// has been processed.
|
||||
IPC_MESSAGE_ROUTED1(CefHostMsg_ResponseAck,
|
||||
int /* request_id */)
|
||||
IPC_MESSAGE_ROUTED1(CefHostMsg_ResponseAck, int /* request_id */)
|
||||
|
||||
// Sent by the renderer when the draggable regions are updated.
|
||||
IPC_MESSAGE_ROUTED1(CefHostMsg_UpdateDraggableRegions,
|
||||
|
@@ -7,34 +7,33 @@
|
||||
namespace switches {
|
||||
|
||||
// Log file path.
|
||||
const char kLogFile[] = "log-file";
|
||||
const char kLogFile[] = "log-file";
|
||||
|
||||
// Severity of messages to log.
|
||||
const char kLogSeverity[] = "log-severity";
|
||||
const char kLogSeverity_Verbose[] = "verbose";
|
||||
const char kLogSeverity_Info[] = "info";
|
||||
const char kLogSeverity_Warning[] = "warning";
|
||||
const char kLogSeverity_Error[] = "error";
|
||||
const char kLogSeverity_Disable[] = "disable";
|
||||
const char kLogSeverity[] = "log-severity";
|
||||
const char kLogSeverity_Verbose[] = "verbose";
|
||||
const char kLogSeverity_Info[] = "info";
|
||||
const char kLogSeverity_Warning[] = "warning";
|
||||
const char kLogSeverity_Error[] = "error";
|
||||
const char kLogSeverity_Disable[] = "disable";
|
||||
|
||||
// Path to resources directory.
|
||||
const char kResourcesDirPath[] = "resources-dir-path";
|
||||
const char kResourcesDirPath[] = "resources-dir-path";
|
||||
|
||||
// Path to locales directory.
|
||||
const char kLocalesDirPath[] = "locales-dir-path";
|
||||
const char kLocalesDirPath[] = "locales-dir-path";
|
||||
|
||||
// Path to locales directory.
|
||||
const char kDisablePackLoading[] = "disable-pack-loading";
|
||||
const char kDisablePackLoading[] = "disable-pack-loading";
|
||||
|
||||
// Stack size for uncaught exceptions.
|
||||
const char kUncaughtExceptionStackSize[] = "uncaught-exception-stack-size";
|
||||
const char kUncaughtExceptionStackSize[] = "uncaught-exception-stack-size";
|
||||
|
||||
// Default encoding.
|
||||
const char kDefaultEncoding[] = "default-encoding";
|
||||
const char kDefaultEncoding[] = "default-encoding";
|
||||
|
||||
// Disable opening of windows via JavaScript.
|
||||
const char kDisableJavascriptOpenWindows[] =
|
||||
"disable-javascript-open-windows";
|
||||
const char kDisableJavascriptOpenWindows[] = "disable-javascript-open-windows";
|
||||
|
||||
// Disable closing of windows via JavaScript.
|
||||
const char kDisableJavascriptCloseWindows[] =
|
||||
@@ -45,7 +44,7 @@ const char kDisableJavascriptAccessClipboard[] =
|
||||
"disable-javascript-access-clipboard";
|
||||
|
||||
// Disable DOM paste via JavaScript execCommand("paste").
|
||||
const char kDisableJavascriptDomPaste[] = "disable-javascript-dom-paste";
|
||||
const char kDisableJavascriptDomPaste[] = "disable-javascript-dom-paste";
|
||||
|
||||
// Allow universal access from file URLs.
|
||||
const char kAllowUniversalAccessFromFileUrls[] =
|
||||
@@ -53,72 +52,72 @@ const char kAllowUniversalAccessFromFileUrls[] =
|
||||
|
||||
// Disable loading of images from the network. A cached image will still be
|
||||
// rendered if requested.
|
||||
const char kDisableImageLoading[] = "disable-image-loading";
|
||||
const char kDisableImageLoading[] = "disable-image-loading";
|
||||
|
||||
// Shrink stand-alone images to fit.
|
||||
const char kImageShrinkStandaloneToFit[] = "image-shrink-standalone-to-fit";
|
||||
const char kImageShrinkStandaloneToFit[] = "image-shrink-standalone-to-fit";
|
||||
|
||||
// Disable resizing of text areas.
|
||||
const char kDisableTextAreaResize[] = "disable-text-area-resize";
|
||||
const char kDisableTextAreaResize[] = "disable-text-area-resize";
|
||||
|
||||
// Disable using the tab key to advance focus to links.
|
||||
const char kDisableTabToLinks[] = "disable-tab-to-links";
|
||||
const char kDisableTabToLinks[] = "disable-tab-to-links";
|
||||
|
||||
// Persist session cookies.
|
||||
const char kPersistSessionCookies[] = "persist-session-cookies";
|
||||
const char kPersistSessionCookies[] = "persist-session-cookies";
|
||||
|
||||
// Persist user preferences.
|
||||
const char kPersistUserPreferences[] = "persist-user-preferences";
|
||||
const char kPersistUserPreferences[] = "persist-user-preferences";
|
||||
|
||||
// Enable media (WebRTC audio/video) streaming.
|
||||
const char kEnableMediaStream[] = "enable-media-stream";
|
||||
const char kEnableMediaStream[] = "enable-media-stream";
|
||||
|
||||
// Enable speech input (x-webkit-speech).
|
||||
const char kEnableSpeechInput[] = "enable-speech-input";
|
||||
const char kEnableSpeechInput[] = "enable-speech-input";
|
||||
|
||||
// Enable the speech input profanity filter.
|
||||
const char kEnableProfanityFilter[] = "enable-profanity-filter";
|
||||
const char kEnableProfanityFilter[] = "enable-profanity-filter";
|
||||
|
||||
// Disable spell checking.
|
||||
const char kDisableSpellChecking[] = "disable-spell-checking";
|
||||
const char kDisableSpellChecking[] = "disable-spell-checking";
|
||||
|
||||
// Enable the remote spelling service.
|
||||
const char kEnableSpellingService[] = "enable-spelling-service";
|
||||
const char kEnableSpellingService[] = "enable-spelling-service";
|
||||
|
||||
// Override the default spellchecking language which comes from locales.pak.
|
||||
const char kOverrideSpellCheckLang[] = "override-spell-check-lang";
|
||||
const char kOverrideSpellCheckLang[] = "override-spell-check-lang";
|
||||
|
||||
// Enable detection and use of a system-wide Pepper Flash install.
|
||||
const char kEnableSystemFlash[] = "enable-system-flash";
|
||||
const char kEnableSystemFlash[] = "enable-system-flash";
|
||||
|
||||
// Disable scroll bounce (rubber-banding) on OS X Lion and newer.
|
||||
const char kDisableScrollBounce[] = "disable-scroll-bounce";
|
||||
const char kDisableScrollBounce[] = "disable-scroll-bounce";
|
||||
|
||||
// Disable the PDF extension.
|
||||
const char kDisablePdfExtension[] = "disable-pdf-extension";
|
||||
const char kDisablePdfExtension[] = "disable-pdf-extension";
|
||||
|
||||
// Path to Widevine CDM binaries.
|
||||
const char kWidevineCdmPath[] = "widevine-cdm-path";
|
||||
const char kWidevineCdmPath[] = "widevine-cdm-path";
|
||||
|
||||
// Default plugin policy action.
|
||||
const char kPluginPolicy[] = "plugin-policy";
|
||||
const char kPluginPolicy[] = "plugin-policy";
|
||||
// Allow the content. This is the default value.
|
||||
const char kPluginPolicy_Allow[] = "allow";
|
||||
const char kPluginPolicy_Allow[] = "allow";
|
||||
// Allow important content and block unimportant content based on heuristics.
|
||||
// The user can manually load blocked content.
|
||||
const char kPluginPolicy_Detect[] = "detect";
|
||||
const char kPluginPolicy_Detect[] = "detect";
|
||||
// Block the content. The user can manually load blocked content.
|
||||
const char kPluginPolicy_Block[] = "block";
|
||||
const char kPluginPolicy_Block[] = "block";
|
||||
|
||||
// Expose preferences used only by unit tests.
|
||||
const char kEnablePreferenceTesting[] = "enable-preference-testing";
|
||||
const char kEnablePreferenceTesting[] = "enable-preference-testing";
|
||||
|
||||
// Enable date-based expiration of built in network security information.
|
||||
const char kEnableNetSecurityExpiration[] = "enable-net-security-expiration";
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
// Path to the framework directory.
|
||||
const char kFrameworkDirPath[] = "framework-dir-path";
|
||||
const char kFrameworkDirPath[] = "framework-dir-path";
|
||||
#endif
|
||||
|
||||
} // namespace switches
|
||||
|
@@ -10,10 +10,12 @@
|
||||
CefCommandLineImpl::CefCommandLineImpl(base::CommandLine* value,
|
||||
bool will_delete,
|
||||
bool read_only)
|
||||
: CefValueBase<CefCommandLine, base::CommandLine>(
|
||||
value, NULL, will_delete ? kOwnerWillDelete : kOwnerNoDelete,
|
||||
read_only, NULL) {
|
||||
}
|
||||
: CefValueBase<CefCommandLine, base::CommandLine>(
|
||||
value,
|
||||
NULL,
|
||||
will_delete ? kOwnerWillDelete : kOwnerNoDelete,
|
||||
read_only,
|
||||
NULL) {}
|
||||
|
||||
bool CefCommandLineImpl::IsValid() {
|
||||
return !detached();
|
||||
@@ -25,8 +27,8 @@ bool CefCommandLineImpl::IsReadOnly() {
|
||||
|
||||
CefRefPtr<CefCommandLine> CefCommandLineImpl::Copy() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, NULL);
|
||||
return new CefCommandLineImpl(
|
||||
new base::CommandLine(const_value().argv()), true, false);
|
||||
return new CefCommandLineImpl(new base::CommandLine(const_value().argv()),
|
||||
true, false);
|
||||
}
|
||||
|
||||
void CefCommandLineImpl::InitFromArgv(int argc, const char* const* argv) {
|
||||
@@ -137,7 +139,6 @@ void CefCommandLineImpl::PrependWrapper(const CefString& wrapper) {
|
||||
mutable_value()->PrependWrapper(wrapper);
|
||||
}
|
||||
|
||||
|
||||
// CefCommandLine implementation.
|
||||
|
||||
// static
|
||||
|
@@ -12,8 +12,8 @@
|
||||
#include "base/command_line.h"
|
||||
|
||||
// CefCommandLine implementation
|
||||
class CefCommandLineImpl :
|
||||
public CefValueBase<CefCommandLine, base::CommandLine> {
|
||||
class CefCommandLineImpl
|
||||
: public CefValueBase<CefCommandLine, base::CommandLine> {
|
||||
public:
|
||||
CefCommandLineImpl(base::CommandLine* value,
|
||||
bool will_delete,
|
||||
|
@@ -17,10 +17,10 @@
|
||||
#include "libcef/common/scheme_registrar_impl.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@@ -50,10 +50,9 @@ CefContentClient* g_content_client = NULL;
|
||||
|
||||
const char kPDFPluginExtension[] = "pdf";
|
||||
const char kPDFPluginDescription[] = "Portable Document Format";
|
||||
const char kPDFPluginOutOfProcessMimeType[] =
|
||||
"application/x-google-chrome-pdf";
|
||||
const uint32_t kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE |
|
||||
ppapi::PERMISSION_DEV;
|
||||
const char kPDFPluginOutOfProcessMimeType[] = "application/x-google-chrome-pdf";
|
||||
const uint32_t kPDFPluginPermissions =
|
||||
ppapi::PERMISSION_PRIVATE | ppapi::PERMISSION_DEV;
|
||||
|
||||
content::PepperPluginInfo::GetInterfaceFunc g_pdf_get_interface;
|
||||
content::PepperPluginInfo::PPP_InitializeModuleFunc g_pdf_initialize_module;
|
||||
@@ -73,10 +72,9 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
|
||||
pdf_info.description = kPDFPluginDescription;
|
||||
pdf_info.path =
|
||||
base::FilePath::FromUTF8Unsafe(CefContentClient::kPDFPluginPath);
|
||||
content::WebPluginMimeType pdf_mime_type(
|
||||
kPDFPluginOutOfProcessMimeType,
|
||||
kPDFPluginExtension,
|
||||
kPDFPluginDescription);
|
||||
content::WebPluginMimeType pdf_mime_type(kPDFPluginOutOfProcessMimeType,
|
||||
kPDFPluginExtension,
|
||||
kPDFPluginDescription);
|
||||
pdf_info.mime_types.push_back(pdf_mime_type);
|
||||
pdf_info.internal_entry_points.get_interface = g_pdf_get_interface;
|
||||
pdf_info.internal_entry_points.initialize_module = g_pdf_initialize_module;
|
||||
@@ -107,7 +105,8 @@ content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path,
|
||||
flash_version_numbers.push_back("999");
|
||||
// E.g., "Shockwave Flash 10.2 r154":
|
||||
plugin.description = plugin.name + " " + flash_version_numbers[0] + "." +
|
||||
flash_version_numbers[1] + " r" + flash_version_numbers[2];
|
||||
flash_version_numbers[1] + " r" +
|
||||
flash_version_numbers[2];
|
||||
plugin.version = base::JoinString(flash_version_numbers, ".");
|
||||
content::WebPluginMimeType swf_mime_type(content::kFlashPluginSwfMimeType,
|
||||
content::kFlashPluginSwfExtension,
|
||||
@@ -242,9 +241,9 @@ std::string CefContentClient::GetUserAgent() const {
|
||||
product_version =
|
||||
command_line->GetSwitchValueASCII(switches::kProductVersion);
|
||||
} else {
|
||||
product_version = base::StringPrintf("Chrome/%d.%d.%d.%d",
|
||||
CHROME_VERSION_MAJOR, CHROME_VERSION_MINOR, CHROME_VERSION_BUILD,
|
||||
CHROME_VERSION_PATCH);
|
||||
product_version = base::StringPrintf(
|
||||
"Chrome/%d.%d.%d.%d", CHROME_VERSION_MAJOR, CHROME_VERSION_MINOR,
|
||||
CHROME_VERSION_BUILD, CHROME_VERSION_PATCH);
|
||||
}
|
||||
|
||||
return content::BuildUserAgentFromProduct(product_version);
|
||||
@@ -371,8 +370,8 @@ bool CefContentClient::GetRawDataResource(int resource_id,
|
||||
size_t data_size = 0;
|
||||
if (scale_factor != ui::SCALE_FACTOR_NONE) {
|
||||
if (handler->GetDataResourceForScale(
|
||||
resource_id, static_cast<cef_scale_factor_t>(scale_factor), data,
|
||||
data_size)) {
|
||||
resource_id, static_cast<cef_scale_factor_t>(scale_factor),
|
||||
data, data_size)) {
|
||||
*value = base::StringPiece(static_cast<char*>(data), data_size);
|
||||
}
|
||||
} else if (handler->GetDataResource(resource_id, data, data_size)) {
|
||||
|
@@ -39,8 +39,7 @@ class CefContentClient : public content::ContentClient,
|
||||
base::StringPiece GetDataResource(
|
||||
int resource_id,
|
||||
ui::ScaleFactor scale_factor) const override;
|
||||
base::RefCountedMemory* GetDataResourceBytes(
|
||||
int resource_id) const override;
|
||||
base::RefCountedMemory* GetDataResourceBytes(int resource_id) const override;
|
||||
gfx::Image& GetNativeImageNamed(int resource_id) const override;
|
||||
|
||||
// Values are registered with all processes (url/url_util.h) and with Blink
|
||||
@@ -67,7 +66,7 @@ class CefContentClient : public content::ContentClient,
|
||||
// restrict access.
|
||||
// This value is registered with Blink only.
|
||||
bool is_display_isolated;
|
||||
|
||||
|
||||
// A scheme that will be treated the same as "https". For example, loading
|
||||
// this scheme from other secure schemes will not trigger mixed content
|
||||
// warnings.
|
||||
@@ -104,12 +103,10 @@ class CefContentClient : public content::ContentClient,
|
||||
|
||||
private:
|
||||
// ui::ResourceBundle::Delegate methods.
|
||||
base::FilePath GetPathForResourcePack(
|
||||
const base::FilePath& pack_path,
|
||||
ui::ScaleFactor scale_factor) override;
|
||||
base::FilePath GetPathForLocalePack(
|
||||
const base::FilePath& pack_path,
|
||||
const std::string& locale) override;
|
||||
base::FilePath GetPathForResourcePack(const base::FilePath& pack_path,
|
||||
ui::ScaleFactor scale_factor) override;
|
||||
base::FilePath GetPathForLocalePack(const base::FilePath& pack_path,
|
||||
const std::string& locale) override;
|
||||
gfx::Image GetImageNamed(int resource_id) override;
|
||||
gfx::Image GetNativeImageNamed(int resource_id) override;
|
||||
base::RefCountedStaticMemory* LoadDataResourceBytes(
|
||||
@@ -118,8 +115,7 @@ class CefContentClient : public content::ContentClient,
|
||||
bool GetRawDataResource(int resource_id,
|
||||
ui::ScaleFactor scale_factor,
|
||||
base::StringPiece* value) override;
|
||||
bool GetLocalizedString(int message_id,
|
||||
base::string16* value) override;
|
||||
bool GetLocalizedString(int message_id, base::string16* value) override;
|
||||
|
||||
CefRefPtr<CefApp> application_;
|
||||
bool pack_loading_disabled_;
|
||||
|
@@ -12,10 +12,10 @@
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/common/crash_keys.h"
|
||||
|
||||
@@ -104,7 +104,7 @@ const char kInvalidFileChars[] = "<>:\"/\\|?*";
|
||||
bool isInvalidFileCharacter(unsigned char c) {
|
||||
if (c < ' ' || c == 0x7F)
|
||||
return true;
|
||||
for(size_t i = 0; i < sizeof(kInvalidFileChars); ++i) {
|
||||
for (size_t i = 0; i < sizeof(kInvalidFileChars); ++i) {
|
||||
if (c == kInvalidFileChars[i])
|
||||
return true;
|
||||
}
|
||||
@@ -191,7 +191,7 @@ std::string sanitizePath(const std::string& s) {
|
||||
std::string part = parts[i];
|
||||
if (part != "." && part != "..")
|
||||
part = sanitizePathComponent(part);
|
||||
if (!result.empty() && result[result.length()-1] != kPathSep)
|
||||
if (!result.empty() && result[result.length() - 1] != kPathSep)
|
||||
result += kPathSep;
|
||||
result += part;
|
||||
}
|
||||
@@ -222,7 +222,6 @@ std::string joinPath(const std::string& s1, const std::string& s2) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// This will only be non-nullptr in the chrome_elf address space.
|
||||
CefCrashReporterClient* g_crash_reporter_client = nullptr;
|
||||
|
||||
@@ -253,7 +252,6 @@ bool __declspec(dllexport) __cdecl GetCrashKeyImpl(size_t index,
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
// The below functions were deleted from chrome/install_static/install_util.cc
|
||||
// in https://crbug.com/565446#c17.
|
||||
|
||||
@@ -262,9 +260,8 @@ constexpr wchar_t kUserDataDirname[] = L"User Data";
|
||||
// Populates |result| with the default User Data directory for the current
|
||||
// user.This may be overidden by a command line option. Returns false if all
|
||||
// attempts at locating a User Data directory fail.
|
||||
bool GetDefaultUserDataDirectory(
|
||||
std::wstring* result,
|
||||
const std::wstring& install_sub_directory) {
|
||||
bool GetDefaultUserDataDirectory(std::wstring* result,
|
||||
const std::wstring& install_sub_directory) {
|
||||
// This environment variable should be set on Windows Vista and later
|
||||
// (https://msdn.microsoft.com/library/windows/desktop/dd378457.aspx).
|
||||
std::wstring user_data_dir =
|
||||
@@ -293,9 +290,8 @@ bool GetDefaultUserDataDirectory(
|
||||
|
||||
// Populates |crash_dir| with the default crash dump location regardless of
|
||||
// whether DIR_USER_DATA or DIR_CRASH_DUMPS has been overridden.
|
||||
bool GetDefaultCrashDumpLocation(
|
||||
std::wstring* crash_dir,
|
||||
const std::wstring& install_sub_directory) {
|
||||
bool GetDefaultCrashDumpLocation(std::wstring* crash_dir,
|
||||
const std::wstring& install_sub_directory) {
|
||||
// In order to be able to start crash handling very early, we do not rely on
|
||||
// chrome's PathService entries (for DIR_CRASH_DUMPS) being available on
|
||||
// Windows. See https://crbug.com/564398.
|
||||
@@ -525,9 +521,8 @@ bool CefCrashReporterClient::GetCrashMetricsLocation(
|
||||
|
||||
#elif defined(OS_POSIX)
|
||||
|
||||
void CefCrashReporterClient::GetProductNameAndVersion(
|
||||
const char** product_name,
|
||||
const char** version) {
|
||||
void CefCrashReporterClient::GetProductNameAndVersion(const char** product_name,
|
||||
const char** version) {
|
||||
*product_name = product_name_.c_str();
|
||||
*version = product_version_.c_str();
|
||||
}
|
||||
@@ -631,18 +626,18 @@ void CefCrashReporterClient::GetCrashOptionalArguments(
|
||||
arguments->push_back(std::string("--no-rate-limit"));
|
||||
|
||||
if (max_uploads_ > 0) {
|
||||
arguments->push_back(
|
||||
std::string("--max-uploads=") + base::IntToString(max_uploads_));
|
||||
arguments->push_back(std::string("--max-uploads=") +
|
||||
base::IntToString(max_uploads_));
|
||||
}
|
||||
|
||||
if (max_db_size_ > 0) {
|
||||
arguments->push_back(
|
||||
std::string("--max-db-size=") + base::IntToString(max_db_size_));
|
||||
arguments->push_back(std::string("--max-db-size=") +
|
||||
base::IntToString(max_db_size_));
|
||||
}
|
||||
|
||||
if (max_db_age_ > 0) {
|
||||
arguments->push_back(
|
||||
std::string("--max-db-age=") + base::IntToString(max_db_age_));
|
||||
arguments->push_back(std::string("--max-db-age=") +
|
||||
base::IntToString(max_db_age_));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -5,8 +5,8 @@
|
||||
#ifndef CEF_LIBCEF_COMMON_CRASH_REPORTER_CLIENT_H_
|
||||
#define CEF_LIBCEF_COMMON_CRASH_REPORTER_CLIENT_H_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "include/cef_version.h"
|
||||
|
||||
@@ -89,7 +89,7 @@ class CefCrashReporterClient : public crash_reporter::CrashReporterClient {
|
||||
bool EnableBrowserCrashForwarding() override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
private:
|
||||
bool has_crash_config_file_ = false;
|
||||
|
||||
// Values that will persist until the end of the program.
|
||||
|
@@ -82,7 +82,7 @@ void InitCrashReporter(const base::CommandLine& command_line,
|
||||
}
|
||||
|
||||
g_crash_reporting_enabled = true;
|
||||
#else // !defined(OS_MACOSX)
|
||||
#else // !defined(OS_MACOSX)
|
||||
breakpad::SetCrashServerURL(crash_client->GetCrashServerURL());
|
||||
|
||||
if (process_type != switches::kZygoteProcess) {
|
||||
@@ -102,14 +102,12 @@ bool IsBoringCEFSwitch(const std::string& flag) {
|
||||
return true;
|
||||
|
||||
static const char* const kIgnoreSwitches[] = {
|
||||
// CEF internals.
|
||||
switches::kLogFile,
|
||||
// CEF internals.
|
||||
switches::kLogFile,
|
||||
|
||||
// Chromium internals.
|
||||
"content-image-texture-target",
|
||||
"mojo-platform-channel-handle",
|
||||
"primordial-pipe-token",
|
||||
"service-request-channel-token",
|
||||
// Chromium internals.
|
||||
"content-image-texture-target", "mojo-platform-channel-handle",
|
||||
"primordial-pipe-token", "service-request-channel-token",
|
||||
};
|
||||
|
||||
if (!base::StartsWith(flag, "--", base::CompareCase::SENSITIVE))
|
||||
@@ -156,8 +154,8 @@ void PreSandboxStartup(const base::CommandLine& command_line,
|
||||
#endif
|
||||
|
||||
if (g_crash_reporting_enabled) {
|
||||
LOG(INFO) << "Crash reporting enabled for process: " <<
|
||||
(process_type.empty() ? "browser" : process_type.c_str());
|
||||
LOG(INFO) << "Crash reporting enabled for process: "
|
||||
<< (process_type.empty() ? "browser" : process_type.c_str());
|
||||
}
|
||||
|
||||
// After platform crash reporting have been initialized, store the command
|
||||
|
@@ -42,8 +42,7 @@ bool GetCrashKeyTrampoline(size_t index,
|
||||
static GetCrashKey get_crash_key = []() {
|
||||
HMODULE elf_module = GetModuleHandle(chrome::kChromeElfDllName);
|
||||
return reinterpret_cast<GetCrashKey>(
|
||||
elf_module ? GetProcAddress(elf_module, "GetCrashKeyImpl")
|
||||
: nullptr);
|
||||
elf_module ? GetProcAddress(elf_module, "GetCrashKeyImpl") : nullptr);
|
||||
}();
|
||||
if (get_crash_key) {
|
||||
return (get_crash_key)(index, key_name, max_length);
|
||||
@@ -51,7 +50,6 @@ bool GetCrashKeyTrampoline(size_t index,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// From chrome/common/child_process_logging_win.cc:
|
||||
|
||||
// exported in breakpad_win.cc/crashpad_win.cc:
|
||||
|
@@ -4,20 +4,18 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "libcef/browser/stream_impl.h"
|
||||
#include "libcef/common/drag_data_impl.h"
|
||||
#include "base/files/file_path.h"
|
||||
|
||||
#define CHECK_READONLY_RETURN_VOID() \
|
||||
if (read_only_) { \
|
||||
#define CHECK_READONLY_RETURN_VOID() \
|
||||
if (read_only_) { \
|
||||
NOTREACHED() << "object is read only"; \
|
||||
return; \
|
||||
return; \
|
||||
}
|
||||
|
||||
CefDragDataImpl::CefDragDataImpl(const content::DropData& data)
|
||||
: data_(data),
|
||||
read_only_(false) {
|
||||
}
|
||||
: data_(data), read_only_(false) {}
|
||||
|
||||
CefDragDataImpl::CefDragDataImpl(const content::DropData& data,
|
||||
CefRefPtr<CefImage> image,
|
||||
@@ -25,12 +23,9 @@ CefDragDataImpl::CefDragDataImpl(const content::DropData& data,
|
||||
: data_(data),
|
||||
image_(image),
|
||||
image_hotspot_(image_hotspot),
|
||||
read_only_(false) {
|
||||
}
|
||||
read_only_(false) {}
|
||||
|
||||
CefDragDataImpl::CefDragDataImpl()
|
||||
: read_only_(false) {
|
||||
}
|
||||
CefDragDataImpl::CefDragDataImpl() : read_only_(false) {}
|
||||
|
||||
CefRefPtr<CefDragData> CefDragData::Create() {
|
||||
return new CefDragDataImpl();
|
||||
@@ -128,8 +123,7 @@ bool CefDragDataImpl::GetFileNames(std::vector<CefString>& names) {
|
||||
if (data_.filenames.empty())
|
||||
return false;
|
||||
|
||||
std::vector<ui::FileInfo>::const_iterator it =
|
||||
data_.filenames.begin();
|
||||
std::vector<ui::FileInfo>::const_iterator it = data_.filenames.begin();
|
||||
for (; it != data_.filenames.end(); ++it)
|
||||
names.push_back(it->path.value());
|
||||
|
||||
@@ -185,8 +179,8 @@ void CefDragDataImpl::AddFile(const CefString& path,
|
||||
const CefString& display_name) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
CHECK_READONLY_RETURN_VOID();
|
||||
data_.filenames.push_back(ui::FileInfo(base::FilePath(path),
|
||||
base::FilePath(display_name)));
|
||||
data_.filenames.push_back(
|
||||
ui::FileInfo(base::FilePath(path), base::FilePath(display_name)));
|
||||
}
|
||||
|
||||
void CefDragDataImpl::SetReadOnly(bool read_only) {
|
||||
|
@@ -50,9 +50,7 @@ class CefDragDataImpl : public CefDragData {
|
||||
bool HasImage() override;
|
||||
|
||||
// This method is not safe. Use Lock/Unlock to get mutually exclusive access.
|
||||
content::DropData* drop_data() {
|
||||
return &data_;
|
||||
}
|
||||
content::DropData* drop_data() { return &data_; }
|
||||
|
||||
void SetReadOnly(bool read_only);
|
||||
|
||||
|
@@ -22,8 +22,8 @@
|
||||
#include "chrome/grit/common_resources.h"
|
||||
#include "extensions/common/api/generated_schemas.h"
|
||||
#include "extensions/common/common_manifest_handlers.h"
|
||||
#include "extensions/common/extensions_aliases.h"
|
||||
#include "extensions/common/extension_urls.h"
|
||||
#include "extensions/common/extensions_aliases.h"
|
||||
#include "extensions/common/features/json_feature_provider_source.h"
|
||||
#include "extensions/common/features/simple_feature.h"
|
||||
#include "extensions/common/manifest_handler.h"
|
||||
@@ -45,12 +45,10 @@ SimpleFeature* CreateFeature() {
|
||||
} // namespace
|
||||
|
||||
CefExtensionsClient::CefExtensionsClient()
|
||||
: webstore_base_url_(extension_urls::kChromeWebstoreBaseURL),
|
||||
webstore_update_url_(extension_urls::kChromeWebstoreUpdateURL) {
|
||||
}
|
||||
: webstore_base_url_(extension_urls::kChromeWebstoreBaseURL),
|
||||
webstore_update_url_(extension_urls::kChromeWebstoreUpdateURL) {}
|
||||
|
||||
CefExtensionsClient::~CefExtensionsClient() {
|
||||
}
|
||||
CefExtensionsClient::~CefExtensionsClient() {}
|
||||
|
||||
void CefExtensionsClient::Initialize() {
|
||||
RegisterCommonManifestHandlers();
|
||||
@@ -133,13 +131,12 @@ bool CefExtensionsClient::IsScriptableURL(const GURL& url,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefExtensionsClient::IsAPISchemaGenerated(
|
||||
const std::string& name) const {
|
||||
bool CefExtensionsClient::IsAPISchemaGenerated(const std::string& name) const {
|
||||
// Schema for CEF-only APIs.
|
||||
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||
// libcef/common/extensions/api/README.txt for details.
|
||||
//if (api::cef::CefGeneratedSchemas::IsGenerated(name))
|
||||
// return true;
|
||||
// if (api::cef::CefGeneratedSchemas::IsGenerated(name))
|
||||
// return true;
|
||||
|
||||
// Chrome APIs whitelisted by CEF.
|
||||
if (api::cef::ChromeGeneratedSchemas::IsGenerated(name))
|
||||
@@ -157,8 +154,8 @@ base::StringPiece CefExtensionsClient::GetAPISchema(
|
||||
// Schema for CEF-only APIs.
|
||||
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||
// libcef/common/extensions/api/README.txt for details.
|
||||
//if (api::cef::CefGeneratedSchemas::IsGenerated(name))
|
||||
// return api::cef::CefGeneratedSchemas::Get(name);
|
||||
// if (api::cef::CefGeneratedSchemas::IsGenerated(name))
|
||||
// return api::cef::CefGeneratedSchemas::Get(name);
|
||||
|
||||
// Chrome APIs whitelisted by CEF.
|
||||
if (api::cef::ChromeGeneratedSchemas::IsGenerated(name))
|
||||
@@ -172,8 +169,7 @@ bool CefExtensionsClient::ShouldSuppressFatalErrors() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefExtensionsClient::RecordDidSuppressFatalError() {
|
||||
}
|
||||
void CefExtensionsClient::RecordDidSuppressFatalError() {}
|
||||
|
||||
const GURL& CefExtensionsClient::GetWebstoreBaseURL() const {
|
||||
return webstore_base_url_;
|
||||
|
@@ -19,9 +19,8 @@ bool ExtensionsEnabled() {
|
||||
|
||||
bool PdfExtensionEnabled() {
|
||||
static bool enabled =
|
||||
ExtensionsEnabled() &&
|
||||
!base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kDisablePdfExtension);
|
||||
ExtensionsEnabled() && !base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kDisablePdfExtension);
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
@@ -5,9 +5,9 @@
|
||||
#include "include/cef_parser.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
|
||||
#include "base/values.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/json/json_writer.h"
|
||||
#include "base/values.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -50,8 +50,9 @@ CefRefPtr<CefValue> CefParseJSONAndReturnError(
|
||||
|
||||
int error_code;
|
||||
std::string error_msg;
|
||||
std::unique_ptr<base::Value> parse_result = base::JSONReader::ReadAndReturnError(
|
||||
json, GetJSONReaderOptions(options), &error_code, &error_msg);
|
||||
std::unique_ptr<base::Value> parse_result =
|
||||
base::JSONReader::ReadAndReturnError(json, GetJSONReaderOptions(options),
|
||||
&error_code, &error_msg);
|
||||
if (parse_result)
|
||||
return new CefValueImpl(parse_result.release());
|
||||
|
||||
@@ -69,9 +70,8 @@ CefString CefWriteJSON(CefRefPtr<CefValue> node,
|
||||
CefValueImpl::ScopedLockedValue scoped_value(impl);
|
||||
|
||||
std::string json_string;
|
||||
if (base::JSONWriter::WriteWithOptions(*scoped_value.value(),
|
||||
GetJSONWriterOptions(options),
|
||||
&json_string)) {
|
||||
if (base::JSONWriter::WriteWithOptions(
|
||||
*scoped_value.value(), GetJSONWriterOptions(options), &json_string)) {
|
||||
return json_string;
|
||||
}
|
||||
return CefString();
|
||||
|
@@ -2,13 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/common/main_delegate.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/command_line_impl.h"
|
||||
#include "libcef/common/crash_reporting.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/main_delegate.h"
|
||||
#include "libcef/renderer/content_renderer_client.h"
|
||||
#include "libcef/utility/content_utility_client.h"
|
||||
|
||||
@@ -45,20 +45,20 @@
|
||||
#define IPC_MESSAGE_MACROS_LOG_ENABLED
|
||||
#include "content/public/common/content_ipc_logging.h"
|
||||
#define IPC_LOG_TABLE_ADD_ENTRY(msg_id, logger) \
|
||||
content::RegisterIPCLogger(msg_id, logger)
|
||||
content::RegisterIPCLogger(msg_id, logger)
|
||||
#include "libcef/common/cef_message_generator.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <Objbase.h> // NOLINT(build/include_order)
|
||||
#include <Objbase.h>
|
||||
#include "base/win/registry.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include "libcef/common/util_mac.h"
|
||||
#include "base/mac/bundle_locations.h"
|
||||
#include "base/mac/foundation_util.h"
|
||||
#include "content/public/common/content_paths.h"
|
||||
#include "libcef/common/util_mac.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
@@ -129,8 +129,8 @@ bool GetSystemFlashFilename(base::FilePath* out_path) {
|
||||
L"SOFTWARE\\Macromedia\\FlashPlayerPepper";
|
||||
const wchar_t kFlashPlayerPathValueName[] = L"PlayerPath";
|
||||
|
||||
base::win::RegKey path_key(
|
||||
HKEY_LOCAL_MACHINE, kPepperFlashRegistryRoot, KEY_READ);
|
||||
base::win::RegKey path_key(HKEY_LOCAL_MACHINE, kPepperFlashRegistryRoot,
|
||||
KEY_READ);
|
||||
base::string16 path_str;
|
||||
if (FAILED(path_key.ReadValue(kFlashPlayerPathValueName, &path_str)))
|
||||
return false;
|
||||
@@ -155,7 +155,7 @@ void OverridePepperFlashSystemPluginPath() {
|
||||
if (!util_mac::GetLocalLibraryDirectory(&plugin_filename))
|
||||
return;
|
||||
plugin_filename = plugin_filename.Append(kPepperFlashSystemBaseDirectory)
|
||||
.Append(chrome::kPepperFlashPluginFilename);
|
||||
.Append(chrome::kPepperFlashPluginFilename);
|
||||
#else
|
||||
// A system plugin is not available on other platforms.
|
||||
return;
|
||||
@@ -177,10 +177,8 @@ void OverridePepperFlashSystemPluginPath() {
|
||||
// (This also helps us sidestep issues with other apps grabbing ~/.chromium .)
|
||||
bool GetDefaultUserDataDirectory(base::FilePath* result) {
|
||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||
base::FilePath config_dir(
|
||||
base::nix::GetXDGDirectory(env.get(),
|
||||
base::nix::kXdgConfigHomeEnvVar,
|
||||
base::nix::kDotConfigDir));
|
||||
base::FilePath config_dir(base::nix::GetXDGDirectory(
|
||||
env.get(), base::nix::kXdgConfigHomeEnvVar, base::nix::kDotConfigDir));
|
||||
*result = config_dir.Append(FILE_PATH_LITERAL("cef_user_data"));
|
||||
return true;
|
||||
}
|
||||
@@ -239,9 +237,8 @@ bool IsScaleFactorSupported(ui::ScaleFactor scale_factor) {
|
||||
class CefUIThread : public base::Thread {
|
||||
public:
|
||||
explicit CefUIThread(const content::MainFunctionParams& main_function_params)
|
||||
: base::Thread("CefUIThread"),
|
||||
main_function_params_(main_function_params) {
|
||||
}
|
||||
: base::Thread("CefUIThread"),
|
||||
main_function_params_(main_function_params) {}
|
||||
|
||||
void Init() override {
|
||||
#if defined(OS_WIN)
|
||||
@@ -283,8 +280,7 @@ CefMainDelegate::CefMainDelegate(CefRefPtr<CefApp> application)
|
||||
base_impl_stub();
|
||||
}
|
||||
|
||||
CefMainDelegate::~CefMainDelegate() {
|
||||
}
|
||||
CefMainDelegate::~CefMainDelegate() {}
|
||||
|
||||
bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
@@ -345,15 +341,15 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||
|
||||
if (settings.user_agent.length > 0) {
|
||||
command_line->AppendSwitchASCII(switches::kUserAgent,
|
||||
CefString(&settings.user_agent));
|
||||
CefString(&settings.user_agent));
|
||||
} else if (settings.product_version.length > 0) {
|
||||
command_line->AppendSwitchASCII(switches::kProductVersion,
|
||||
CefString(&settings.product_version));
|
||||
CefString(&settings.product_version));
|
||||
}
|
||||
|
||||
if (settings.locale.length > 0) {
|
||||
command_line->AppendSwitchASCII(switches::kLang,
|
||||
CefString(&settings.locale));
|
||||
CefString(&settings.locale));
|
||||
} else if (!command_line->HasSwitch(switches::kLang)) {
|
||||
command_line->AppendSwitchASCII(switches::kLang, "en-US");
|
||||
}
|
||||
@@ -400,7 +396,7 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||
|
||||
if (settings.javascript_flags.length > 0) {
|
||||
command_line->AppendSwitchASCII(switches::kJavaScriptFlags,
|
||||
CefString(&settings.javascript_flags));
|
||||
CefString(&settings.javascript_flags));
|
||||
}
|
||||
|
||||
if (settings.pack_loading_disabled) {
|
||||
@@ -425,13 +421,15 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||
|
||||
if (settings.remote_debugging_port >= 1024 &&
|
||||
settings.remote_debugging_port <= 65535) {
|
||||
command_line->AppendSwitchASCII(switches::kRemoteDebuggingPort,
|
||||
command_line->AppendSwitchASCII(
|
||||
switches::kRemoteDebuggingPort,
|
||||
base::IntToString(settings.remote_debugging_port));
|
||||
}
|
||||
|
||||
if (settings.uncaught_exception_stack_size > 0) {
|
||||
command_line->AppendSwitchASCII(switches::kUncaughtExceptionStackSize,
|
||||
base::IntToString(settings.uncaught_exception_stack_size));
|
||||
command_line->AppendSwitchASCII(
|
||||
switches::kUncaughtExceptionStackSize,
|
||||
base::IntToString(settings.uncaught_exception_stack_size));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,7 +501,7 @@ void CefMainDelegate::PreSandboxStartup() {
|
||||
command_line->GetSwitchValueASCII(switches::kProcessType);
|
||||
|
||||
if (process_type.empty()) {
|
||||
// Only override these paths when executing the main process.
|
||||
// Only override these paths when executing the main process.
|
||||
#if defined(OS_MACOSX)
|
||||
OverrideChildProcessPath();
|
||||
#endif
|
||||
@@ -536,10 +534,9 @@ void CefMainDelegate::PreSandboxStartup() {
|
||||
}
|
||||
|
||||
void CefMainDelegate::SandboxInitialized(const std::string& process_type) {
|
||||
CefContentClient::SetPDFEntryFunctions(
|
||||
chrome_pdf::PPP_GetInterface,
|
||||
chrome_pdf::PPP_InitializeModule,
|
||||
chrome_pdf::PPP_ShutdownModule);
|
||||
CefContentClient::SetPDFEntryFunctions(chrome_pdf::PPP_GetInterface,
|
||||
chrome_pdf::PPP_InitializeModule,
|
||||
chrome_pdf::PPP_ShutdownModule);
|
||||
}
|
||||
|
||||
int CefMainDelegate::RunProcess(
|
||||
@@ -583,10 +580,9 @@ void CefMainDelegate::ProcessExiting(const std::string& process_type) {
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
|
||||
void CefMainDelegate::ZygoteForked() {
|
||||
base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
const std::string& process_type = command_line->GetSwitchValueASCII(
|
||||
switches::kProcessType);
|
||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
const std::string& process_type =
|
||||
command_line->GetSwitchValueASCII(switches::kProcessType);
|
||||
// Initialize crash reporting state for the newly forked process.
|
||||
crash_reporting::ZygoteForked(command_line, process_type);
|
||||
}
|
||||
@@ -597,8 +593,7 @@ content::ContentBrowserClient* CefMainDelegate::CreateContentBrowserClient() {
|
||||
return browser_client_.get();
|
||||
}
|
||||
|
||||
content::ContentRendererClient*
|
||||
CefMainDelegate::CreateContentRendererClient() {
|
||||
content::ContentRendererClient* CefMainDelegate::CreateContentRendererClient() {
|
||||
renderer_client_.reset(new CefContentRendererClient);
|
||||
return renderer_client_.get();
|
||||
}
|
||||
@@ -624,8 +619,8 @@ void CefMainDelegate::InitializeResourceBundle() {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
base::FilePath cef_pak_file, cef_100_percent_pak_file,
|
||||
cef_200_percent_pak_file, cef_extensions_pak_file,
|
||||
devtools_pak_file, locales_dir;
|
||||
cef_200_percent_pak_file, cef_extensions_pak_file, devtools_pak_file,
|
||||
locales_dir;
|
||||
|
||||
base::FilePath resources_dir;
|
||||
if (command_line->HasSwitch(switches::kResourcesDirPath)) {
|
||||
@@ -666,9 +661,7 @@ void CefMainDelegate::InitializeResourceBundle() {
|
||||
|
||||
const std::string loaded_locale =
|
||||
ui::ResourceBundle::InitSharedInstanceWithLocale(
|
||||
locale,
|
||||
&content_client_,
|
||||
ui::ResourceBundle::LOAD_COMMON_RESOURCES);
|
||||
locale, &content_client_, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
|
||||
if (!loaded_locale.empty() && g_browser_process)
|
||||
g_browser_process->SetApplicationLocale(loaded_locale);
|
||||
|
||||
@@ -697,8 +690,8 @@ void CefMainDelegate::InitializeResourceBundle() {
|
||||
|
||||
if (load_100_percent) {
|
||||
if (base::PathExists(cef_100_percent_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(
|
||||
cef_100_percent_pak_file, ui::SCALE_FACTOR_100P);
|
||||
resource_bundle.AddDataPackFromPath(cef_100_percent_pak_file,
|
||||
ui::SCALE_FACTOR_100P);
|
||||
} else {
|
||||
LOG(ERROR) << "Could not load cef_100_percent.pak";
|
||||
}
|
||||
@@ -706,8 +699,8 @@ void CefMainDelegate::InitializeResourceBundle() {
|
||||
|
||||
if (IsScaleFactorSupported(ui::SCALE_FACTOR_200P)) {
|
||||
if (base::PathExists(cef_200_percent_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(
|
||||
cef_200_percent_pak_file, ui::SCALE_FACTOR_200P);
|
||||
resource_bundle.AddDataPackFromPath(cef_200_percent_pak_file,
|
||||
ui::SCALE_FACTOR_200P);
|
||||
} else {
|
||||
LOG(ERROR) << "Could not load cef_200_percent.pak";
|
||||
}
|
||||
@@ -715,16 +708,16 @@ void CefMainDelegate::InitializeResourceBundle() {
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
if (base::PathExists(cef_extensions_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(
|
||||
cef_extensions_pak_file, ui::SCALE_FACTOR_NONE);
|
||||
resource_bundle.AddDataPackFromPath(cef_extensions_pak_file,
|
||||
ui::SCALE_FACTOR_NONE);
|
||||
} else {
|
||||
LOG(ERROR) << "Could not load cef_extensions.pak";
|
||||
}
|
||||
}
|
||||
|
||||
if (base::PathExists(devtools_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(
|
||||
devtools_pak_file, ui::SCALE_FACTOR_NONE);
|
||||
resource_bundle.AddDataPackFromPath(devtools_pak_file,
|
||||
ui::SCALE_FACTOR_NONE);
|
||||
}
|
||||
|
||||
content_client_.set_allow_pack_file_load(false);
|
||||
|
@@ -8,8 +8,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "libcef/common/content_client.h"
|
||||
#include "include/cef_app.h"
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "content/public/app/content_main_delegate.h"
|
||||
@@ -43,8 +43,7 @@ class CefMainDelegate : public content::ContentMainDelegate {
|
||||
void ZygoteForked() override;
|
||||
#endif
|
||||
content::ContentBrowserClient* CreateContentBrowserClient() override;
|
||||
content::ContentRendererClient*
|
||||
CreateContentRendererClient() override;
|
||||
content::ContentRendererClient* CreateContentRendererClient() override;
|
||||
content::ContentUtilityClient* CreateContentUtilityClient() override;
|
||||
|
||||
// Shut down the browser runner.
|
||||
|
@@ -14,8 +14,7 @@ namespace HttpHeaderUtils {
|
||||
std::string GenerateHeaders(const HeaderMap& map) {
|
||||
std::string headers;
|
||||
|
||||
for (HeaderMap::const_iterator header = map.begin();
|
||||
header != map.end();
|
||||
for (HeaderMap::const_iterator header = map.begin(); header != map.end();
|
||||
++header) {
|
||||
const CefString& key = header->first;
|
||||
const CefString& value = header->second;
|
||||
@@ -34,9 +33,9 @@ std::string GenerateHeaders(const HeaderMap& map) {
|
||||
|
||||
void ParseHeaders(const std::string& header_str, HeaderMap& map) {
|
||||
// Parse the request header values
|
||||
for (net::HttpUtil::HeadersIterator i(header_str.begin(),
|
||||
header_str.end(), "\n");
|
||||
i.GetNext(); ) {
|
||||
for (net::HttpUtil::HeadersIterator i(header_str.begin(), header_str.end(),
|
||||
"\n");
|
||||
i.GetNext();) {
|
||||
map.insert(std::make_pair(i.name(), i.values()));
|
||||
}
|
||||
}
|
||||
|
@@ -7,8 +7,8 @@
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "net/net_features.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/net_features.h"
|
||||
#include "url/url_constants.h"
|
||||
|
||||
namespace scheme {
|
||||
@@ -19,15 +19,14 @@ void AddInternalSchemes(content::ContentClient::Schemes* schemes) {
|
||||
// Access restrictions for chrome-extension: and chrome-extension-resource:
|
||||
// schemes will be applied in CefContentRendererClient::WillSendRequest().
|
||||
static CefContentClient::SchemeInfo internal_schemes[] = {
|
||||
{
|
||||
extensions::kExtensionScheme,
|
||||
true, /* is_standard */
|
||||
false, /* is_local */
|
||||
false, /* is_display_isolated */
|
||||
true, /* is_secure */
|
||||
true, /* is_cors_enabled */
|
||||
true, /* is_csp_bypassing */
|
||||
},
|
||||
{
|
||||
extensions::kExtensionScheme, true, /* is_standard */
|
||||
false, /* is_local */
|
||||
false, /* is_display_isolated */
|
||||
true, /* is_secure */
|
||||
true, /* is_cors_enabled */
|
||||
true, /* is_csp_bypassing */
|
||||
},
|
||||
};
|
||||
|
||||
// The |is_display_isolated| value is excluded here because it's registered
|
||||
|
@@ -10,10 +10,7 @@
|
||||
namespace net {
|
||||
|
||||
UploadData::UploadData()
|
||||
: identifier_(0),
|
||||
is_chunked_(false),
|
||||
last_chunk_appended_(false) {
|
||||
}
|
||||
: identifier_(0), is_chunked_(false), last_chunk_appended_(false) {}
|
||||
|
||||
void UploadData::AppendBytes(const char* bytes, int bytes_len) {
|
||||
DCHECK(!is_chunked_);
|
||||
@@ -24,7 +21,8 @@ void UploadData::AppendBytes(const char* bytes, int bytes_len) {
|
||||
}
|
||||
|
||||
void UploadData::AppendFileRange(const base::FilePath& file_path,
|
||||
uint64_t offset, uint64_t length,
|
||||
uint64_t offset,
|
||||
uint64_t length,
|
||||
const base::Time& expected_modification_time) {
|
||||
DCHECK(!is_chunked_);
|
||||
elements_.push_back(base::MakeUnique<UploadElement>());
|
||||
@@ -32,7 +30,6 @@ void UploadData::AppendFileRange(const base::FilePath& file_path,
|
||||
expected_modification_time);
|
||||
}
|
||||
|
||||
UploadData::~UploadData() {
|
||||
}
|
||||
UploadData::~UploadData() {}
|
||||
|
||||
} // namespace net
|
||||
|
@@ -30,16 +30,16 @@ namespace net {
|
||||
// Until there is a more abstract class for this, this one derives from
|
||||
// SupportsUserData to allow users to stash random data by
|
||||
// key and ensure its destruction when UploadData is finally deleted.
|
||||
class UploadData
|
||||
: public base::RefCounted<UploadData>,
|
||||
public base::SupportsUserData {
|
||||
class UploadData : public base::RefCounted<UploadData>,
|
||||
public base::SupportsUserData {
|
||||
public:
|
||||
UploadData();
|
||||
|
||||
void AppendBytes(const char* bytes, int bytes_len);
|
||||
|
||||
void AppendFileRange(const base::FilePath& file_path,
|
||||
uint64_t offset, uint64_t length,
|
||||
uint64_t offset,
|
||||
uint64_t length,
|
||||
const base::Time& expected_modification_time);
|
||||
|
||||
// Initializes the object to send chunks of upload data over time rather
|
||||
@@ -53,17 +53,11 @@ class UploadData
|
||||
|
||||
using ElementsVector = std::vector<std::unique_ptr<UploadElement>>;
|
||||
|
||||
const ElementsVector& elements() const {
|
||||
return elements_;
|
||||
}
|
||||
const ElementsVector& elements() const { return elements_; }
|
||||
|
||||
ElementsVector* elements_mutable() {
|
||||
return &elements_;
|
||||
}
|
||||
ElementsVector* elements_mutable() { return &elements_; }
|
||||
|
||||
void swap_elements(ElementsVector* elements) {
|
||||
elements_.swap(*elements);
|
||||
}
|
||||
void swap_elements(ElementsVector* elements) { elements_.swap(*elements); }
|
||||
|
||||
// Identifies a particular upload instance, which is used by the cache to
|
||||
// formulate a cache key. This value should be unique across browser
|
||||
|
@@ -14,10 +14,8 @@ UploadElement::UploadElement()
|
||||
bytes_start_(NULL),
|
||||
bytes_length_(0),
|
||||
file_range_offset_(0),
|
||||
file_range_length_(std::numeric_limits<uint64_t>::max()) {
|
||||
}
|
||||
file_range_length_(std::numeric_limits<uint64_t>::max()) {}
|
||||
|
||||
UploadElement::~UploadElement() {
|
||||
}
|
||||
UploadElement::~UploadElement() {}
|
||||
|
||||
} // namespace net
|
||||
|
@@ -62,7 +62,8 @@ class UploadElement {
|
||||
// change. Also note that the granularity for comparison is time_t, not
|
||||
// the full precision.
|
||||
void SetToFilePathRange(const base::FilePath& path,
|
||||
uint64_t offset, uint64_t length,
|
||||
uint64_t offset,
|
||||
uint64_t length,
|
||||
const base::Time& expected_modification_time) {
|
||||
type_ = TYPE_FILE;
|
||||
file_path_ = path;
|
||||
@@ -85,8 +86,7 @@ class UploadElement {
|
||||
};
|
||||
|
||||
#if defined(UNIT_TEST)
|
||||
inline bool operator==(const UploadElement& a,
|
||||
const UploadElement& b) {
|
||||
inline bool operator==(const UploadElement& a, const UploadElement& b) {
|
||||
if (a.type() != b.type())
|
||||
return false;
|
||||
if (a.type() == UploadElement::TYPE_BYTES)
|
||||
@@ -97,13 +97,12 @@ inline bool operator==(const UploadElement& a,
|
||||
a.file_range_offset() == b.file_range_offset() &&
|
||||
a.file_range_length() == b.file_range_length() &&
|
||||
a.expected_file_modification_time() ==
|
||||
b.expected_file_modification_time();
|
||||
b.expected_file_modification_time();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool operator!=(const UploadElement& a,
|
||||
const UploadElement& b) {
|
||||
inline bool operator!=(const UploadElement& a, const UploadElement& b) {
|
||||
return !(a == b);
|
||||
}
|
||||
#endif // defined(UNIT_TEST)
|
||||
|
@@ -13,8 +13,7 @@
|
||||
#include "net/base/mime_util.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
bool CefParseURL(const CefString& url,
|
||||
CefURLParts& parts) {
|
||||
bool CefParseURL(const CefString& url, CefURLParts& parts) {
|
||||
GURL gurl(url.ToString());
|
||||
if (!gurl.is_valid())
|
||||
return false;
|
||||
@@ -32,8 +31,7 @@ bool CefParseURL(const CefString& url,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefCreateURL(const CefURLParts& parts,
|
||||
CefString& url) {
|
||||
bool CefCreateURL(const CefURLParts& parts, CefString& url) {
|
||||
std::string spec = CefString(parts.spec.str, parts.spec.length, false);
|
||||
std::string scheme = CefString(parts.scheme.str, parts.scheme.length, false);
|
||||
std::string username =
|
||||
|
@@ -2,16 +2,15 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/common/process_message_impl.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/process_message_impl.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
namespace {
|
||||
|
||||
void CopyValue(const Cef_Request_Params& source,
|
||||
Cef_Request_Params& target) {
|
||||
void CopyValue(const Cef_Request_Params& source, Cef_Request_Params& target) {
|
||||
target.name = source.name;
|
||||
auto copy = source.arguments.CreateDeepCopy();
|
||||
target.arguments.Swap(copy.get());
|
||||
@@ -29,10 +28,12 @@ CefRefPtr<CefProcessMessage> CefProcessMessage::Create(const CefString& name) {
|
||||
CefProcessMessageImpl::CefProcessMessageImpl(Cef_Request_Params* value,
|
||||
bool will_delete,
|
||||
bool read_only)
|
||||
: CefValueBase<CefProcessMessage, Cef_Request_Params>(
|
||||
value, NULL, will_delete ? kOwnerWillDelete : kOwnerNoDelete,
|
||||
read_only, NULL) {
|
||||
}
|
||||
: CefValueBase<CefProcessMessage, Cef_Request_Params>(
|
||||
value,
|
||||
NULL,
|
||||
will_delete ? kOwnerWillDelete : kOwnerNoDelete,
|
||||
read_only,
|
||||
NULL) {}
|
||||
|
||||
bool CefProcessMessageImpl::CopyTo(Cef_Request_Params& target) {
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
@@ -63,8 +64,7 @@ CefString CefProcessMessageImpl::GetName() {
|
||||
CefRefPtr<CefListValue> CefProcessMessageImpl::GetArgumentList() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, NULL);
|
||||
return CefListValueImpl::GetOrCreateRef(
|
||||
const_cast<base::ListValue*>(&(const_value().arguments)),
|
||||
const_cast<Cef_Request_Params*>(&const_value()),
|
||||
read_only(),
|
||||
controller());
|
||||
const_cast<base::ListValue*>(&(const_value().arguments)),
|
||||
const_cast<Cef_Request_Params*>(&const_value()), read_only(),
|
||||
controller());
|
||||
}
|
||||
|
@@ -7,11 +7,11 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "libcef/browser/navigate_params.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/net/http_header_utils.h"
|
||||
#include "libcef/common/net/upload_data.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/browser/navigate_params.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/logging.h"
|
||||
@@ -24,9 +24,9 @@
|
||||
#include "content/public/common/resource_type.h"
|
||||
#include "net/base/elements_upload_data_stream.h"
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/base/upload_bytes_element_reader.h"
|
||||
#include "net/base/upload_data_stream.h"
|
||||
#include "net/base/upload_element_reader.h"
|
||||
#include "net/base/upload_bytes_element_reader.h"
|
||||
#include "net/base/upload_file_element_reader.h"
|
||||
#include "net/http/http_request_headers.h"
|
||||
#include "net/http/http_util.h"
|
||||
@@ -65,7 +65,8 @@ class BytesElementReader : public net::UploadBytesElementReader {
|
||||
|
||||
base::TaskRunner* GetFileTaskRunner() {
|
||||
return content::BrowserThread::GetTaskRunnerForThread(
|
||||
content::BrowserThread::FILE).get();
|
||||
content::BrowserThread::FILE)
|
||||
.get();
|
||||
}
|
||||
|
||||
// A subclass of net::UploadFileElementReader that keeps the associated
|
||||
@@ -172,9 +173,7 @@ void GetHeaderMap(const blink::WebURLRequest& request,
|
||||
class HeaderVisitor : public blink::WebHTTPHeaderVisitor {
|
||||
public:
|
||||
HeaderVisitor(CefRequest::HeaderMap* map, GURL* referrer)
|
||||
: map_(map),
|
||||
referrer_(referrer) {
|
||||
}
|
||||
: map_(map), referrer_(referrer) {}
|
||||
|
||||
void VisitHeader(const blink::WebString& name,
|
||||
const blink::WebString& value) override {
|
||||
@@ -221,26 +220,25 @@ void SetHeaderMap(const CefRequest::HeaderMap& map,
|
||||
}
|
||||
|
||||
// Type used in UploadDataStream.
|
||||
typedef std::vector<std::unique_ptr<net::UploadElementReader>> UploadElementReaders;
|
||||
typedef std::vector<std::unique_ptr<net::UploadElementReader>>
|
||||
UploadElementReaders;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
#define CHECK_READONLY_RETURN(val) \
|
||||
if (read_only_) { \
|
||||
#define CHECK_READONLY_RETURN(val) \
|
||||
if (read_only_) { \
|
||||
NOTREACHED() << "object is read only"; \
|
||||
return val; \
|
||||
return val; \
|
||||
}
|
||||
|
||||
#define CHECK_READONLY_RETURN_VOID() \
|
||||
if (read_only_) { \
|
||||
#define CHECK_READONLY_RETURN_VOID() \
|
||||
if (read_only_) { \
|
||||
NOTREACHED() << "object is read only"; \
|
||||
return; \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define SETBOOLFLAG(obj, flags, method, FLAG) \
|
||||
obj.method((flags & (FLAG)) == (FLAG))
|
||||
|
||||
obj.method((flags & (FLAG)) == (FLAG))
|
||||
|
||||
// CefRequest -----------------------------------------------------------------
|
||||
|
||||
@@ -250,12 +248,9 @@ CefRefPtr<CefRequest> CefRequest::Create() {
|
||||
return request;
|
||||
}
|
||||
|
||||
|
||||
// CefRequestImpl -------------------------------------------------------------
|
||||
|
||||
CefRequestImpl::CefRequestImpl()
|
||||
: read_only_(false),
|
||||
track_changes_(false) {
|
||||
CefRequestImpl::CefRequestImpl() : read_only_(false), track_changes_(false) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
Reset();
|
||||
}
|
||||
@@ -468,8 +463,7 @@ void CefRequestImpl::Set(net::URLRequest* request) {
|
||||
const content::ResourceRequestInfo* info =
|
||||
content::ResourceRequestInfo::ForRequest(request);
|
||||
if (info) {
|
||||
resource_type_ =
|
||||
static_cast<cef_resource_type_t>(info->GetResourceType());
|
||||
resource_type_ = static_cast<cef_resource_type_t>(info->GetResourceType());
|
||||
transition_type_ =
|
||||
static_cast<cef_transition_type_t>(info->GetPageTransition());
|
||||
}
|
||||
@@ -571,13 +565,11 @@ void CefRequestImpl::Get(blink::WebURLRequest& request,
|
||||
if (!referrer_url_.is_empty()) {
|
||||
const blink::WebString& referrer =
|
||||
blink::WebSecurityPolicy::GenerateReferrerHeader(
|
||||
static_cast<blink::WebReferrerPolicy>(referrer_policy_),
|
||||
url_,
|
||||
static_cast<blink::WebReferrerPolicy>(referrer_policy_), url_,
|
||||
blink::WebString::FromUTF8(referrer_url_.spec()));
|
||||
if (!referrer.IsEmpty()) {
|
||||
request.SetHTTPReferrer(
|
||||
referrer,
|
||||
static_cast<blink::WebReferrerPolicy>(referrer_policy_));
|
||||
referrer, static_cast<blink::WebReferrerPolicy>(referrer_policy_));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,9 +596,9 @@ void CefRequestImpl::Get(blink::WebURLRequest& request,
|
||||
if (!first_party_for_cookies_.is_empty())
|
||||
request.SetFirstPartyForCookies(first_party_for_cookies_);
|
||||
|
||||
request.SetCachePolicy((flags_ & UR_FLAG_SKIP_CACHE) ?
|
||||
blink::WebCachePolicy::kBypassingCache :
|
||||
blink::WebCachePolicy::kUseProtocolCachePolicy);
|
||||
request.SetCachePolicy((flags_ & UR_FLAG_SKIP_CACHE)
|
||||
? blink::WebCachePolicy::kBypassingCache
|
||||
: blink::WebCachePolicy::kUseProtocolCachePolicy);
|
||||
|
||||
SETBOOLFLAG(request, flags_, SetAllowStoredCredentials,
|
||||
UR_FLAG_ALLOW_CACHED_CREDENTIALS);
|
||||
@@ -625,19 +617,17 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
|
||||
const blink::WebString& referrer =
|
||||
blink::WebSecurityPolicy::GenerateReferrerHeader(
|
||||
static_cast<blink::WebReferrerPolicy>(params.referrer_policy),
|
||||
params.url,
|
||||
blink::WebString::FromUTF8(params.referrer.spec()));
|
||||
params.url, blink::WebString::FromUTF8(params.referrer.spec()));
|
||||
if (!referrer.IsEmpty()) {
|
||||
request.SetHTTPReferrer(
|
||||
referrer,
|
||||
static_cast<blink::WebReferrerPolicy>(params.referrer_policy));
|
||||
request.SetHTTPReferrer(referrer, static_cast<blink::WebReferrerPolicy>(
|
||||
params.referrer_policy));
|
||||
}
|
||||
}
|
||||
|
||||
if (!params.headers.empty()) {
|
||||
for (net::HttpUtil::HeadersIterator i(params.headers.begin(),
|
||||
params.headers.end(), "\n");
|
||||
i.GetNext(); ) {
|
||||
i.GetNext();) {
|
||||
request.AddHTTPHeaderField(blink::WebString::FromUTF8(i.name()),
|
||||
blink::WebString::FromUTF8(i.values()));
|
||||
}
|
||||
@@ -651,8 +641,10 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
|
||||
}
|
||||
|
||||
// The comparison performed by httpHeaderField() is case insensitive.
|
||||
if (request.HttpHeaderField(blink::WebString::FromASCII(
|
||||
net::HttpRequestHeaders::kContentType)).length()== 0) {
|
||||
if (request
|
||||
.HttpHeaderField(blink::WebString::FromASCII(
|
||||
net::HttpRequestHeaders::kContentType))
|
||||
.length() == 0) {
|
||||
request.SetHTTPHeaderField(
|
||||
blink::WebString::FromASCII(net::HttpRequestHeaders::kContentType),
|
||||
blink::WebString::FromASCII(kApplicationFormURLEncoded));
|
||||
@@ -667,7 +659,8 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
|
||||
data.Assign(element->bytes(), element->bytes_length());
|
||||
body.AppendData(data);
|
||||
} else if (element->type() == net::UploadElement::TYPE_FILE) {
|
||||
body.AppendFile(FilePathStringToWebString(element->file_path().value()));
|
||||
body.AppendFile(
|
||||
FilePathStringToWebString(element->file_path().value()));
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
@@ -679,9 +672,9 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
|
||||
if (params.first_party_for_cookies.is_valid())
|
||||
request.SetFirstPartyForCookies(params.first_party_for_cookies);
|
||||
|
||||
request.SetCachePolicy((params.load_flags & UR_FLAG_SKIP_CACHE) ?
|
||||
blink::WebCachePolicy::kBypassingCache :
|
||||
blink::WebCachePolicy::kUseProtocolCachePolicy);
|
||||
request.SetCachePolicy((params.load_flags & UR_FLAG_SKIP_CACHE)
|
||||
? blink::WebCachePolicy::kBypassingCache
|
||||
: blink::WebCachePolicy::kUseProtocolCachePolicy);
|
||||
|
||||
SETBOOLFLAG(request, params.load_flags, SetAllowStoredCredentials,
|
||||
UR_FLAG_ALLOW_CACHED_CREDENTIALS);
|
||||
@@ -739,8 +732,7 @@ void CefRequestImpl::Get(net::URLFetcher& fetcher,
|
||||
}
|
||||
}
|
||||
|
||||
fetcher.SetExtraRequestHeaders(
|
||||
HttpHeaderUtils::GenerateHeaders(headerMap));
|
||||
fetcher.SetExtraRequestHeaders(HttpHeaderUtils::GenerateHeaders(headerMap));
|
||||
|
||||
if (postdata_.get()) {
|
||||
CefPostData::ElementVector elements;
|
||||
@@ -767,10 +759,8 @@ void CefRequestImpl::Get(net::URLFetcher& fetcher,
|
||||
}
|
||||
case PDE_TYPE_FILE:
|
||||
fetcher.SetUploadFilePath(
|
||||
content_type,
|
||||
base::FilePath(impl->GetFile()),
|
||||
0, std::numeric_limits<uint64_t>::max(),
|
||||
GetFileTaskRunner());
|
||||
content_type, base::FilePath(impl->GetFile()), 0,
|
||||
std::numeric_limits<uint64_t>::max(), GetFileTaskRunner());
|
||||
break;
|
||||
case PDE_TYPE_EMPTY:
|
||||
break;
|
||||
@@ -820,8 +810,8 @@ void CefRequestImpl::SetTrackChanges(bool track_changes) {
|
||||
changes_ = kChangedNone;
|
||||
|
||||
if (postdata_.get()) {
|
||||
static_cast<CefPostDataImpl*>(postdata_.get())->
|
||||
SetTrackChanges(track_changes);
|
||||
static_cast<CefPostDataImpl*>(postdata_.get())
|
||||
->SetTrackChanges(track_changes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -895,15 +885,13 @@ CefRefPtr<CefPostData> CefPostData::Create() {
|
||||
return postdata;
|
||||
}
|
||||
|
||||
|
||||
// CefPostDataImpl ------------------------------------------------------------
|
||||
|
||||
CefPostDataImpl::CefPostDataImpl()
|
||||
: read_only_(false),
|
||||
has_excluded_elements_(false),
|
||||
track_changes_(false),
|
||||
has_changes_(false) {
|
||||
}
|
||||
: read_only_(false),
|
||||
has_excluded_elements_(false),
|
||||
track_changes_(false),
|
||||
has_changes_(false) {}
|
||||
|
||||
bool CefPostDataImpl::IsReadOnly() {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
@@ -1015,8 +1003,8 @@ void CefPostDataImpl::Get(net::UploadData& data) const {
|
||||
for (const auto& element : elements_) {
|
||||
std::unique_ptr<net::UploadElement> data_element =
|
||||
base::MakeUnique<net::UploadElement>();
|
||||
static_cast<CefPostDataElementImpl*>(element.get())->Get(
|
||||
*data_element.get());
|
||||
static_cast<CefPostDataElementImpl*>(element.get())
|
||||
->Get(*data_element.get());
|
||||
data_elements.push_back(std::move(data_element));
|
||||
}
|
||||
data.swap_elements(&data_elements);
|
||||
@@ -1093,8 +1081,8 @@ void CefPostDataImpl::SetTrackChanges(bool track_changes) {
|
||||
|
||||
ElementVector::const_iterator it = elements_.begin();
|
||||
for (; it != elements_.end(); ++it) {
|
||||
static_cast<CefPostDataElementImpl*>(it->get())->
|
||||
SetTrackChanges(track_changes);
|
||||
static_cast<CefPostDataElementImpl*>(it->get())->SetTrackChanges(
|
||||
track_changes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1118,7 +1106,6 @@ void CefPostDataImpl::Changed() {
|
||||
has_changes_ = true;
|
||||
}
|
||||
|
||||
|
||||
// CefPostDataElement ---------------------------------------------------------
|
||||
|
||||
// static
|
||||
@@ -1127,14 +1114,13 @@ CefRefPtr<CefPostDataElement> CefPostDataElement::Create() {
|
||||
return element;
|
||||
}
|
||||
|
||||
|
||||
// CefPostDataElementImpl -----------------------------------------------------
|
||||
|
||||
CefPostDataElementImpl::CefPostDataElementImpl()
|
||||
: type_(PDE_TYPE_EMPTY),
|
||||
read_only_(false),
|
||||
track_changes_(false),
|
||||
has_changes_(false) {
|
||||
: type_(PDE_TYPE_EMPTY),
|
||||
read_only_(false),
|
||||
track_changes_(false),
|
||||
has_changes_(false) {
|
||||
memset(&data_, 0, sizeof(data_));
|
||||
}
|
||||
|
||||
@@ -1305,7 +1291,7 @@ void CefPostDataElementImpl::Set(const blink::WebHTTPBody::Element& element) {
|
||||
|
||||
if (element.type == blink::WebHTTPBody::Element::kTypeData) {
|
||||
SetToBytes(element.data.size(),
|
||||
static_cast<const void*>(element.data.Data()));
|
||||
static_cast<const void*>(element.data.Data()));
|
||||
} else if (element.type == blink::WebHTTPBody::Element::kTypeFile) {
|
||||
SetToFile(element.file_path.Utf16());
|
||||
} else {
|
||||
@@ -1318,8 +1304,8 @@ void CefPostDataElementImpl::Get(blink::WebHTTPBody::Element& element) const {
|
||||
|
||||
if (type_ == PDE_TYPE_BYTES) {
|
||||
element.type = blink::WebHTTPBody::Element::kTypeData;
|
||||
element.data.Assign(
|
||||
static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
|
||||
element.data.Assign(static_cast<char*>(data_.bytes.bytes),
|
||||
data_.bytes.size);
|
||||
} else if (type_ == PDE_TYPE_FILE) {
|
||||
element.type = blink::WebHTTPBody::Element::kTypeFile;
|
||||
element.file_path.Assign(
|
||||
|
@@ -41,14 +41,14 @@ struct CefNavigateParams;
|
||||
class CefRequestImpl : public CefRequest {
|
||||
public:
|
||||
enum Changes {
|
||||
kChangedNone = 0,
|
||||
kChangedUrl = 1 << 0,
|
||||
kChangedMethod = 1 << 1,
|
||||
kChangedReferrer = 1 << 2,
|
||||
kChangedPostData = 1 << 3,
|
||||
kChangedHeaderMap = 1 << 4,
|
||||
kChangedFlags = 1 << 5,
|
||||
kChangedFirstPartyForCookies = 1 << 6,
|
||||
kChangedNone = 0,
|
||||
kChangedUrl = 1 << 0,
|
||||
kChangedMethod = 1 << 1,
|
||||
kChangedReferrer = 1 << 2,
|
||||
kChangedPostData = 1 << 3,
|
||||
kChangedHeaderMap = 1 << 4,
|
||||
kChangedFlags = 1 << 5,
|
||||
kChangedFirstPartyForCookies = 1 << 6,
|
||||
};
|
||||
|
||||
CefRequestImpl();
|
||||
|
@@ -6,8 +6,7 @@
|
||||
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
CefResourceBundleImpl::CefResourceBundleImpl() {
|
||||
}
|
||||
CefResourceBundleImpl::CefResourceBundleImpl() {}
|
||||
|
||||
CefString CefResourceBundleImpl::GetLocalizedString(int string_id) {
|
||||
if (!ui::ResourceBundle::HasSharedInstance())
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#define CEF_LIBCEF_COMMON_RESOURCE_BUNDLE_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "include/cef_resource_bundle.h"
|
||||
|
||||
class CefResourceBundleImpl : public CefResourceBundle {
|
||||
|
@@ -15,14 +15,12 @@
|
||||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/platform/WebURLResponse.h"
|
||||
|
||||
|
||||
#define CHECK_READONLY_RETURN_VOID() \
|
||||
if (read_only_) { \
|
||||
#define CHECK_READONLY_RETURN_VOID() \
|
||||
if (read_only_) { \
|
||||
NOTREACHED() << "object is read only"; \
|
||||
return; \
|
||||
return; \
|
||||
}
|
||||
|
||||
|
||||
// CefResponse ----------------------------------------------------------------
|
||||
|
||||
// static
|
||||
@@ -31,14 +29,10 @@ CefRefPtr<CefResponse> CefResponse::Create() {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
// CefResponseImpl ------------------------------------------------------------
|
||||
|
||||
CefResponseImpl::CefResponseImpl()
|
||||
: error_code_(ERR_NONE),
|
||||
status_code_(0),
|
||||
read_only_(false) {
|
||||
}
|
||||
: error_code_(ERR_NONE), status_code_(0), read_only_(false) {}
|
||||
|
||||
bool CefResponseImpl::IsReadOnly() {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
@@ -122,14 +116,13 @@ net::HttpResponseHeaders* CefResponseImpl::GetResponseHeaders() {
|
||||
if (!status_text_.empty())
|
||||
status_text = status_text_;
|
||||
else
|
||||
status_text = (status_code_ == 200)?"OK":"ERROR";
|
||||
status_text = (status_code_ == 200) ? "OK" : "ERROR";
|
||||
|
||||
base::SStringPrintf(&response, "HTTP/1.1 %d %s", status_code_,
|
||||
status_text.c_str());
|
||||
if (header_map_.size() > 0) {
|
||||
for (HeaderMap::const_iterator header = header_map_.begin();
|
||||
header != header_map_.end();
|
||||
++header) {
|
||||
header != header_map_.end(); ++header) {
|
||||
const CefString& key = header->first;
|
||||
const CefString& value = header->second;
|
||||
|
||||
@@ -156,7 +149,8 @@ net::HttpResponseHeaders* CefResponseImpl::GetResponseHeaders() {
|
||||
mime_type = "text/html";
|
||||
|
||||
base::StringAppendF(&response, "%c%s: %s", '\0',
|
||||
net::HttpRequestHeaders::kContentType, mime_type.c_str());
|
||||
net::HttpRequestHeaders::kContentType,
|
||||
mime_type.c_str());
|
||||
}
|
||||
|
||||
return new net::HttpResponseHeaders(response);
|
||||
|
@@ -2,14 +2,12 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#include "libcef/common/response_manager.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/response_manager.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
CefResponseManager::CefResponseManager()
|
||||
: next_request_id_(0) {
|
||||
}
|
||||
CefResponseManager::CefResponseManager() : next_request_id_(0) {}
|
||||
|
||||
int CefResponseManager::GetNextRequestId() {
|
||||
DCHECK(CalledOnValidThread());
|
||||
@@ -19,7 +17,8 @@ int CefResponseManager::GetNextRequestId() {
|
||||
int CefResponseManager::RegisterHandler(CefRefPtr<Handler> handler) {
|
||||
DCHECK(CalledOnValidThread());
|
||||
int request_id = GetNextRequestId();
|
||||
TRACE_EVENT_ASYNC_BEGIN1("libcef", "CefResponseManager::Handler", request_id, "request_id", request_id);
|
||||
TRACE_EVENT_ASYNC_BEGIN1("libcef", "CefResponseManager::Handler", request_id,
|
||||
"request_id", request_id);
|
||||
handlers_.insert(std::make_pair(request_id, handler));
|
||||
return request_id;
|
||||
}
|
||||
@@ -32,10 +31,12 @@ bool CefResponseManager::RunHandler(const Cef_Response_Params& params) {
|
||||
TRACE_EVENT0("libcef", "CefResponseManager::RunHandler");
|
||||
it->second->OnResponse(params);
|
||||
handlers_.erase(it);
|
||||
TRACE_EVENT_ASYNC_END1("libcef", "CefResponseManager::Handler", params.request_id, "success", 1);
|
||||
TRACE_EVENT_ASYNC_END1("libcef", "CefResponseManager::Handler",
|
||||
params.request_id, "success", 1);
|
||||
return true;
|
||||
}
|
||||
TRACE_EVENT_ASYNC_END1("libcef", "CefResponseManager::Handler", params.request_id, "success", 0);
|
||||
TRACE_EVENT_ASYNC_END1("libcef", "CefResponseManager::Handler",
|
||||
params.request_id, "success", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -7,7 +7,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
#include "base/threading/non_thread_safe.h"
|
||||
|
||||
struct Cef_Response_Params;
|
||||
@@ -18,13 +20,13 @@ class CefResponseManager : base::NonThreadSafe {
|
||||
// Used for handling response messages.
|
||||
class Handler : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
virtual void OnResponse(const Cef_Response_Params& params) =0;
|
||||
virtual void OnResponse(const Cef_Response_Params& params) = 0;
|
||||
};
|
||||
|
||||
// Used for handling response ack messages.
|
||||
class AckHandler : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
virtual void OnResponseAck() =0;
|
||||
virtual void OnResponseAck() = 0;
|
||||
};
|
||||
|
||||
CefResponseManager();
|
||||
@@ -51,11 +53,11 @@ class CefResponseManager : base::NonThreadSafe {
|
||||
int next_request_id_;
|
||||
|
||||
// Map of unique request ids to Handler references.
|
||||
typedef std::map<int, CefRefPtr<Handler> > HandlerMap;
|
||||
typedef std::map<int, CefRefPtr<Handler>> HandlerMap;
|
||||
HandlerMap handlers_;
|
||||
|
||||
// Map of unique request ids to AckHandler references.
|
||||
typedef std::map<int, CefRefPtr<AckHandler> > AckHandlerMap;
|
||||
typedef std::map<int, CefRefPtr<AckHandler>> AckHandlerMap;
|
||||
AckHandlerMap ack_handlers_;
|
||||
};
|
||||
|
||||
|
@@ -21,20 +21,17 @@ void AppendArray(const std::vector<std::string>& source,
|
||||
return;
|
||||
target->insert(target->end(), source.begin(), source.end());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CefSchemeRegistrarImpl::CefSchemeRegistrarImpl() {
|
||||
}
|
||||
CefSchemeRegistrarImpl::CefSchemeRegistrarImpl() {}
|
||||
|
||||
bool CefSchemeRegistrarImpl::AddCustomScheme(
|
||||
const CefString& scheme_name,
|
||||
bool is_standard,
|
||||
bool is_local,
|
||||
bool is_display_isolated,
|
||||
bool is_secure,
|
||||
bool is_cors_enabled,
|
||||
bool is_csp_bypassing) {
|
||||
bool CefSchemeRegistrarImpl::AddCustomScheme(const CefString& scheme_name,
|
||||
bool is_standard,
|
||||
bool is_local,
|
||||
bool is_display_isolated,
|
||||
bool is_secure,
|
||||
bool is_cors_enabled,
|
||||
bool is_csp_bypassing) {
|
||||
const std::string& scheme = base::ToLowerASCII(scheme_name.ToString());
|
||||
if (scheme::IsInternalHandledScheme(scheme) ||
|
||||
registered_schemes_.find(scheme) != registered_schemes_.end()) {
|
||||
@@ -57,9 +54,8 @@ bool CefSchemeRegistrarImpl::AddCustomScheme(
|
||||
schemes_.csp_bypassing_schemes.push_back(scheme);
|
||||
|
||||
CefContentClient::SchemeInfo scheme_info = {
|
||||
scheme, is_standard, is_local, is_display_isolated, is_secure,
|
||||
is_cors_enabled, is_csp_bypassing
|
||||
};
|
||||
scheme, is_standard, is_local, is_display_isolated,
|
||||
is_secure, is_cors_enabled, is_csp_bypassing};
|
||||
CefContentClient::Get()->AddCustomScheme(scheme_info);
|
||||
|
||||
return true;
|
||||
|
@@ -3,7 +3,9 @@
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "include/internal/cef_string_list.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
typedef std::vector<CefString> StringList;
|
||||
@@ -18,7 +20,8 @@ CEF_EXPORT size_t cef_string_list_size(cef_string_list_t list) {
|
||||
return impl->size();
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_list_value(cef_string_list_t list, size_t index,
|
||||
CEF_EXPORT int cef_string_list_value(cef_string_list_t list,
|
||||
size_t index,
|
||||
cef_string_t* value) {
|
||||
DCHECK(list);
|
||||
DCHECK(value);
|
||||
|
@@ -3,7 +3,9 @@
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "include/internal/cef_string_map.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
typedef std::map<CefString, CefString> StringMap;
|
||||
@@ -32,7 +34,8 @@ CEF_EXPORT int cef_string_map_find(cef_string_map_t map,
|
||||
return cef_string_set(val.c_str(), val.length(), value, true);
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_map_key(cef_string_map_t map, size_t index,
|
||||
CEF_EXPORT int cef_string_map_key(cef_string_map_t map,
|
||||
size_t index,
|
||||
cef_string_t* key) {
|
||||
DCHECK(map);
|
||||
DCHECK(key);
|
||||
@@ -49,7 +52,8 @@ CEF_EXPORT int cef_string_map_key(cef_string_map_t map, size_t index,
|
||||
return 0;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_map_value(cef_string_map_t map, size_t index,
|
||||
CEF_EXPORT int cef_string_map_value(cef_string_map_t map,
|
||||
size_t index,
|
||||
cef_string_t* value) {
|
||||
DCHECK(map);
|
||||
DCHECK(value);
|
||||
@@ -62,7 +66,7 @@ CEF_EXPORT int cef_string_map_value(cef_string_map_t map, size_t index,
|
||||
for (size_t ct = 0; it != impl->end(); ++it, ct++) {
|
||||
if (ct == index) {
|
||||
return cef_string_set(it->second.c_str(), it->second.length(), value,
|
||||
true);
|
||||
true);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@@ -3,7 +3,9 @@
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "include/internal/cef_string_multimap.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
typedef std::multimap<CefString, CefString> StringMultimap;
|
||||
@@ -19,7 +21,7 @@ CEF_EXPORT size_t cef_string_multimap_size(cef_string_multimap_t map) {
|
||||
}
|
||||
|
||||
CEF_EXPORT size_t cef_string_multimap_find_count(cef_string_multimap_t map,
|
||||
const cef_string_t* key) {
|
||||
const cef_string_t* key) {
|
||||
DCHECK(map);
|
||||
DCHECK(key);
|
||||
StringMultimap* impl = reinterpret_cast<StringMultimap*>(map);
|
||||
@@ -55,7 +57,8 @@ CEF_EXPORT int cef_string_multimap_enumerate(cef_string_multimap_t map,
|
||||
return cef_string_set(val.c_str(), val.length(), value, true);
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_multimap_key(cef_string_multimap_t map, size_t index,
|
||||
CEF_EXPORT int cef_string_multimap_key(cef_string_multimap_t map,
|
||||
size_t index,
|
||||
cef_string_t* key) {
|
||||
DCHECK(map);
|
||||
DCHECK(key);
|
||||
@@ -72,7 +75,8 @@ CEF_EXPORT int cef_string_multimap_key(cef_string_multimap_t map, size_t index,
|
||||
return 0;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_multimap_value(cef_string_multimap_t map, size_t index,
|
||||
CEF_EXPORT int cef_string_multimap_value(cef_string_multimap_t map,
|
||||
size_t index,
|
||||
cef_string_t* value) {
|
||||
DCHECK(map);
|
||||
DCHECK(value);
|
||||
@@ -85,7 +89,7 @@ CEF_EXPORT int cef_string_multimap_value(cef_string_multimap_t map, size_t index
|
||||
for (size_t ct = 0; it != impl->end(); ++it, ct++) {
|
||||
if (ct == index) {
|
||||
return cef_string_set(it->second.c_str(), it->second.length(), value,
|
||||
true);
|
||||
true);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@@ -2,8 +2,10 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "include/internal/cef_string_types.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include "include/internal/cef_string_types.h"
|
||||
|
||||
#include "base/i18n/case_conversion.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string16.h"
|
||||
@@ -13,15 +15,15 @@
|
||||
namespace {
|
||||
|
||||
void string_wide_dtor(wchar_t* str) {
|
||||
delete [] str;
|
||||
delete[] str;
|
||||
}
|
||||
|
||||
void string_utf8_dtor(char* str) {
|
||||
delete [] str;
|
||||
delete[] str;
|
||||
}
|
||||
|
||||
void string_utf16_dtor(char16* str) {
|
||||
delete [] str;
|
||||
delete[] str;
|
||||
}
|
||||
|
||||
// Originally from base/strings/utf_string_conversions.cc
|
||||
@@ -32,13 +34,15 @@ std::wstring ASCIIToWide(const base::StringPiece& ascii) {
|
||||
|
||||
} // namespace
|
||||
|
||||
CEF_EXPORT int cef_string_wide_set(const wchar_t* src, size_t src_len,
|
||||
cef_string_wide_t* output, int copy) {
|
||||
CEF_EXPORT int cef_string_wide_set(const wchar_t* src,
|
||||
size_t src_len,
|
||||
cef_string_wide_t* output,
|
||||
int copy) {
|
||||
cef_string_wide_clear(output);
|
||||
|
||||
if (copy) {
|
||||
if (src && src_len > 0) {
|
||||
output->str = new wchar_t[src_len+1];
|
||||
output->str = new wchar_t[src_len + 1];
|
||||
if (!output->str)
|
||||
return 0;
|
||||
|
||||
@@ -55,12 +59,14 @@ CEF_EXPORT int cef_string_wide_set(const wchar_t* src, size_t src_len,
|
||||
return 1;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_utf8_set(const char* src, size_t src_len,
|
||||
cef_string_utf8_t* output, int copy) {
|
||||
CEF_EXPORT int cef_string_utf8_set(const char* src,
|
||||
size_t src_len,
|
||||
cef_string_utf8_t* output,
|
||||
int copy) {
|
||||
cef_string_utf8_clear(output);
|
||||
if (copy) {
|
||||
if (src && src_len > 0) {
|
||||
output->str = new char[src_len+1];
|
||||
output->str = new char[src_len + 1];
|
||||
if (!output->str)
|
||||
return 0;
|
||||
|
||||
@@ -77,13 +83,15 @@ CEF_EXPORT int cef_string_utf8_set(const char* src, size_t src_len,
|
||||
return 1;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_utf16_set(const char16* src, size_t src_len,
|
||||
cef_string_utf16_t* output, int copy) {
|
||||
CEF_EXPORT int cef_string_utf16_set(const char16* src,
|
||||
size_t src_len,
|
||||
cef_string_utf16_t* output,
|
||||
int copy) {
|
||||
cef_string_utf16_clear(output);
|
||||
|
||||
if (copy) {
|
||||
if (src && src_len > 0) {
|
||||
output->str = new char16[src_len+1];
|
||||
output->str = new char16[src_len + 1];
|
||||
if (!output->str)
|
||||
return 0;
|
||||
|
||||
@@ -163,8 +171,8 @@ CEF_EXPORT int cef_string_utf16_cmp(const cef_string_utf16_t* str1,
|
||||
if (str1->length == 0 && str2->length == 0)
|
||||
return 0;
|
||||
#if defined(WCHAR_T_IS_UTF32)
|
||||
int r = base::c16memcmp(str1->str, str2->str, std::min(str1->length,
|
||||
str2->length));
|
||||
int r = base::c16memcmp(str1->str, str2->str,
|
||||
std::min(str1->length, str2->length));
|
||||
#else
|
||||
int r = wcsncmp(str1->str, str2->str, std::min(str1->length, str2->length));
|
||||
#endif
|
||||
@@ -177,7 +185,8 @@ CEF_EXPORT int cef_string_utf16_cmp(const cef_string_utf16_t* str1,
|
||||
return r;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_wide_to_utf8(const wchar_t* src, size_t src_len,
|
||||
CEF_EXPORT int cef_string_wide_to_utf8(const wchar_t* src,
|
||||
size_t src_len,
|
||||
cef_string_utf8_t* output) {
|
||||
std::string str;
|
||||
bool ret = base::WideToUTF8(src, src_len, &str);
|
||||
@@ -186,7 +195,8 @@ CEF_EXPORT int cef_string_wide_to_utf8(const wchar_t* src, size_t src_len,
|
||||
return ret;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_utf8_to_wide(const char* src, size_t src_len,
|
||||
CEF_EXPORT int cef_string_utf8_to_wide(const char* src,
|
||||
size_t src_len,
|
||||
cef_string_wide_t* output) {
|
||||
std::wstring str;
|
||||
bool ret = base::UTF8ToWide(src, src_len, &str);
|
||||
@@ -195,7 +205,8 @@ CEF_EXPORT int cef_string_utf8_to_wide(const char* src, size_t src_len,
|
||||
return ret;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src, size_t src_len,
|
||||
CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src,
|
||||
size_t src_len,
|
||||
cef_string_utf16_t* output) {
|
||||
base::string16 str;
|
||||
bool ret = base::WideToUTF16(src, src_len, &str);
|
||||
@@ -204,7 +215,8 @@ CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src, size_t src_len,
|
||||
return ret;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_utf16_to_wide(const char16* src, size_t src_len,
|
||||
CEF_EXPORT int cef_string_utf16_to_wide(const char16* src,
|
||||
size_t src_len,
|
||||
cef_string_wide_t* output) {
|
||||
std::wstring str;
|
||||
bool ret = base::UTF16ToWide(src, src_len, &str);
|
||||
@@ -213,7 +225,8 @@ CEF_EXPORT int cef_string_utf16_to_wide(const char16* src, size_t src_len,
|
||||
return ret;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_utf8_to_utf16(const char* src, size_t src_len,
|
||||
CEF_EXPORT int cef_string_utf8_to_utf16(const char* src,
|
||||
size_t src_len,
|
||||
cef_string_utf16_t* output) {
|
||||
base::string16 str;
|
||||
bool ret = base::UTF8ToUTF16(src, src_len, &str);
|
||||
@@ -222,7 +235,8 @@ CEF_EXPORT int cef_string_utf8_to_utf16(const char* src, size_t src_len,
|
||||
return ret;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_utf16_to_utf8(const char16* src, size_t src_len,
|
||||
CEF_EXPORT int cef_string_utf16_to_utf8(const char16* src,
|
||||
size_t src_len,
|
||||
cef_string_utf8_t* output) {
|
||||
std::string str;
|
||||
bool ret = base::UTF16ToUTF8(src, src_len, &str);
|
||||
@@ -231,13 +245,15 @@ CEF_EXPORT int cef_string_utf16_to_utf8(const char16* src, size_t src_len,
|
||||
return ret;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_ascii_to_wide(const char* src, size_t src_len,
|
||||
CEF_EXPORT int cef_string_ascii_to_wide(const char* src,
|
||||
size_t src_len,
|
||||
cef_string_wide_t* output) {
|
||||
const std::wstring& str = ASCIIToWide(std::string(src, src_len));
|
||||
return cef_string_wide_set(str.c_str(), str.length(), output, true);
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_ascii_to_utf16(const char* src, size_t src_len,
|
||||
CEF_EXPORT int cef_string_ascii_to_utf16(const char* src,
|
||||
size_t src_len,
|
||||
cef_string_utf16_t* output) {
|
||||
const base::string16& str = base::ASCIIToUTF16(std::string(src, src_len));
|
||||
return cef_string_utf16_set(str.c_str(), str.length(), output, true);
|
||||
@@ -277,13 +293,15 @@ CEF_EXPORT void cef_string_userfree_utf16_free(
|
||||
delete str;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_utf16_to_lower(const char16* src, size_t src_len,
|
||||
CEF_EXPORT int cef_string_utf16_to_lower(const char16* src,
|
||||
size_t src_len,
|
||||
cef_string_utf16_t* output) {
|
||||
const base::string16& str = base::i18n::ToLower(base::string16(src, src_len));
|
||||
return cef_string_utf16_set(str.c_str(), str.length(), output, true);
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_utf16_to_upper(const char16* src, size_t src_len,
|
||||
CEF_EXPORT int cef_string_utf16_to_upper(const char16* src,
|
||||
size_t src_len,
|
||||
cef_string_utf16_t* output) {
|
||||
const base::string16& str = base::i18n::ToUpper(base::string16(src, src_len));
|
||||
return cef_string_utf16_set(str.c_str(), str.length(), output, true);
|
||||
|
@@ -21,17 +21,19 @@ bool CefPostTask(CefThreadId threadId, CefRefPtr<CefTask> task) {
|
||||
CefTaskRunnerImpl::GetTaskRunner(threadId);
|
||||
if (task_runner.get()) {
|
||||
return task_runner->PostTask(FROM_HERE,
|
||||
base::Bind(&CefTask::Execute, task.get()));
|
||||
base::Bind(&CefTask::Execute, task.get()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CefPostDelayedTask(CefThreadId threadId, CefRefPtr<CefTask> task, int64 delay_ms) {
|
||||
bool CefPostDelayedTask(CefThreadId threadId,
|
||||
CefRefPtr<CefTask> task,
|
||||
int64 delay_ms) {
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner =
|
||||
CefTaskRunnerImpl::GetTaskRunner(threadId);
|
||||
if (task_runner.get()) {
|
||||
return task_runner->PostDelayedTask(FROM_HERE,
|
||||
base::Bind(&CefTask::Execute, task.get()),
|
||||
return task_runner->PostDelayedTask(
|
||||
FROM_HERE, base::Bind(&CefTask::Execute, task.get()),
|
||||
base::TimeDelta::FromMilliseconds(delay_ms));
|
||||
}
|
||||
return false;
|
||||
|
@@ -2,8 +2,8 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/common/task_runner_impl.h"
|
||||
#include "libcef/common/content_client.h"
|
||||
#include "libcef/common/task_runner_impl.h"
|
||||
#include "libcef/renderer/content_renderer_client.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
@@ -37,7 +37,6 @@ CefRefPtr<CefTaskRunner> CefTaskRunner::GetForThread(CefThreadId threadId) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// CefTaskRunnerImpl
|
||||
|
||||
CefTaskRunnerImpl::CefTaskRunnerImpl(
|
||||
@@ -47,8 +46,8 @@ CefTaskRunnerImpl::CefTaskRunnerImpl(
|
||||
}
|
||||
|
||||
// static
|
||||
scoped_refptr<base::SequencedTaskRunner>
|
||||
CefTaskRunnerImpl::GetTaskRunner(CefThreadId threadId) {
|
||||
scoped_refptr<base::SequencedTaskRunner> CefTaskRunnerImpl::GetTaskRunner(
|
||||
CefThreadId threadId) {
|
||||
// Render process.
|
||||
if (threadId == TID_RENDERER) {
|
||||
CefContentRendererClient* client = CefContentRendererClient::Get();
|
||||
@@ -60,29 +59,29 @@ scoped_refptr<base::SequencedTaskRunner>
|
||||
// Browser process.
|
||||
int id = -1;
|
||||
switch (threadId) {
|
||||
case TID_UI:
|
||||
id = BrowserThread::UI;
|
||||
break;
|
||||
case TID_DB:
|
||||
id = BrowserThread::DB;
|
||||
break;
|
||||
case TID_FILE:
|
||||
id = BrowserThread::FILE;
|
||||
break;
|
||||
case TID_FILE_USER_BLOCKING:
|
||||
id = BrowserThread::FILE_USER_BLOCKING;
|
||||
break;
|
||||
case TID_PROCESS_LAUNCHER:
|
||||
id = BrowserThread::PROCESS_LAUNCHER;
|
||||
break;
|
||||
case TID_CACHE:
|
||||
id = BrowserThread::CACHE;
|
||||
break;
|
||||
case TID_IO:
|
||||
id = BrowserThread::IO;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case TID_UI:
|
||||
id = BrowserThread::UI;
|
||||
break;
|
||||
case TID_DB:
|
||||
id = BrowserThread::DB;
|
||||
break;
|
||||
case TID_FILE:
|
||||
id = BrowserThread::FILE;
|
||||
break;
|
||||
case TID_FILE_USER_BLOCKING:
|
||||
id = BrowserThread::FILE_USER_BLOCKING;
|
||||
break;
|
||||
case TID_PROCESS_LAUNCHER:
|
||||
id = BrowserThread::PROCESS_LAUNCHER;
|
||||
break;
|
||||
case TID_CACHE:
|
||||
id = BrowserThread::CACHE;
|
||||
break;
|
||||
case TID_IO:
|
||||
id = BrowserThread::IO;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
if (id >= 0 && CefContentClient::Get() &&
|
||||
@@ -97,7 +96,7 @@ scoped_refptr<base::SequencedTaskRunner>
|
||||
|
||||
// static
|
||||
scoped_refptr<base::SequencedTaskRunner>
|
||||
CefTaskRunnerImpl::GetCurrentTaskRunner() {
|
||||
CefTaskRunnerImpl::GetCurrentTaskRunner() {
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner;
|
||||
|
||||
// For named browser process threads return the same TaskRunner as
|
||||
@@ -141,12 +140,12 @@ bool CefTaskRunnerImpl::BelongsToThread(CefThreadId threadId) {
|
||||
|
||||
bool CefTaskRunnerImpl::PostTask(CefRefPtr<CefTask> task) {
|
||||
return task_runner_->PostTask(FROM_HERE,
|
||||
base::Bind(&CefTask::Execute, task.get()));
|
||||
base::Bind(&CefTask::Execute, task.get()));
|
||||
}
|
||||
|
||||
bool CefTaskRunnerImpl::PostDelayedTask(CefRefPtr<CefTask> task,
|
||||
int64 delay_ms) {
|
||||
return task_runner_->PostDelayedTask(FROM_HERE,
|
||||
base::Bind(&CefTask::Execute, task.get()),
|
||||
base::TimeDelta::FromMilliseconds(delay_ms));
|
||||
return task_runner_->PostDelayedTask(
|
||||
FROM_HERE, base::Bind(&CefTask::Execute, task.get()),
|
||||
base::TimeDelta::FromMilliseconds(delay_ms));
|
||||
}
|
||||
|
@@ -2,11 +2,12 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_COMMON_TASK_RUNNER_IMPL_H_
|
||||
#define CEF_LIBCEF_COMMON_TASK_RUNNER_IMPL_H_
|
||||
#ifndef CEF_LIBCEF_COMMON_TASK_RUNNER_IMPL_H_
|
||||
#define CEF_LIBCEF_COMMON_TASK_RUNNER_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_task.h"
|
||||
|
||||
#include "base/sequenced_task_runner.h"
|
||||
|
||||
class CefTaskRunnerImpl : public CefTaskRunner {
|
||||
@@ -15,8 +16,8 @@ class CefTaskRunnerImpl : public CefTaskRunner {
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner);
|
||||
|
||||
// Returns the task runner associated with |threadId|.
|
||||
static scoped_refptr<base::SequencedTaskRunner>
|
||||
GetTaskRunner(CefThreadId threadId);
|
||||
static scoped_refptr<base::SequencedTaskRunner> GetTaskRunner(
|
||||
CefThreadId threadId);
|
||||
// Returns the current task runner.
|
||||
static scoped_refptr<base::SequencedTaskRunner> GetCurrentTaskRunner();
|
||||
|
||||
@@ -25,8 +26,7 @@ class CefTaskRunnerImpl : public CefTaskRunner {
|
||||
bool BelongsToCurrentThread() override;
|
||||
bool BelongsToThread(CefThreadId threadId) override;
|
||||
bool PostTask(CefRefPtr<CefTask> task) override;
|
||||
bool PostDelayedTask(CefRefPtr<CefTask> task,
|
||||
int64 delay_ms) override;
|
||||
bool PostDelayedTask(CefRefPtr<CefTask> task, int64 delay_ms) override;
|
||||
|
||||
private:
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner_;
|
||||
|
@@ -4,20 +4,14 @@
|
||||
|
||||
#include "include/test/cef_translator_test.h"
|
||||
|
||||
class CefTranslatorTestRefPtrLibraryImpl :
|
||||
public CefTranslatorTestRefPtrLibrary {
|
||||
class CefTranslatorTestRefPtrLibraryImpl
|
||||
: public CefTranslatorTestRefPtrLibrary {
|
||||
public:
|
||||
explicit CefTranslatorTestRefPtrLibraryImpl(int value)
|
||||
: value_(value) {
|
||||
}
|
||||
explicit CefTranslatorTestRefPtrLibraryImpl(int value) : value_(value) {}
|
||||
|
||||
int GetValue() override {
|
||||
return value_;
|
||||
}
|
||||
int GetValue() override { return value_; }
|
||||
|
||||
void SetValue(int value) override {
|
||||
value_ = value;
|
||||
}
|
||||
void SetValue(int value) override { value_ = value; }
|
||||
|
||||
protected:
|
||||
int value_;
|
||||
@@ -33,29 +27,19 @@ CefTranslatorTestRefPtrLibrary::Create(int value) {
|
||||
return new CefTranslatorTestRefPtrLibraryImpl(value);
|
||||
}
|
||||
|
||||
class CefTranslatorTestRefPtrLibraryChildImpl :
|
||||
public CefTranslatorTestRefPtrLibraryChild {
|
||||
class CefTranslatorTestRefPtrLibraryChildImpl
|
||||
: public CefTranslatorTestRefPtrLibraryChild {
|
||||
public:
|
||||
CefTranslatorTestRefPtrLibraryChildImpl(int value, int other_value)
|
||||
: value_(value),
|
||||
other_value_(other_value) {
|
||||
}
|
||||
: value_(value), other_value_(other_value) {}
|
||||
|
||||
int GetValue() override {
|
||||
return value_;
|
||||
}
|
||||
int GetValue() override { return value_; }
|
||||
|
||||
void SetValue(int value) override {
|
||||
value_ = value;
|
||||
}
|
||||
void SetValue(int value) override { value_ = value; }
|
||||
|
||||
int GetOtherValue() override {
|
||||
return other_value_;
|
||||
}
|
||||
int GetOtherValue() override { return other_value_; }
|
||||
|
||||
void SetOtherValue(int value) override {
|
||||
other_value_ = value;
|
||||
}
|
||||
void SetOtherValue(int value) override { other_value_ = value; }
|
||||
|
||||
protected:
|
||||
int value_;
|
||||
@@ -68,46 +52,31 @@ class CefTranslatorTestRefPtrLibraryChildImpl :
|
||||
|
||||
// static
|
||||
CefRefPtr<CefTranslatorTestRefPtrLibraryChild>
|
||||
CefTranslatorTestRefPtrLibraryChild::Create(
|
||||
int value,
|
||||
int other_value) {
|
||||
CefTranslatorTestRefPtrLibraryChild::Create(int value, int other_value) {
|
||||
return new CefTranslatorTestRefPtrLibraryChildImpl(value, other_value);
|
||||
}
|
||||
|
||||
class CefTranslatorTestRefPtrLibraryChildChildImpl :
|
||||
public CefTranslatorTestRefPtrLibraryChildChild {
|
||||
class CefTranslatorTestRefPtrLibraryChildChildImpl
|
||||
: public CefTranslatorTestRefPtrLibraryChildChild {
|
||||
public:
|
||||
CefTranslatorTestRefPtrLibraryChildChildImpl(int value,
|
||||
int other_value,
|
||||
int other_other_value)
|
||||
: value_(value),
|
||||
other_value_(other_value),
|
||||
other_other_value_(other_other_value) {
|
||||
}
|
||||
int other_value,
|
||||
int other_other_value)
|
||||
: value_(value),
|
||||
other_value_(other_value),
|
||||
other_other_value_(other_other_value) {}
|
||||
|
||||
int GetValue() override {
|
||||
return value_;
|
||||
}
|
||||
int GetValue() override { return value_; }
|
||||
|
||||
void SetValue(int value) override {
|
||||
value_ = value;
|
||||
}
|
||||
void SetValue(int value) override { value_ = value; }
|
||||
|
||||
int GetOtherValue() override {
|
||||
return other_value_;
|
||||
}
|
||||
int GetOtherValue() override { return other_value_; }
|
||||
|
||||
void SetOtherValue(int value) override {
|
||||
other_value_ = value;
|
||||
}
|
||||
void SetOtherValue(int value) override { other_value_ = value; }
|
||||
|
||||
int GetOtherOtherValue() override {
|
||||
return other_other_value_;
|
||||
}
|
||||
int GetOtherOtherValue() override { return other_other_value_; }
|
||||
|
||||
void SetOtherOtherValue(int value) override {
|
||||
other_other_value_ = value;
|
||||
}
|
||||
void SetOtherOtherValue(int value) override { other_other_value_ = value; }
|
||||
|
||||
protected:
|
||||
int value_;
|
||||
@@ -121,29 +90,21 @@ class CefTranslatorTestRefPtrLibraryChildChildImpl :
|
||||
|
||||
// static
|
||||
CefRefPtr<CefTranslatorTestRefPtrLibraryChildChild>
|
||||
CefTranslatorTestRefPtrLibraryChildChild::Create(
|
||||
int value,
|
||||
int other_value,
|
||||
int other_other_value) {
|
||||
CefTranslatorTestRefPtrLibraryChildChild::Create(int value,
|
||||
int other_value,
|
||||
int other_other_value) {
|
||||
return new CefTranslatorTestRefPtrLibraryChildChildImpl(value, other_value,
|
||||
other_other_value);
|
||||
}
|
||||
|
||||
|
||||
class CefTranslatorTestScopedLibraryImpl :
|
||||
public CefTranslatorTestScopedLibrary {
|
||||
class CefTranslatorTestScopedLibraryImpl
|
||||
: public CefTranslatorTestScopedLibrary {
|
||||
public:
|
||||
explicit CefTranslatorTestScopedLibraryImpl(int value)
|
||||
: value_(value) {
|
||||
}
|
||||
explicit CefTranslatorTestScopedLibraryImpl(int value) : value_(value) {}
|
||||
|
||||
int GetValue() override {
|
||||
return value_;
|
||||
}
|
||||
int GetValue() override { return value_; }
|
||||
|
||||
void SetValue(int value) override {
|
||||
value_ = value;
|
||||
}
|
||||
void SetValue(int value) override { value_ = value; }
|
||||
|
||||
protected:
|
||||
int value_;
|
||||
@@ -159,29 +120,19 @@ CefTranslatorTestScopedLibrary::Create(int value) {
|
||||
new CefTranslatorTestScopedLibraryImpl(value));
|
||||
}
|
||||
|
||||
class CefTranslatorTestScopedLibraryChildImpl :
|
||||
public CefTranslatorTestScopedLibraryChild {
|
||||
class CefTranslatorTestScopedLibraryChildImpl
|
||||
: public CefTranslatorTestScopedLibraryChild {
|
||||
public:
|
||||
CefTranslatorTestScopedLibraryChildImpl(int value, int other_value)
|
||||
: value_(value),
|
||||
other_value_(other_value) {
|
||||
}
|
||||
: value_(value), other_value_(other_value) {}
|
||||
|
||||
int GetValue() override {
|
||||
return value_;
|
||||
}
|
||||
int GetValue() override { return value_; }
|
||||
|
||||
void SetValue(int value) override {
|
||||
value_ = value;
|
||||
}
|
||||
void SetValue(int value) override { value_ = value; }
|
||||
|
||||
int GetOtherValue() override {
|
||||
return other_value_;
|
||||
}
|
||||
int GetOtherValue() override { return other_value_; }
|
||||
|
||||
void SetOtherValue(int value) override {
|
||||
other_value_ = value;
|
||||
}
|
||||
void SetOtherValue(int value) override { other_value_ = value; }
|
||||
|
||||
protected:
|
||||
int value_;
|
||||
@@ -193,47 +144,32 @@ class CefTranslatorTestScopedLibraryChildImpl :
|
||||
|
||||
// static
|
||||
CefOwnPtr<CefTranslatorTestScopedLibraryChild>
|
||||
CefTranslatorTestScopedLibraryChild::Create(
|
||||
int value,
|
||||
int other_value) {
|
||||
CefTranslatorTestScopedLibraryChild::Create(int value, int other_value) {
|
||||
return CefOwnPtr<CefTranslatorTestScopedLibraryChild>(
|
||||
new CefTranslatorTestScopedLibraryChildImpl(value, other_value));
|
||||
}
|
||||
|
||||
class CefTranslatorTestScopedLibraryChildChildImpl :
|
||||
public CefTranslatorTestScopedLibraryChildChild {
|
||||
class CefTranslatorTestScopedLibraryChildChildImpl
|
||||
: public CefTranslatorTestScopedLibraryChildChild {
|
||||
public:
|
||||
CefTranslatorTestScopedLibraryChildChildImpl(int value,
|
||||
int other_value,
|
||||
int other_other_value)
|
||||
: value_(value),
|
||||
other_value_(other_value),
|
||||
other_other_value_(other_other_value) {
|
||||
}
|
||||
: value_(value),
|
||||
other_value_(other_value),
|
||||
other_other_value_(other_other_value) {}
|
||||
|
||||
int GetValue() override {
|
||||
return value_;
|
||||
}
|
||||
int GetValue() override { return value_; }
|
||||
|
||||
void SetValue(int value) override {
|
||||
value_ = value;
|
||||
}
|
||||
void SetValue(int value) override { value_ = value; }
|
||||
|
||||
int GetOtherValue() override {
|
||||
return other_value_;
|
||||
}
|
||||
int GetOtherValue() override { return other_value_; }
|
||||
|
||||
void SetOtherValue(int value) override {
|
||||
other_value_ = value;
|
||||
}
|
||||
void SetOtherValue(int value) override { other_value_ = value; }
|
||||
|
||||
int GetOtherOtherValue() override {
|
||||
return other_other_value_;
|
||||
}
|
||||
int GetOtherOtherValue() override { return other_other_value_; }
|
||||
|
||||
void SetOtherOtherValue(int value) override {
|
||||
other_other_value_ = value;
|
||||
}
|
||||
void SetOtherOtherValue(int value) override { other_other_value_ = value; }
|
||||
|
||||
protected:
|
||||
int value_;
|
||||
@@ -246,70 +182,43 @@ class CefTranslatorTestScopedLibraryChildChildImpl :
|
||||
|
||||
// static
|
||||
CefOwnPtr<CefTranslatorTestScopedLibraryChildChild>
|
||||
CefTranslatorTestScopedLibraryChildChild::Create(
|
||||
int value,
|
||||
int other_value,
|
||||
int other_other_value) {
|
||||
CefTranslatorTestScopedLibraryChildChild::Create(int value,
|
||||
int other_value,
|
||||
int other_other_value) {
|
||||
return CefOwnPtr<CefTranslatorTestScopedLibraryChildChild>(
|
||||
new CefTranslatorTestScopedLibraryChildChildImpl(value, other_value,
|
||||
other_other_value));
|
||||
}
|
||||
|
||||
|
||||
class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
public:
|
||||
CefTranslatorTestImpl() {
|
||||
}
|
||||
CefTranslatorTestImpl() {}
|
||||
|
||||
// PRIMITIVE VALUES
|
||||
|
||||
void GetVoid() override {
|
||||
}
|
||||
void GetVoid() override {}
|
||||
|
||||
bool GetBool() override {
|
||||
return TEST_BOOL_VAL;
|
||||
}
|
||||
bool GetBool() override { return TEST_BOOL_VAL; }
|
||||
|
||||
int GetInt() override {
|
||||
return TEST_INT_VAL;
|
||||
}
|
||||
int GetInt() override { return TEST_INT_VAL; }
|
||||
|
||||
double GetDouble() override {
|
||||
return TEST_DOUBLE_VAL;
|
||||
}
|
||||
double GetDouble() override { return TEST_DOUBLE_VAL; }
|
||||
|
||||
long GetLong() override {
|
||||
return TEST_LONG_VAL;
|
||||
}
|
||||
long GetLong() override { return TEST_LONG_VAL; }
|
||||
|
||||
size_t GetSizet() override {
|
||||
return TEST_SIZET_VAL;
|
||||
}
|
||||
size_t GetSizet() override { return TEST_SIZET_VAL; }
|
||||
|
||||
bool SetVoid() override {
|
||||
return true;
|
||||
}
|
||||
bool SetVoid() override { return true; }
|
||||
|
||||
bool SetBool(bool val) override {
|
||||
return (val == TEST_BOOL_VAL);
|
||||
}
|
||||
bool SetBool(bool val) override { return (val == TEST_BOOL_VAL); }
|
||||
|
||||
bool SetInt(int val) override {
|
||||
return (val == TEST_INT_VAL);
|
||||
}
|
||||
bool SetInt(int val) override { return (val == TEST_INT_VAL); }
|
||||
|
||||
bool SetDouble(double val) override {
|
||||
return (val == TEST_DOUBLE_VAL);
|
||||
}
|
||||
bool SetDouble(double val) override { return (val == TEST_DOUBLE_VAL); }
|
||||
|
||||
bool SetLong(long val) override {
|
||||
return (val == TEST_LONG_VAL);
|
||||
}
|
||||
|
||||
bool SetSizet(size_t val) override {
|
||||
return (val == TEST_SIZET_VAL);
|
||||
}
|
||||
bool SetLong(long val) override { return (val == TEST_LONG_VAL); }
|
||||
|
||||
bool SetSizet(size_t val) override { return (val == TEST_SIZET_VAL); }
|
||||
|
||||
// PRIMITIVE LIST VALUES
|
||||
|
||||
@@ -328,33 +237,24 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t GetIntListSize() override {
|
||||
return 2U;
|
||||
}
|
||||
|
||||
size_t GetIntListSize() override { return 2U; }
|
||||
|
||||
// STRING VALUES
|
||||
|
||||
CefString GetString() override {
|
||||
return TEST_STRING_VAL;
|
||||
}
|
||||
CefString GetString() override { return TEST_STRING_VAL; }
|
||||
|
||||
bool SetString(const CefString& val) override {
|
||||
return (val.ToString() == TEST_STRING_VAL);
|
||||
}
|
||||
|
||||
void GetStringByRef(CefString& val) override {
|
||||
val = TEST_STRING_VAL;
|
||||
}
|
||||
|
||||
void GetStringByRef(CefString& val) override { val = TEST_STRING_VAL; }
|
||||
|
||||
// STRING LIST VALUES
|
||||
|
||||
bool SetStringList(const std::vector<CefString>& val) override {
|
||||
if (val.size() != 3U)
|
||||
return false;
|
||||
return val[0] == TEST_STRING_VAL &&
|
||||
val[1] == TEST_STRING_VAL2 &&
|
||||
return val[0] == TEST_STRING_VAL && val[1] == TEST_STRING_VAL2 &&
|
||||
val[2] == TEST_STRING_VAL3;
|
||||
}
|
||||
|
||||
@@ -367,7 +267,6 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// STRING MAP VALUES
|
||||
|
||||
bool SetStringMap(const StringMap& val) override {
|
||||
@@ -375,7 +274,7 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return false;
|
||||
|
||||
StringMap::const_iterator it;
|
||||
|
||||
|
||||
it = val.find(TEST_STRING_KEY);
|
||||
if (it == val.end() || it->second != TEST_STRING_VAL)
|
||||
return false;
|
||||
@@ -398,7 +297,6 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// STRING MULTIMAP VALUES
|
||||
|
||||
bool SetStringMultimap(
|
||||
@@ -407,7 +305,7 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return false;
|
||||
|
||||
StringMultimap::const_iterator it;
|
||||
|
||||
|
||||
it = val.find(TEST_STRING_KEY);
|
||||
if (it == val.end() || it->second != TEST_STRING_VAL)
|
||||
return false;
|
||||
@@ -430,12 +328,9 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// STRUCT VALUES
|
||||
|
||||
CefPoint GetPoint() override {
|
||||
return CefPoint(TEST_X_VAL, TEST_Y_VAL);
|
||||
}
|
||||
CefPoint GetPoint() override { return CefPoint(TEST_X_VAL, TEST_Y_VAL); }
|
||||
|
||||
bool SetPoint(const CefPoint& val) override {
|
||||
return val.x == TEST_X_VAL && val.y == TEST_Y_VAL;
|
||||
@@ -445,7 +340,6 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
val = CefPoint(TEST_X_VAL, TEST_Y_VAL);
|
||||
}
|
||||
|
||||
|
||||
// STRUCT LIST VALUES
|
||||
|
||||
bool SetPointList(const std::vector<CefPoint>& val) override {
|
||||
@@ -464,10 +358,7 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t GetPointListSize() override {
|
||||
return 2U;
|
||||
}
|
||||
|
||||
size_t GetPointListSize() override { return 2U; }
|
||||
|
||||
// LIBRARY-SIDE REFPTR VALUES
|
||||
|
||||
@@ -495,18 +386,19 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
// LIBRARY-SIDE REFPTR LIST VALUES
|
||||
|
||||
bool SetRefPtrLibraryList(
|
||||
const std::vector<CefRefPtr<CefTranslatorTestRefPtrLibrary> >& val,
|
||||
int val1, int val2) override {
|
||||
const std::vector<CefRefPtr<CefTranslatorTestRefPtrLibrary>>& val,
|
||||
int val1,
|
||||
int val2) override {
|
||||
if (val.size() != 2U)
|
||||
return false;
|
||||
return val[0]->GetValue() == val1 && val[1]->GetValue() == val2;
|
||||
}
|
||||
|
||||
bool GetRefPtrLibraryListByRef(RefPtrLibraryList& val, int val1,
|
||||
bool GetRefPtrLibraryListByRef(RefPtrLibraryList& val,
|
||||
int val1,
|
||||
int val2) override {
|
||||
if (val.size() != GetRefPtrLibraryListSize())
|
||||
return false;
|
||||
@@ -516,10 +408,7 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t GetRefPtrLibraryListSize() override {
|
||||
return 2U;
|
||||
}
|
||||
|
||||
size_t GetRefPtrLibraryListSize() override { return 2U; }
|
||||
|
||||
// CLIENT-SIDE REFPTR VALUES
|
||||
|
||||
@@ -542,12 +431,12 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
// CLIENT-SIDE REFPTR LIST VALUES
|
||||
|
||||
bool SetRefPtrClientList(
|
||||
const std::vector<CefRefPtr<CefTranslatorTestRefPtrClient> >& val,
|
||||
int val1, int val2) override {
|
||||
const std::vector<CefRefPtr<CefTranslatorTestRefPtrClient>>& val,
|
||||
int val1,
|
||||
int val2) override {
|
||||
if (val.size() != 2U)
|
||||
return false;
|
||||
return val[0]->GetValue() == val1 && val[1]->GetValue() == val2;
|
||||
@@ -565,10 +454,7 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t GetRefPtrClientListSize() override {
|
||||
return 2U;
|
||||
}
|
||||
|
||||
size_t GetRefPtrClientListSize() override { return 2U; }
|
||||
|
||||
// LIBRARY-SIDE OWNPTR VALUES
|
||||
|
||||
@@ -597,7 +483,6 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return CefOwnPtr<CefTranslatorTestScopedLibrary>(val.release());
|
||||
}
|
||||
|
||||
|
||||
// CLIENT-SIDE OWNPTR VALUES
|
||||
|
||||
int SetOwnPtrClient(CefOwnPtr<CefTranslatorTestScopedClient> val) override {
|
||||
@@ -619,7 +504,6 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return CefOwnPtr<CefTranslatorTestScopedClient>(val.release());
|
||||
}
|
||||
|
||||
|
||||
// LIBRARY-SIDE RAWPTR VALUES
|
||||
|
||||
int SetRawPtrLibrary(CefRawPtr<CefTranslatorTestScopedLibrary> val) override {
|
||||
@@ -631,18 +515,17 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return val->GetValue();
|
||||
}
|
||||
|
||||
|
||||
// LIBRARY-SIDE RAWPTR LIST VALUES
|
||||
|
||||
bool SetRawPtrLibraryList(
|
||||
const std::vector<CefRawPtr<CefTranslatorTestScopedLibrary> >& val,
|
||||
int val1, int val2) override {
|
||||
const std::vector<CefRawPtr<CefTranslatorTestScopedLibrary>>& val,
|
||||
int val1,
|
||||
int val2) override {
|
||||
if (val.size() != 2U)
|
||||
return false;
|
||||
return val[0]->GetValue() == val1 && val[1]->GetValue() == val2;
|
||||
}
|
||||
|
||||
|
||||
// CLIENT-SIDE RAWPTR VALUES
|
||||
|
||||
int SetRawPtrClient(CefRawPtr<CefTranslatorTestScopedClient> val) override {
|
||||
@@ -654,12 +537,12 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
|
||||
return val->GetValue();
|
||||
}
|
||||
|
||||
|
||||
// CLIENT-SIDE RAWPTR LIST VALUES
|
||||
|
||||
bool SetRawPtrClientList(
|
||||
const std::vector<CefRawPtr<CefTranslatorTestScopedClient> >& val,
|
||||
int val1, int val2) override {
|
||||
const std::vector<CefRawPtr<CefTranslatorTestScopedClient>>& val,
|
||||
int val1,
|
||||
int val2) override {
|
||||
if (val.size() != 2U)
|
||||
return false;
|
||||
return val[0]->GetValue() == val1 && val[1]->GetValue() == val2;
|
||||
|
@@ -41,16 +41,15 @@ CefRefPtr<CefThread> CefThread::CreateThread(
|
||||
return thread_impl;
|
||||
}
|
||||
|
||||
CefThreadImpl::CefThreadImpl()
|
||||
: thread_id_(kInvalidPlatformThreadId) {
|
||||
}
|
||||
CefThreadImpl::CefThreadImpl() : thread_id_(kInvalidPlatformThreadId) {}
|
||||
|
||||
CefThreadImpl::~CefThreadImpl() {
|
||||
if (thread_.get()) {
|
||||
if (!owner_task_runner_->RunsTasksOnCurrentThread()) {
|
||||
// Delete |thread_| on the correct thread.
|
||||
owner_task_runner_->PostTask(FROM_HERE,
|
||||
base::Bind(StopAndDestroy, base::Unretained(thread_.release())));
|
||||
owner_task_runner_->PostTask(
|
||||
FROM_HERE,
|
||||
base::Bind(StopAndDestroy, base::Unretained(thread_.release())));
|
||||
} else {
|
||||
StopAndDestroy(thread_.release());
|
||||
}
|
||||
|
@@ -2,11 +2,12 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_COMMON_THREAD_IMPL_H_
|
||||
#define CEF_LIBCEF_COMMON_THREAD_IMPL_H_
|
||||
#ifndef CEF_LIBCEF_COMMON_THREAD_IMPL_H_
|
||||
#define CEF_LIBCEF_COMMON_THREAD_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_thread.h"
|
||||
|
||||
#include "base/threading/thread.h"
|
||||
|
||||
class CefThreadImpl : public CefThread {
|
||||
|
@@ -6,8 +6,8 @@
|
||||
#define CEF_LIBCEF_COMMON_TIME_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/internal/cef_time.h"
|
||||
#include "base/time/time.h"
|
||||
#include "include/internal/cef_time.h"
|
||||
|
||||
// Converts cef_time_t to/from a base::Time object.
|
||||
void cef_time_to_basetime(const cef_time_t& cef_time, base::Time& time);
|
||||
|
@@ -6,13 +6,9 @@
|
||||
|
||||
// CefTrackNode implementation.
|
||||
|
||||
CefTrackNode::CefTrackNode()
|
||||
: track_next_(NULL),
|
||||
track_prev_(NULL) {
|
||||
}
|
||||
CefTrackNode::CefTrackNode() : track_next_(NULL), track_prev_(NULL) {}
|
||||
|
||||
CefTrackNode::~CefTrackNode() {
|
||||
}
|
||||
CefTrackNode::~CefTrackNode() {}
|
||||
|
||||
void CefTrackNode::InsertTrackPrev(CefTrackNode* object) {
|
||||
if (track_prev_)
|
||||
@@ -39,12 +35,9 @@ void CefTrackNode::RemoveTracking() {
|
||||
track_prev_ = NULL;
|
||||
}
|
||||
|
||||
|
||||
// CefTrackManager implementation.
|
||||
|
||||
CefTrackManager::CefTrackManager()
|
||||
: object_count_(0) {
|
||||
}
|
||||
CefTrackManager::CefTrackManager() : object_count_(0) {}
|
||||
|
||||
CefTrackManager::~CefTrackManager() {
|
||||
DeleteAll();
|
||||
|
@@ -2,8 +2,8 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_COMMON_TRACKER_H_
|
||||
#define CEF_LIBCEF_COMMON_TRACKER_H_
|
||||
#ifndef CEF_LIBCEF_COMMON_TRACKER_H_
|
||||
#define CEF_LIBCEF_COMMON_TRACKER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
@@ -13,9 +13,9 @@
|
||||
|
||||
// static
|
||||
CefRefPtr<CefURLRequest> CefURLRequest::Create(
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefURLRequestClient> client,
|
||||
CefRefPtr<CefRequestContext> request_context) {
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefURLRequestClient> client,
|
||||
CefRefPtr<CefRequestContext> request_context) {
|
||||
if (!request.get() || !client.get()) {
|
||||
NOTREACHED() << "called with invalid parameters";
|
||||
return NULL;
|
||||
|
@@ -29,7 +29,7 @@ base::FilePath GetFrameworksPath() {
|
||||
return base::FilePath();
|
||||
|
||||
return bundle_path.Append(FILE_PATH_LITERAL("Contents"))
|
||||
.Append(FILE_PATH_LITERAL("Frameworks"));
|
||||
.Append(FILE_PATH_LITERAL("Frameworks"));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -74,7 +74,7 @@ base::FilePath GetMainResourcesDirectory() {
|
||||
return base::FilePath();
|
||||
|
||||
return bundle_path.Append(FILE_PATH_LITERAL("Contents"))
|
||||
.Append(FILE_PATH_LITERAL("Resources"));
|
||||
.Append(FILE_PATH_LITERAL("Resources"));
|
||||
}
|
||||
|
||||
base::FilePath GetChildProcessPath() {
|
||||
@@ -84,9 +84,9 @@ base::FilePath GetChildProcessPath() {
|
||||
|
||||
std::string exe_name = GetMainProcessPath().BaseName().value();
|
||||
return frameworks_path.Append(FILE_PATH_LITERAL(exe_name + " Helper.app"))
|
||||
.Append(FILE_PATH_LITERAL("Contents"))
|
||||
.Append(FILE_PATH_LITERAL("MacOS"))
|
||||
.Append(FILE_PATH_LITERAL(exe_name + " Helper"));
|
||||
.Append(FILE_PATH_LITERAL("Contents"))
|
||||
.Append(FILE_PATH_LITERAL("MacOS"))
|
||||
.Append(FILE_PATH_LITERAL(exe_name + " Helper"));
|
||||
}
|
||||
|
||||
} // namespace util_mac
|
||||
|
@@ -4,11 +4,8 @@
|
||||
|
||||
#include "libcef/common/value_base.h"
|
||||
|
||||
|
||||
CefValueController::CefValueController()
|
||||
: owner_value_(NULL),
|
||||
owner_object_(NULL) {
|
||||
}
|
||||
: owner_value_(NULL), owner_object_(NULL) {}
|
||||
|
||||
CefValueController::~CefValueController() {
|
||||
// Everything should already have been removed.
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
|
||||
|
||||
// Controller implementation base class.
|
||||
class CefValueController
|
||||
: public base::RefCountedThreadSafe<CefValueController> {
|
||||
@@ -26,15 +25,14 @@ class CefValueController
|
||||
virtual ~Object() {}
|
||||
|
||||
// Called when the value has been removed.
|
||||
virtual void OnControlRemoved() =0;
|
||||
virtual void OnControlRemoved() = 0;
|
||||
};
|
||||
|
||||
// Encapsulates context locking and verification logic.
|
||||
class AutoLock {
|
||||
public:
|
||||
explicit AutoLock(CefValueController* impl)
|
||||
: impl_(impl),
|
||||
verified_(impl && impl->VerifyThread()) {
|
||||
: impl_(impl), verified_(impl && impl->VerifyThread()) {
|
||||
DCHECK(impl);
|
||||
if (verified_)
|
||||
impl_->lock();
|
||||
@@ -56,22 +54,22 @@ class CefValueController
|
||||
CefValueController();
|
||||
|
||||
// Returns true if this controller is thread safe.
|
||||
virtual bool thread_safe() =0;
|
||||
virtual bool thread_safe() = 0;
|
||||
|
||||
// Returns true if the current thread is allowed to access this controller.
|
||||
virtual bool on_correct_thread() =0;
|
||||
virtual bool on_correct_thread() = 0;
|
||||
|
||||
// Lock the controller.
|
||||
virtual void lock() =0;
|
||||
virtual void lock() = 0;
|
||||
|
||||
// Unlock the controller.
|
||||
virtual void unlock() =0;
|
||||
virtual void unlock() = 0;
|
||||
|
||||
// Returns true if the controller is locked on the current thread.
|
||||
virtual bool locked() =0;
|
||||
virtual bool locked() = 0;
|
||||
|
||||
// Assert that the lock has been acquired.
|
||||
virtual void AssertLockAcquired() =0;
|
||||
virtual void AssertLockAcquired() = 0;
|
||||
|
||||
// Verify that the current thread is correct for accessing the controller.
|
||||
inline bool VerifyThread() {
|
||||
@@ -139,8 +137,7 @@ class CefValueController
|
||||
// Thread-safe access control implementation.
|
||||
class CefValueControllerThreadSafe : public CefValueController {
|
||||
public:
|
||||
explicit CefValueControllerThreadSafe()
|
||||
: locked_thread_id_(0) {}
|
||||
explicit CefValueControllerThreadSafe() : locked_thread_id_(0) {}
|
||||
|
||||
// CefValueController methods.
|
||||
bool thread_safe() override { return true; }
|
||||
@@ -156,9 +153,7 @@ class CefValueControllerThreadSafe : public CefValueController {
|
||||
bool locked() override {
|
||||
return (locked_thread_id_ == base::PlatformThread::CurrentId());
|
||||
}
|
||||
void AssertLockAcquired() override {
|
||||
lock_.AssertAcquired();
|
||||
}
|
||||
void AssertLockAcquired() override { lock_.AssertAcquired(); }
|
||||
|
||||
private:
|
||||
base::Lock lock_;
|
||||
@@ -171,7 +166,7 @@ class CefValueControllerThreadSafe : public CefValueController {
|
||||
class CefValueControllerNonThreadSafe : public CefValueController {
|
||||
public:
|
||||
explicit CefValueControllerNonThreadSafe()
|
||||
: thread_id_(base::PlatformThread::CurrentId()) {}
|
||||
: thread_id_(base::PlatformThread::CurrentId()) {}
|
||||
|
||||
// CefValueController methods.
|
||||
bool thread_safe() override { return false; }
|
||||
@@ -181,9 +176,7 @@ class CefValueControllerNonThreadSafe : public CefValueController {
|
||||
void lock() override {}
|
||||
void unlock() override {}
|
||||
bool locked() override { return on_correct_thread(); }
|
||||
void AssertLockAcquired() override {
|
||||
DCHECK(locked());
|
||||
}
|
||||
void AssertLockAcquired() override { DCHECK(locked()); }
|
||||
|
||||
private:
|
||||
base::PlatformThreadId thread_id_;
|
||||
@@ -191,32 +184,30 @@ class CefValueControllerNonThreadSafe : public CefValueController {
|
||||
DISALLOW_COPY_AND_ASSIGN(CefValueControllerNonThreadSafe);
|
||||
};
|
||||
|
||||
|
||||
// Helper macros for verifying context.
|
||||
|
||||
#define CEF_VALUE_VERIFY_RETURN_VOID_EX(object, modify) \
|
||||
if (!VerifyAttached()) \
|
||||
return; \
|
||||
AutoLock auto_lock(object, modify); \
|
||||
if (!auto_lock.verified()) \
|
||||
return;
|
||||
if (!VerifyAttached()) \
|
||||
return; \
|
||||
AutoLock auto_lock(object, modify); \
|
||||
if (!auto_lock.verified()) \
|
||||
return;
|
||||
|
||||
#define CEF_VALUE_VERIFY_RETURN_VOID(modify) \
|
||||
CEF_VALUE_VERIFY_RETURN_VOID_EX(this, modify)
|
||||
CEF_VALUE_VERIFY_RETURN_VOID_EX(this, modify)
|
||||
|
||||
#define CEF_VALUE_VERIFY_RETURN_EX(object, modify, error_val) \
|
||||
if (!VerifyAttached()) \
|
||||
return error_val; \
|
||||
AutoLock auto_lock(object, modify); \
|
||||
if (!auto_lock.verified()) \
|
||||
return error_val;
|
||||
if (!VerifyAttached()) \
|
||||
return error_val; \
|
||||
AutoLock auto_lock(object, modify); \
|
||||
if (!auto_lock.verified()) \
|
||||
return error_val;
|
||||
|
||||
#define CEF_VALUE_VERIFY_RETURN(modify, error_val) \
|
||||
CEF_VALUE_VERIFY_RETURN_EX(this, modify, error_val)
|
||||
|
||||
CEF_VALUE_VERIFY_RETURN_EX(this, modify, error_val)
|
||||
|
||||
// Template class for implementing CEF wrappers of other types.
|
||||
template<class CefType, class ValueType>
|
||||
template <class CefType, class ValueType>
|
||||
class CefValueBase : public CefType, public CefValueController::Object {
|
||||
public:
|
||||
// Specifies how the value will be used.
|
||||
@@ -246,10 +237,10 @@ class CefValueBase : public CefType, public CefValueController::Object {
|
||||
ValueMode value_mode,
|
||||
bool read_only,
|
||||
CefValueController* controller)
|
||||
: value_(value),
|
||||
value_mode_(value_mode),
|
||||
read_only_(read_only),
|
||||
controller_(controller) {
|
||||
: value_(value),
|
||||
value_mode_(value_mode),
|
||||
read_only_(read_only),
|
||||
controller_(controller) {
|
||||
DCHECK(value_);
|
||||
|
||||
// Specifying a parent value for a non-reference doesn't make sense.
|
||||
@@ -404,7 +395,7 @@ class CefValueBase : public CefType, public CefValueController::Object {
|
||||
class AutoLock {
|
||||
public:
|
||||
explicit AutoLock(CefValueBase* impl, bool modify)
|
||||
: auto_lock_(impl->controller()) {
|
||||
: auto_lock_(impl->controller()) {
|
||||
verified_ = (auto_lock_.verified() && impl->VerifyAccess(modify));
|
||||
}
|
||||
|
||||
@@ -428,5 +419,4 @@ class CefValueBase : public CefType, public CefValueController::Object {
|
||||
DISALLOW_COPY_AND_ASSIGN(CefValueBase);
|
||||
};
|
||||
|
||||
|
||||
#endif // CEF_LIBCEF_COMMON_VALUE_BASE_H_
|
||||
|
@@ -25,8 +25,8 @@ CefRefPtr<CefValue> CefValueImpl::GetOrCreateRefOrCopy(
|
||||
DCHECK(value);
|
||||
|
||||
if (value->IsType(base::Value::Type::BINARY)) {
|
||||
return new CefValueImpl(CefBinaryValueImpl::GetOrCreateRef(
|
||||
value, parent_value, controller));
|
||||
return new CefValueImpl(
|
||||
CefBinaryValueImpl::GetOrCreateRef(value, parent_value, controller));
|
||||
}
|
||||
|
||||
if (value->IsType(base::Value::Type::DICTIONARY)) {
|
||||
@@ -45,27 +45,22 @@ CefRefPtr<CefValue> CefValueImpl::GetOrCreateRefOrCopy(
|
||||
return new CefValueImpl(value->DeepCopy());
|
||||
}
|
||||
|
||||
CefValueImpl::CefValueImpl() {
|
||||
}
|
||||
CefValueImpl::CefValueImpl() {}
|
||||
|
||||
CefValueImpl::CefValueImpl(base::Value* value) {
|
||||
SetValue(value);
|
||||
}
|
||||
|
||||
CefValueImpl::CefValueImpl(CefRefPtr<CefBinaryValue> value)
|
||||
: binary_value_(value) {
|
||||
}
|
||||
: binary_value_(value) {}
|
||||
|
||||
CefValueImpl::CefValueImpl(CefRefPtr<CefDictionaryValue> value)
|
||||
: dictionary_value_(value) {
|
||||
}
|
||||
: dictionary_value_(value) {}
|
||||
|
||||
CefValueImpl::CefValueImpl(CefRefPtr<CefListValue> value)
|
||||
: list_value_(value) {
|
||||
}
|
||||
: list_value_(value) {}
|
||||
|
||||
CefValueImpl::~CefValueImpl() {
|
||||
}
|
||||
CefValueImpl::~CefValueImpl() {}
|
||||
|
||||
void CefValueImpl::SetValue(base::Value* value) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
@@ -77,27 +72,26 @@ base::Value* CefValueImpl::CopyOrDetachValue(
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
if (binary_value_) {
|
||||
return static_cast<CefBinaryValueImpl*>(binary_value_.get())->
|
||||
CopyOrDetachValue(new_controller);
|
||||
return static_cast<CefBinaryValueImpl*>(binary_value_.get())
|
||||
->CopyOrDetachValue(new_controller);
|
||||
}
|
||||
|
||||
if (dictionary_value_) {
|
||||
return static_cast<CefDictionaryValueImpl*>(dictionary_value_.get())->
|
||||
CopyOrDetachValue(new_controller);
|
||||
return static_cast<CefDictionaryValueImpl*>(dictionary_value_.get())
|
||||
->CopyOrDetachValue(new_controller);
|
||||
}
|
||||
|
||||
if (list_value_) {
|
||||
return static_cast<CefListValueImpl*>(list_value_.get())->
|
||||
CopyOrDetachValue(new_controller);
|
||||
return static_cast<CefListValueImpl*>(list_value_.get())
|
||||
->CopyOrDetachValue(new_controller);
|
||||
}
|
||||
|
||||
return value_->DeepCopy();
|
||||
}
|
||||
|
||||
void CefValueImpl::SwapValue(
|
||||
base::Value* new_value,
|
||||
void* new_parent_value,
|
||||
CefValueController* new_controller) {
|
||||
void CefValueImpl::SwapValue(base::Value* new_value,
|
||||
void* new_parent_value,
|
||||
CefValueController* new_controller) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
if (binary_value_) {
|
||||
@@ -105,12 +99,12 @@ void CefValueImpl::SwapValue(
|
||||
new_value, new_parent_value, new_controller);
|
||||
} else if (dictionary_value_) {
|
||||
dictionary_value_ = CefDictionaryValueImpl::GetOrCreateRef(
|
||||
static_cast<base::DictionaryValue*>(new_value), new_parent_value,
|
||||
false, new_controller);
|
||||
static_cast<base::DictionaryValue*>(new_value), new_parent_value, false,
|
||||
new_controller);
|
||||
} else if (list_value_) {
|
||||
list_value_ = CefListValueImpl::GetOrCreateRef(
|
||||
static_cast<base::ListValue*>(new_value), new_parent_value,
|
||||
false, new_controller);
|
||||
static_cast<base::ListValue*>(new_value), new_parent_value, false,
|
||||
new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,8 +354,8 @@ void CefValueImpl::SetValueInternal(base::Value* value) {
|
||||
static_cast<base::DictionaryValue*>(value), true, false);
|
||||
return;
|
||||
case base::Value::Type::LIST:
|
||||
list_value_ = new CefListValueImpl(
|
||||
static_cast<base::ListValue*>(value), true, false);
|
||||
list_value_ = new CefListValueImpl(static_cast<base::ListValue*>(value),
|
||||
true, false);
|
||||
return;
|
||||
default:
|
||||
value_.reset(value);
|
||||
@@ -375,8 +369,8 @@ CefValueController* CefValueImpl::GetValueController() const {
|
||||
if (binary_value_) {
|
||||
return static_cast<CefBinaryValueImpl*>(binary_value_.get())->controller();
|
||||
} else if (dictionary_value_) {
|
||||
return static_cast<CefDictionaryValueImpl*>(dictionary_value_.get())->
|
||||
controller();
|
||||
return static_cast<CefDictionaryValueImpl*>(dictionary_value_.get())
|
||||
->controller();
|
||||
} else if (list_value_) {
|
||||
return static_cast<CefListValueImpl*>(list_value_.get())->controller();
|
||||
}
|
||||
@@ -406,11 +400,11 @@ base::Value* CefValueImpl::GetValueUnsafe() const {
|
||||
lock_.AssertAcquired();
|
||||
|
||||
if (binary_value_) {
|
||||
return static_cast<CefBinaryValueImpl*>(binary_value_.get())->
|
||||
GetValueUnsafe();
|
||||
return static_cast<CefBinaryValueImpl*>(binary_value_.get())
|
||||
->GetValueUnsafe();
|
||||
} else if (dictionary_value_) {
|
||||
return static_cast<CefDictionaryValueImpl*>(dictionary_value_.get())->
|
||||
GetValueUnsafe();
|
||||
return static_cast<CefDictionaryValueImpl*>(dictionary_value_.get())
|
||||
->GetValueUnsafe();
|
||||
} else if (list_value_) {
|
||||
return static_cast<CefListValueImpl*>(list_value_.get())->GetValueUnsafe();
|
||||
}
|
||||
@@ -418,7 +412,6 @@ base::Value* CefValueImpl::GetValueUnsafe() const {
|
||||
return value_.get();
|
||||
}
|
||||
|
||||
|
||||
// CefBinaryValueImpl implementation.
|
||||
|
||||
CefRefPtr<CefBinaryValue> CefBinaryValue::Create(const void* data,
|
||||
@@ -429,14 +422,14 @@ CefRefPtr<CefBinaryValue> CefBinaryValue::Create(const void* data,
|
||||
return NULL;
|
||||
|
||||
return new CefBinaryValueImpl(static_cast<char*>(const_cast<void*>(data)),
|
||||
data_size);
|
||||
data_size);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefBinaryValue> CefBinaryValueImpl::GetOrCreateRef(
|
||||
base::Value* value,
|
||||
void* parent_value,
|
||||
CefValueController* controller) {
|
||||
base::Value* value,
|
||||
void* parent_value,
|
||||
CefValueController* controller) {
|
||||
DCHECK(value);
|
||||
DCHECK(parent_value);
|
||||
DCHECK(controller);
|
||||
@@ -446,22 +439,24 @@ CefRefPtr<CefBinaryValue> CefBinaryValueImpl::GetOrCreateRef(
|
||||
return static_cast<CefBinaryValueImpl*>(object);
|
||||
|
||||
return new CefBinaryValueImpl(value, parent_value,
|
||||
CefBinaryValueImpl::kReference, controller);
|
||||
CefBinaryValueImpl::kReference, controller);
|
||||
}
|
||||
|
||||
CefBinaryValueImpl::CefBinaryValueImpl(base::Value* value,
|
||||
bool will_delete)
|
||||
: CefValueBase<CefBinaryValue, base::Value>(
|
||||
value, NULL, will_delete ? kOwnerWillDelete : kOwnerNoDelete,
|
||||
true, NULL) {
|
||||
}
|
||||
CefBinaryValueImpl::CefBinaryValueImpl(base::Value* value, bool will_delete)
|
||||
: CefValueBase<CefBinaryValue, base::Value>(
|
||||
value,
|
||||
NULL,
|
||||
will_delete ? kOwnerWillDelete : kOwnerNoDelete,
|
||||
true,
|
||||
NULL) {}
|
||||
|
||||
CefBinaryValueImpl::CefBinaryValueImpl(char* data,
|
||||
size_t data_size)
|
||||
: CefValueBase<CefBinaryValue, base::Value>(
|
||||
new base::Value(std::vector<char>(data, data + data_size)),
|
||||
NULL, kOwnerWillDelete, true, NULL) {
|
||||
}
|
||||
CefBinaryValueImpl::CefBinaryValueImpl(char* data, size_t data_size)
|
||||
: CefValueBase<CefBinaryValue, base::Value>(
|
||||
new base::Value(std::vector<char>(data, data + data_size)),
|
||||
NULL,
|
||||
kOwnerWillDelete,
|
||||
true,
|
||||
NULL) {}
|
||||
|
||||
base::Value* CefBinaryValueImpl::CopyValue() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, NULL);
|
||||
@@ -516,8 +511,8 @@ bool CefBinaryValueImpl::IsSame(CefRefPtr<CefBinaryValue> that) {
|
||||
return true;
|
||||
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
return static_cast<CefBinaryValueImpl*>(that.get())->
|
||||
IsSameValue(&const_value());
|
||||
return static_cast<CefBinaryValueImpl*>(that.get())
|
||||
->IsSameValue(&const_value());
|
||||
}
|
||||
|
||||
bool CefBinaryValueImpl::IsEqual(CefRefPtr<CefBinaryValue> that) {
|
||||
@@ -527,14 +522,14 @@ bool CefBinaryValueImpl::IsEqual(CefRefPtr<CefBinaryValue> that) {
|
||||
return true;
|
||||
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
return static_cast<CefBinaryValueImpl*>(that.get())->
|
||||
IsEqualValue(&const_value());
|
||||
return static_cast<CefBinaryValueImpl*>(that.get())
|
||||
->IsEqualValue(&const_value());
|
||||
}
|
||||
|
||||
CefRefPtr<CefBinaryValue> CefBinaryValueImpl::Copy() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, NULL);
|
||||
return new CefBinaryValueImpl(const_value().DeepCopy(), NULL,
|
||||
CefBinaryValueImpl::kOwnerWillDelete, NULL);
|
||||
CefBinaryValueImpl::kOwnerWillDelete, NULL);
|
||||
}
|
||||
|
||||
size_t CefBinaryValueImpl::GetSize() {
|
||||
@@ -557,9 +552,9 @@ size_t CefBinaryValueImpl::GetData(void* buffer,
|
||||
if (data_offset >= size)
|
||||
return 0;
|
||||
|
||||
size = std::min(buffer_size, size-data_offset);
|
||||
size = std::min(buffer_size, size - data_offset);
|
||||
const char* data = const_value().GetBuffer();
|
||||
memcpy(buffer, data+data_offset, size);
|
||||
memcpy(buffer, data + data_offset, size);
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -567,10 +562,11 @@ CefBinaryValueImpl::CefBinaryValueImpl(base::Value* value,
|
||||
void* parent_value,
|
||||
ValueMode value_mode,
|
||||
CefValueController* controller)
|
||||
: CefValueBase<CefBinaryValue, base::Value>(
|
||||
value, parent_value, value_mode, true, controller) {
|
||||
}
|
||||
|
||||
: CefValueBase<CefBinaryValue, base::Value>(value,
|
||||
parent_value,
|
||||
value_mode,
|
||||
true,
|
||||
controller) {}
|
||||
|
||||
// CefDictionaryValueImpl implementation.
|
||||
|
||||
@@ -590,16 +586,19 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::GetOrCreateRef(
|
||||
return static_cast<CefDictionaryValueImpl*>(object);
|
||||
|
||||
return new CefDictionaryValueImpl(value, parent_value,
|
||||
CefDictionaryValueImpl::kReference, read_only, controller);
|
||||
CefDictionaryValueImpl::kReference,
|
||||
read_only, controller);
|
||||
}
|
||||
|
||||
CefDictionaryValueImpl::CefDictionaryValueImpl(base::DictionaryValue* value,
|
||||
bool will_delete,
|
||||
bool read_only)
|
||||
: CefValueBase<CefDictionaryValue, base::DictionaryValue>(
|
||||
value, NULL, will_delete ? kOwnerWillDelete : kOwnerNoDelete,
|
||||
read_only, NULL) {
|
||||
}
|
||||
: CefValueBase<CefDictionaryValue, base::DictionaryValue>(
|
||||
value,
|
||||
NULL,
|
||||
will_delete ? kOwnerWillDelete : kOwnerNoDelete,
|
||||
read_only,
|
||||
NULL) {}
|
||||
|
||||
base::DictionaryValue* CefDictionaryValueImpl::CopyValue() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, NULL);
|
||||
@@ -658,8 +657,8 @@ bool CefDictionaryValueImpl::IsSame(CefRefPtr<CefDictionaryValue> that) {
|
||||
return true;
|
||||
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
return static_cast<CefDictionaryValueImpl*>(that.get())->
|
||||
IsSameValue(&const_value());
|
||||
return static_cast<CefDictionaryValueImpl*>(that.get())
|
||||
->IsSameValue(&const_value());
|
||||
}
|
||||
|
||||
bool CefDictionaryValueImpl::IsEqual(CefRefPtr<CefDictionaryValue> that) {
|
||||
@@ -669,8 +668,8 @@ bool CefDictionaryValueImpl::IsEqual(CefRefPtr<CefDictionaryValue> that) {
|
||||
return true;
|
||||
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
return static_cast<CefDictionaryValueImpl*>(that.get())->
|
||||
IsEqualValue(&const_value());
|
||||
return static_cast<CefDictionaryValueImpl*>(that.get())
|
||||
->IsEqualValue(&const_value());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::Copy(
|
||||
@@ -679,14 +678,15 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::Copy(
|
||||
|
||||
base::DictionaryValue* value;
|
||||
if (exclude_empty_children) {
|
||||
value = const_cast<base::DictionaryValue&>(
|
||||
const_value()).DeepCopyWithoutEmptyChildren().release();
|
||||
value = const_cast<base::DictionaryValue&>(const_value())
|
||||
.DeepCopyWithoutEmptyChildren()
|
||||
.release();
|
||||
} else {
|
||||
value = const_value().DeepCopy();
|
||||
}
|
||||
|
||||
return new CefDictionaryValueImpl(value, NULL,
|
||||
CefDictionaryValueImpl::kOwnerWillDelete, false, NULL);
|
||||
return new CefDictionaryValueImpl(
|
||||
value, NULL, CefDictionaryValueImpl::kOwnerWillDelete, false, NULL);
|
||||
}
|
||||
|
||||
size_t CefDictionaryValueImpl::GetSize() {
|
||||
@@ -712,8 +712,8 @@ bool CefDictionaryValueImpl::HasKey(const CefString& key) {
|
||||
bool CefDictionaryValueImpl::GetKeys(KeyList& keys) {
|
||||
CEF_VALUE_VERIFY_RETURN(false, 0);
|
||||
|
||||
for (base::DictionaryValue::Iterator i(const_value());
|
||||
!i.IsAtEnd(); i.Advance()) {
|
||||
for (base::DictionaryValue::Iterator i(const_value()); !i.IsAtEnd();
|
||||
i.Advance()) {
|
||||
keys.push_back(i.key());
|
||||
}
|
||||
|
||||
@@ -762,8 +762,7 @@ CefRefPtr<CefValue> CefDictionaryValueImpl::GetValue(const CefString& key) {
|
||||
&out_value)) {
|
||||
return CefValueImpl::GetOrCreateRefOrCopy(
|
||||
const_cast<base::Value*>(out_value),
|
||||
const_cast<base::DictionaryValue*>(&const_value()),
|
||||
read_only(),
|
||||
const_cast<base::DictionaryValue*>(&const_value()), read_only(),
|
||||
controller());
|
||||
}
|
||||
|
||||
@@ -828,8 +827,9 @@ CefRefPtr<CefBinaryValue> CefDictionaryValueImpl::GetBinary(
|
||||
&out_value) &&
|
||||
out_value->IsType(base::Value::Type::BINARY)) {
|
||||
base::Value* binary_value = const_cast<base::Value*>(out_value);
|
||||
return CefBinaryValueImpl::GetOrCreateRef(binary_value,
|
||||
const_cast<base::DictionaryValue*>(&const_value()), controller());
|
||||
return CefBinaryValueImpl::GetOrCreateRef(
|
||||
binary_value, const_cast<base::DictionaryValue*>(&const_value()),
|
||||
controller());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -844,14 +844,11 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::GetDictionary(
|
||||
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
|
||||
&out_value) &&
|
||||
out_value->IsType(base::Value::Type::DICTIONARY)) {
|
||||
base::DictionaryValue* dict_value =
|
||||
static_cast<base::DictionaryValue*>(
|
||||
const_cast<base::Value*>(out_value));
|
||||
base::DictionaryValue* dict_value = static_cast<base::DictionaryValue*>(
|
||||
const_cast<base::Value*>(out_value));
|
||||
return CefDictionaryValueImpl::GetOrCreateRef(
|
||||
dict_value,
|
||||
const_cast<base::DictionaryValue*>(&const_value()),
|
||||
read_only(),
|
||||
controller());
|
||||
dict_value, const_cast<base::DictionaryValue*>(&const_value()),
|
||||
read_only(), controller());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -868,10 +865,8 @@ CefRefPtr<CefListValue> CefDictionaryValueImpl::GetList(const CefString& key) {
|
||||
base::ListValue* list_value =
|
||||
static_cast<base::ListValue*>(const_cast<base::Value*>(out_value));
|
||||
return CefListValueImpl::GetOrCreateRef(
|
||||
list_value,
|
||||
const_cast<base::DictionaryValue*>(&const_value()),
|
||||
read_only(),
|
||||
controller());
|
||||
list_value, const_cast<base::DictionaryValue*>(&const_value()),
|
||||
read_only(), controller());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -910,7 +905,7 @@ bool CefDictionaryValueImpl::SetInt(const CefString& key, int value) {
|
||||
|
||||
bool CefDictionaryValueImpl::SetDouble(const CefString& key, double value) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
SetInternal(key, new base::Value(value));
|
||||
SetInternal(key, new base::Value(value));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -933,7 +928,8 @@ bool CefDictionaryValueImpl::SetBinary(const CefString& key,
|
||||
}
|
||||
|
||||
bool CefDictionaryValueImpl::SetDictionary(
|
||||
const CefString& key, CefRefPtr<CefDictionaryValue> value) {
|
||||
const CefString& key,
|
||||
CefRefPtr<CefDictionaryValue> value) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
|
||||
CefDictionaryValueImpl* impl =
|
||||
@@ -982,16 +978,16 @@ base::Value* CefDictionaryValueImpl::SetInternal(const CefString& key,
|
||||
return value;
|
||||
}
|
||||
|
||||
CefDictionaryValueImpl::CefDictionaryValueImpl(
|
||||
base::DictionaryValue* value,
|
||||
void* parent_value,
|
||||
ValueMode value_mode,
|
||||
bool read_only,
|
||||
CefValueController* controller)
|
||||
: CefValueBase<CefDictionaryValue, base::DictionaryValue>(
|
||||
value, parent_value, value_mode, read_only, controller) {
|
||||
}
|
||||
|
||||
CefDictionaryValueImpl::CefDictionaryValueImpl(base::DictionaryValue* value,
|
||||
void* parent_value,
|
||||
ValueMode value_mode,
|
||||
bool read_only,
|
||||
CefValueController* controller)
|
||||
: CefValueBase<CefDictionaryValue, base::DictionaryValue>(value,
|
||||
parent_value,
|
||||
value_mode,
|
||||
read_only,
|
||||
controller) {}
|
||||
|
||||
// CefListValueImpl implementation.
|
||||
|
||||
@@ -1010,17 +1006,19 @@ CefRefPtr<CefListValue> CefListValueImpl::GetOrCreateRef(
|
||||
if (object)
|
||||
return static_cast<CefListValueImpl*>(object);
|
||||
|
||||
return new CefListValueImpl(value, parent_value,
|
||||
CefListValueImpl::kReference, read_only, controller);
|
||||
return new CefListValueImpl(value, parent_value, CefListValueImpl::kReference,
|
||||
read_only, controller);
|
||||
}
|
||||
|
||||
CefListValueImpl::CefListValueImpl(base::ListValue* value,
|
||||
bool will_delete,
|
||||
bool read_only)
|
||||
: CefValueBase<CefListValue, base::ListValue>(
|
||||
value, NULL, will_delete ? kOwnerWillDelete : kOwnerNoDelete,
|
||||
read_only, NULL) {
|
||||
}
|
||||
: CefValueBase<CefListValue, base::ListValue>(
|
||||
value,
|
||||
NULL,
|
||||
will_delete ? kOwnerWillDelete : kOwnerNoDelete,
|
||||
read_only,
|
||||
NULL) {}
|
||||
|
||||
base::ListValue* CefListValueImpl::CopyValue() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, NULL);
|
||||
@@ -1079,8 +1077,8 @@ bool CefListValueImpl::IsSame(CefRefPtr<CefListValue> that) {
|
||||
return true;
|
||||
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
return static_cast<CefListValueImpl*>(that.get())->
|
||||
IsSameValue(&const_value());
|
||||
return static_cast<CefListValueImpl*>(that.get())
|
||||
->IsSameValue(&const_value());
|
||||
}
|
||||
|
||||
bool CefListValueImpl::IsEqual(CefRefPtr<CefListValue> that) {
|
||||
@@ -1090,15 +1088,15 @@ bool CefListValueImpl::IsEqual(CefRefPtr<CefListValue> that) {
|
||||
return true;
|
||||
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
return static_cast<CefListValueImpl*>(that.get())->
|
||||
IsEqualValue(&const_value());
|
||||
return static_cast<CefListValueImpl*>(that.get())
|
||||
->IsEqualValue(&const_value());
|
||||
}
|
||||
|
||||
CefRefPtr<CefListValue> CefListValueImpl::Copy() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, NULL);
|
||||
|
||||
return new CefListValueImpl(const_value().DeepCopy(), NULL,
|
||||
CefListValueImpl::kOwnerWillDelete, false, NULL);
|
||||
CefListValueImpl::kOwnerWillDelete, false, NULL);
|
||||
}
|
||||
|
||||
bool CefListValueImpl::SetSize(size_t size) {
|
||||
@@ -1107,11 +1105,11 @@ bool CefListValueImpl::SetSize(size_t size) {
|
||||
size_t current_size = const_value().GetSize();
|
||||
if (size < current_size) {
|
||||
// Clean up any values above the requested size.
|
||||
for (size_t i = current_size-1; i >= size; --i)
|
||||
RemoveInternal(i);
|
||||
for (size_t i = current_size - 1; i >= size; --i)
|
||||
RemoveInternal(i);
|
||||
} else if (size > 0) {
|
||||
// Expand the list size.
|
||||
mutable_value()->Set(size-1, base::MakeUnique<base::Value>());
|
||||
mutable_value()->Set(size - 1, base::MakeUnique<base::Value>());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1171,8 +1169,7 @@ CefRefPtr<CefValue> CefListValueImpl::GetValue(size_t index) {
|
||||
if (const_value().Get(index, &out_value)) {
|
||||
return CefValueImpl::GetOrCreateRefOrCopy(
|
||||
const_cast<base::Value*>(out_value),
|
||||
const_cast<base::ListValue*>(&const_value()),
|
||||
read_only(),
|
||||
const_cast<base::ListValue*>(&const_value()), read_only(),
|
||||
controller());
|
||||
}
|
||||
|
||||
@@ -1235,8 +1232,9 @@ CefRefPtr<CefBinaryValue> CefListValueImpl::GetBinary(size_t index) {
|
||||
if (const_value().Get(index, &out_value) &&
|
||||
out_value->IsType(base::Value::Type::BINARY)) {
|
||||
base::Value* binary_value = const_cast<base::Value*>(out_value);
|
||||
return CefBinaryValueImpl::GetOrCreateRef(binary_value,
|
||||
const_cast<base::ListValue*>(&const_value()), controller());
|
||||
return CefBinaryValueImpl::GetOrCreateRef(
|
||||
binary_value, const_cast<base::ListValue*>(&const_value()),
|
||||
controller());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1249,13 +1247,10 @@ CefRefPtr<CefDictionaryValue> CefListValueImpl::GetDictionary(size_t index) {
|
||||
|
||||
if (const_value().Get(index, &out_value) &&
|
||||
out_value->IsType(base::Value::Type::DICTIONARY)) {
|
||||
base::DictionaryValue* dict_value =
|
||||
static_cast<base::DictionaryValue*>(
|
||||
const_cast<base::Value*>(out_value));
|
||||
base::DictionaryValue* dict_value = static_cast<base::DictionaryValue*>(
|
||||
const_cast<base::Value*>(out_value));
|
||||
return CefDictionaryValueImpl::GetOrCreateRef(
|
||||
dict_value,
|
||||
const_cast<base::ListValue*>(&const_value()),
|
||||
read_only(),
|
||||
dict_value, const_cast<base::ListValue*>(&const_value()), read_only(),
|
||||
controller());
|
||||
}
|
||||
|
||||
@@ -1272,9 +1267,7 @@ CefRefPtr<CefListValue> CefListValueImpl::GetList(size_t index) {
|
||||
base::ListValue* list_value =
|
||||
static_cast<base::ListValue*>(const_cast<base::Value*>(out_value));
|
||||
return CefListValueImpl::GetOrCreateRef(
|
||||
list_value,
|
||||
const_cast<base::ListValue*>(&const_value()),
|
||||
read_only(),
|
||||
list_value, const_cast<base::ListValue*>(&const_value()), read_only(),
|
||||
controller());
|
||||
}
|
||||
|
||||
@@ -1323,7 +1316,8 @@ bool CefListValueImpl::SetString(size_t index, const CefString& value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefListValueImpl::SetBinary(size_t index, CefRefPtr<CefBinaryValue> value) {
|
||||
bool CefListValueImpl::SetBinary(size_t index,
|
||||
CefRefPtr<CefBinaryValue> value) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
|
||||
CefBinaryValueImpl* impl = static_cast<CefBinaryValueImpl*>(value.get());
|
||||
@@ -1404,12 +1398,13 @@ base::Value* CefListValueImpl::SetInternal(size_t index, base::Value* value) {
|
||||
return const_cast<base::Value*>(actual_value);
|
||||
}
|
||||
|
||||
CefListValueImpl::CefListValueImpl(
|
||||
base::ListValue* value,
|
||||
void* parent_value,
|
||||
ValueMode value_mode,
|
||||
bool read_only,
|
||||
CefValueController* controller)
|
||||
: CefValueBase<CefListValue, base::ListValue>(
|
||||
value, parent_value, value_mode, read_only, controller) {
|
||||
}
|
||||
CefListValueImpl::CefListValueImpl(base::ListValue* value,
|
||||
void* parent_value,
|
||||
ValueMode value_mode,
|
||||
bool read_only,
|
||||
CefValueController* controller)
|
||||
: CefValueBase<CefListValue, base::ListValue>(value,
|
||||
parent_value,
|
||||
value_mode,
|
||||
read_only,
|
||||
controller) {}
|
||||
|
@@ -11,14 +11,13 @@
|
||||
#include "include/cef_values.h"
|
||||
#include "libcef/common/value_base.h"
|
||||
|
||||
#include "base/values.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
|
||||
#include "base/values.h"
|
||||
|
||||
// CefValue implementation
|
||||
class CefValueImpl : public CefValue {
|
||||
public:
|
||||
// Get or create a reference to a complex value or copy a simple value.
|
||||
// Get or create a reference to a complex value or copy a simple value.
|
||||
static CefRefPtr<CefValue> GetOrCreateRefOrCopy(
|
||||
base::Value* value,
|
||||
void* parent_value,
|
||||
@@ -83,17 +82,12 @@ class CefValueImpl : public CefValue {
|
||||
// object.
|
||||
class ScopedLockedValue {
|
||||
public:
|
||||
explicit ScopedLockedValue(CefRefPtr<CefValueImpl> impl)
|
||||
: impl_(impl) {
|
||||
explicit ScopedLockedValue(CefRefPtr<CefValueImpl> impl) : impl_(impl) {
|
||||
impl_->AcquireLock();
|
||||
}
|
||||
~ScopedLockedValue() {
|
||||
impl_->ReleaseLock();
|
||||
}
|
||||
~ScopedLockedValue() { impl_->ReleaseLock(); }
|
||||
|
||||
base::Value* value() const {
|
||||
return impl_->GetValueUnsafe();
|
||||
}
|
||||
base::Value* value() const { return impl_->GetValueUnsafe(); }
|
||||
|
||||
private:
|
||||
CefRefPtr<CefValueImpl> impl_;
|
||||
@@ -125,10 +119,8 @@ class CefValueImpl : public CefValue {
|
||||
DISALLOW_COPY_AND_ASSIGN(CefValueImpl);
|
||||
};
|
||||
|
||||
|
||||
// CefBinaryValue implementation
|
||||
class CefBinaryValueImpl
|
||||
: public CefValueBase<CefBinaryValue, base::Value> {
|
||||
class CefBinaryValueImpl : public CefValueBase<CefBinaryValue, base::Value> {
|
||||
public:
|
||||
// Get or create a reference value.
|
||||
static CefRefPtr<CefBinaryValue> GetOrCreateRef(
|
||||
@@ -142,12 +134,10 @@ class CefBinaryValueImpl
|
||||
// longer valid. Use GetOrCreateRef instead of this constructor if |value| is
|
||||
// owned by some other object and you do not plan to explicitly call
|
||||
// Detach(NULL).
|
||||
CefBinaryValueImpl(base::Value* value,
|
||||
bool will_delete);
|
||||
CefBinaryValueImpl(base::Value* value, bool will_delete);
|
||||
|
||||
// The data will always be copied.
|
||||
CefBinaryValueImpl(char* data,
|
||||
size_t data_size);
|
||||
CefBinaryValueImpl(char* data, size_t data_size);
|
||||
|
||||
// Return a copy of the value.
|
||||
base::Value* CopyValue();
|
||||
@@ -170,9 +160,7 @@ class CefBinaryValueImpl
|
||||
bool IsEqual(CefRefPtr<CefBinaryValue> that) override;
|
||||
CefRefPtr<CefBinaryValue> Copy() override;
|
||||
size_t GetSize() override;
|
||||
size_t GetData(void* buffer,
|
||||
size_t buffer_size,
|
||||
size_t data_offset) override;
|
||||
size_t GetData(void* buffer, size_t buffer_size, size_t data_offset) override;
|
||||
|
||||
private:
|
||||
// See the CefValueBase constructor for usage. Binary values are always
|
||||
@@ -185,7 +173,6 @@ class CefBinaryValueImpl
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBinaryValueImpl);
|
||||
};
|
||||
|
||||
|
||||
// CefDictionaryValue implementation
|
||||
class CefDictionaryValueImpl
|
||||
: public CefValueBase<CefDictionaryValue, base::DictionaryValue> {
|
||||
@@ -227,8 +214,7 @@ class CefDictionaryValueImpl
|
||||
bool IsReadOnly() override;
|
||||
bool IsSame(CefRefPtr<CefDictionaryValue> that) override;
|
||||
bool IsEqual(CefRefPtr<CefDictionaryValue> that) override;
|
||||
CefRefPtr<CefDictionaryValue> Copy(
|
||||
bool exclude_empty_children) override;
|
||||
CefRefPtr<CefDictionaryValue> Copy(bool exclude_empty_children) override;
|
||||
size_t GetSize() override;
|
||||
bool Clear() override;
|
||||
bool HasKey(const CefString& key) override;
|
||||
@@ -241,22 +227,19 @@ class CefDictionaryValueImpl
|
||||
double GetDouble(const CefString& key) override;
|
||||
CefString GetString(const CefString& key) override;
|
||||
CefRefPtr<CefBinaryValue> GetBinary(const CefString& key) override;
|
||||
CefRefPtr<CefDictionaryValue> GetDictionary(
|
||||
const CefString& key) override;
|
||||
CefRefPtr<CefDictionaryValue> GetDictionary(const CefString& key) override;
|
||||
CefRefPtr<CefListValue> GetList(const CefString& key) override;
|
||||
bool SetValue(const CefString& key, CefRefPtr<CefValue> value) override;
|
||||
bool SetNull(const CefString& key) override;
|
||||
bool SetBool(const CefString& key, bool value) override;
|
||||
bool SetInt(const CefString& key, int value) override;
|
||||
bool SetDouble(const CefString& key, double value) override;
|
||||
bool SetString(const CefString& key,
|
||||
const CefString& value) override;
|
||||
bool SetString(const CefString& key, const CefString& value) override;
|
||||
bool SetBinary(const CefString& key,
|
||||
CefRefPtr<CefBinaryValue> value) override;
|
||||
CefRefPtr<CefBinaryValue> value) override;
|
||||
bool SetDictionary(const CefString& key,
|
||||
CefRefPtr<CefDictionaryValue> value) override;
|
||||
bool SetList(const CefString& key,
|
||||
CefRefPtr<CefListValue> value) override;
|
||||
bool SetList(const CefString& key, CefRefPtr<CefListValue> value) override;
|
||||
|
||||
private:
|
||||
// See the CefValueBase constructor for usage.
|
||||
@@ -272,17 +255,14 @@ class CefDictionaryValueImpl
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDictionaryValueImpl);
|
||||
};
|
||||
|
||||
|
||||
// CefListValue implementation
|
||||
class CefListValueImpl
|
||||
: public CefValueBase<CefListValue, base::ListValue> {
|
||||
class CefListValueImpl : public CefValueBase<CefListValue, base::ListValue> {
|
||||
public:
|
||||
// Get or create a reference value.
|
||||
static CefRefPtr<CefListValue> GetOrCreateRef(
|
||||
base::ListValue* value,
|
||||
void* parent_value,
|
||||
bool read_only,
|
||||
CefValueController* controller);
|
||||
static CefRefPtr<CefListValue> GetOrCreateRef(base::ListValue* value,
|
||||
void* parent_value,
|
||||
bool read_only,
|
||||
CefValueController* controller);
|
||||
|
||||
// Reference an existing value (set |will_delete| to false) or take ownership
|
||||
// of an existing value (set |will_delete| to true). When referencing an
|
||||
@@ -290,9 +270,7 @@ class CefListValueImpl
|
||||
// longer valid. Use GetOrCreateRef instead of this constructor if |value| is
|
||||
// owned by some other object and you do not plan to explicitly call
|
||||
// Detach(NULL).
|
||||
CefListValueImpl(base::ListValue* value,
|
||||
bool will_delete,
|
||||
bool read_only);
|
||||
CefListValueImpl(base::ListValue* value, bool will_delete, bool read_only);
|
||||
|
||||
// Return a copy of the value.
|
||||
base::ListValue* CopyValue();
|
||||
@@ -353,5 +331,4 @@ class CefListValueImpl
|
||||
DISALLOW_COPY_AND_ASSIGN(CefListValueImpl);
|
||||
};
|
||||
|
||||
|
||||
#endif // CEF_LIBCEF_COMMON_VALUES_IMPL_H_
|
||||
|
@@ -29,11 +29,11 @@ CefRefPtr<CefWaitableEvent> CefWaitableEvent::CreateWaitableEvent(
|
||||
|
||||
CefWaitableEventImpl::CefWaitableEventImpl(bool automatic_reset,
|
||||
bool initially_signaled)
|
||||
: event_(automatic_reset ? base::WaitableEvent::ResetPolicy::AUTOMATIC :
|
||||
base::WaitableEvent::ResetPolicy::MANUAL,
|
||||
initially_signaled ? base::WaitableEvent::InitialState::SIGNALED :
|
||||
base::WaitableEvent::InitialState::NOT_SIGNALED) {
|
||||
}
|
||||
: event_(automatic_reset ? base::WaitableEvent::ResetPolicy::AUTOMATIC
|
||||
: base::WaitableEvent::ResetPolicy::MANUAL,
|
||||
initially_signaled
|
||||
? base::WaitableEvent::InitialState::SIGNALED
|
||||
: base::WaitableEvent::InitialState::NOT_SIGNALED) {}
|
||||
|
||||
void CefWaitableEventImpl::Reset() {
|
||||
event_.Reset();
|
||||
|
@@ -2,17 +2,17 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_COMMON_WAITABLE_EVENT_IMPL_H_
|
||||
#define CEF_LIBCEF_COMMON_WAITABLE_EVENT_IMPL_H_
|
||||
#ifndef CEF_LIBCEF_COMMON_WAITABLE_EVENT_IMPL_H_
|
||||
#define CEF_LIBCEF_COMMON_WAITABLE_EVENT_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_waitable_event.h"
|
||||
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
|
||||
class CefWaitableEventImpl : public CefWaitableEvent {
|
||||
public:
|
||||
CefWaitableEventImpl(bool automatic_reset,
|
||||
bool initially_signaled);
|
||||
CefWaitableEventImpl(bool automatic_reset, bool initially_signaled);
|
||||
|
||||
// CefWaitableEvent methods:
|
||||
void Reset() override;
|
||||
|
@@ -30,7 +30,6 @@ namespace {
|
||||
base::LazyInstance<CefWidevineLoader>::Leaky g_widevine_loader =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
|
||||
// Based on chrome/browser/component_updater/widevine_cdm_component_installer.cc
|
||||
|
||||
// Name of the Widevine CDM OS in the component manifest.
|
||||
@@ -140,8 +139,8 @@ bool CheckForCompatibleVersion(const base::DictionaryValue& manifest,
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "Manifest has no supported " << version_name << " in '" <<
|
||||
versions_string << "'";
|
||||
ss << "Manifest has no supported " << version_name << " in '"
|
||||
<< versions_string << "'";
|
||||
*error_message = ss.str();
|
||||
return false;
|
||||
}
|
||||
@@ -154,16 +153,13 @@ bool IsCompatibleWithChrome(const base::DictionaryValue& manifest,
|
||||
kWidevineCdmOs &&
|
||||
GetManifestValue(manifest, kCdmArchName, error_message) ==
|
||||
kWidevineCdmArch &&
|
||||
CheckForCompatibleVersion(manifest,
|
||||
kCdmModuleVersionsName,
|
||||
CheckForCompatibleVersion(manifest, kCdmModuleVersionsName,
|
||||
media::IsSupportedCdmModuleVersion,
|
||||
error_message) &&
|
||||
CheckForCompatibleVersion(manifest,
|
||||
kCdmInterfaceVersionsName,
|
||||
CheckForCompatibleVersion(manifest, kCdmInterfaceVersionsName,
|
||||
media::IsSupportedCdmInterfaceVersion,
|
||||
error_message) &&
|
||||
CheckForCompatibleVersion(manifest,
|
||||
kCdmHostVersionsName,
|
||||
CheckForCompatibleVersion(manifest, kCdmHostVersionsName,
|
||||
media::IsSupportedCdmHostVersion,
|
||||
error_message);
|
||||
}
|
||||
@@ -177,13 +173,11 @@ void GetPluginInfo(const base::FilePath& cdm_adapter_path,
|
||||
widevine_cdm->is_out_of_process = true;
|
||||
widevine_cdm->path = cdm_adapter_path;
|
||||
widevine_cdm->name = kWidevineCdmDisplayName;
|
||||
widevine_cdm->description = kWidevineCdmDescription +
|
||||
std::string(" (version: ") +
|
||||
cdm_version + ")";
|
||||
widevine_cdm->description =
|
||||
kWidevineCdmDescription + std::string(" (version: ") + cdm_version + ")";
|
||||
widevine_cdm->version = cdm_version;
|
||||
content::WebPluginMimeType widevine_cdm_mime_type(
|
||||
kWidevineCdmPluginMimeType,
|
||||
kWidevineCdmPluginExtension,
|
||||
kWidevineCdmPluginMimeType, kWidevineCdmPluginExtension,
|
||||
kWidevineCdmPluginMimeTypeDescription);
|
||||
|
||||
widevine_cdm_mime_type.additional_param_names.push_back(
|
||||
@@ -261,12 +255,11 @@ void DeliverWidevineCdmCallback(cef_cdm_registration_error_t result,
|
||||
callback->OnCdmRegistrationComplete(result, error_message);
|
||||
}
|
||||
|
||||
void RegisterWidevineCdmOnUIThread(
|
||||
const base::FilePath& cdm_adapter_path,
|
||||
const base::FilePath& cdm_path,
|
||||
const std::string& cdm_version,
|
||||
const std::string& cdm_codecs,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback) {
|
||||
void RegisterWidevineCdmOnUIThread(const base::FilePath& cdm_adapter_path,
|
||||
const base::FilePath& cdm_path,
|
||||
const std::string& cdm_version,
|
||||
const std::string& cdm_codecs,
|
||||
CefRefPtr<CefRegisterCdmCallback> callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
content::PepperPluginInfo widevine_cdm;
|
||||
@@ -313,8 +306,8 @@ void LoadWidevineCdmInfoOnFileThread(
|
||||
|
||||
// Continue execution on the UI thread.
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(RegisterWidevineCdmOnUIThread, cdm_adapter_path, cdm_path,
|
||||
cdm_version, cdm_codecs, callback));
|
||||
base::Bind(RegisterWidevineCdmOnUIThread, cdm_adapter_path,
|
||||
cdm_path, cdm_version, cdm_codecs, callback));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -337,7 +330,7 @@ void CefWidevineLoader::LoadWidevineCdm(
|
||||
|
||||
// Continue execution on the FILE thread.
|
||||
CEF_POST_TASK(CEF_FILET,
|
||||
base::Bind(LoadWidevineCdmInfoOnFileThread, path, callback));
|
||||
base::Bind(LoadWidevineCdmInfoOnFileThread, path, callback));
|
||||
}
|
||||
|
||||
void CefWidevineLoader::OnContextInitialized() {
|
||||
@@ -369,8 +362,8 @@ void CefWidevineLoader::AddPepperPlugins(
|
||||
|
||||
// The Widevine CDM path is passed to the zygote process via
|
||||
// CefContentBrowserClient::AppendExtraCommandLineSwitches.
|
||||
const base::FilePath& base_path = command_line.GetSwitchValuePath(
|
||||
switches::kWidevineCdmPath);
|
||||
const base::FilePath& base_path =
|
||||
command_line.GetSwitchValuePath(switches::kWidevineCdmPath);
|
||||
if (base_path.empty())
|
||||
return;
|
||||
|
||||
@@ -397,10 +390,8 @@ void CefWidevineLoader::AddPepperPlugins(
|
||||
|
||||
#endif // defined(OS_LINUX)
|
||||
|
||||
CefWidevineLoader::CefWidevineLoader() {
|
||||
}
|
||||
CefWidevineLoader::CefWidevineLoader() {}
|
||||
|
||||
CefWidevineLoader::~CefWidevineLoader() {
|
||||
}
|
||||
CefWidevineLoader::~CefWidevineLoader() {}
|
||||
|
||||
#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||
|
Reference in New Issue
Block a user