Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions appshell/cefclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "include/cef_runnable.h"
#include "include/cef_web_plugin.h"
#include "client_handler.h"
#include "client_switches.h"
#include "appshell/common/client_switches.h"
#include "string_util.h"
#include "util.h"
#include "config.h"
Expand Down Expand Up @@ -57,30 +57,30 @@ void AppGetSettings(CefSettings& settings, CefRefPtr<ClientApp> app) {

#if defined(OS_WIN)
settings.multi_threaded_message_loop =
g_command_line->HasSwitch(cefclient::kMultiThreadedMessageLoop);
g_command_line->HasSwitch(client::switches::kMultiThreadedMessageLoop);
#endif

CefString(&settings.cache_path) =
g_command_line->GetSwitchValue(cefclient::kCachePath);
g_command_line->GetSwitchValue(client::switches::kCachePath);
CefString(&settings.log_file) =
g_command_line->GetSwitchValue(cefclient::kLogFile);
g_command_line->GetSwitchValue(client::switches::kLogFile);

{
std::string str = g_command_line->GetSwitchValue(cefclient::kLogSeverity);
std::string str = g_command_line->GetSwitchValue(client::switches::kLogSeverity);

// Default to LOGSEVERITY_DISABLE
settings.log_severity = LOGSEVERITY_DISABLE;

if (!str.empty()) {
if (str == cefclient::kLogSeverity_Verbose)
if (str == client::switches::kLogSeverity_Verbose)
settings.log_severity = LOGSEVERITY_VERBOSE;
else if (str == cefclient::kLogSeverity_Info)
else if (str == client::switches::kLogSeverity_Info)
settings.log_severity = LOGSEVERITY_INFO;
else if (str == cefclient::kLogSeverity_Warning)
else if (str == client::switches::kLogSeverity_Warning)
settings.log_severity = LOGSEVERITY_WARNING;
else if (str == cefclient::kLogSeverity_Error)
else if (str == client::switches::kLogSeverity_Error)
settings.log_severity = LOGSEVERITY_ERROR;
else if (str == cefclient::kLogSeverity_Disable)
else if (str == client::switches::kLogSeverity_Disable)
settings.log_severity = LOGSEVERITY_DISABLE;
}
}
Expand All @@ -91,7 +91,7 @@ void AppGetSettings(CefSettings& settings, CefRefPtr<ClientApp> app) {
//CefString(&settings.locale) = app->GetCurrentLanguage( );

CefString(&settings.javascript_flags) =
g_command_line->GetSwitchValue(cefclient::kJavascriptFlags);
g_command_line->GetSwitchValue(client::switches::kJavascriptFlags);

// Enable dev tools
settings.remote_debugging_port = REMOTE_DEBUGGING_PORT;
Expand Down
6 changes: 3 additions & 3 deletions appshell/cefclient_gtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "include/cef_frame.h"
#include "include/cef_runnable.h"
#include "client_handler.h"
#include "client_switches.h"
#include "appshell/common/client_switches.h"
#include "appshell_node_process.h"

static std::string APPICONS[] = {"appshell32.png","appshell48.png","appshell128.png","appshell256.png"};
Expand Down Expand Up @@ -174,8 +174,8 @@ int main(int argc, char* argv[]) {

CefRefPtr<CefCommandLine> cmdLine = AppGetCommandLine();

if (cmdLine->HasSwitch(cefclient::kStartupPath)) {
szInitialUrl = cmdLine->GetSwitchValue(cefclient::kStartupPath);
if (cmdLine->HasSwitch(client::switches::kStartupPath)) {
szInitialUrl = cmdLine->GetSwitchValue(client::switches::kStartupPath);
} else {
szInitialUrl = AppGetRunningDirectory();
szInitialUrl.append("/dev/src/index.html");
Expand Down
6 changes: 3 additions & 3 deletions appshell/cefclient_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "config.h"
#include "appshell_extensions.h"
#include "command_callbacks.h"
#include "client_switches.h"
#include "appshell/common/client_switches.h"
#include "native_menu_model.h"
#include "appshell_node_process.h"

Expand Down Expand Up @@ -850,8 +850,8 @@ int main(int argc, char* argv[]) {
CFRelease(event);

CefRefPtr<CefCommandLine> cmdLine = AppGetCommandLine();
if (cmdLine->HasSwitch(cefclient::kStartupPath)) {
CefString cmdLineStartupURL = cmdLine->GetSwitchValue(cefclient::kStartupPath);
if (cmdLine->HasSwitch(client::switches::kStartupPath)) {
CefString cmdLineStartupURL = cmdLine->GetSwitchValue(client::switches::kStartupPath);
std::string startupURLStr(cmdLineStartupURL);
NSString* str = [NSString stringWithUTF8String:startupURLStr.c_str()];
startupUrl = [NSURL fileURLWithPath:[str stringByExpandingTildeInPath]];
Expand Down
6 changes: 3 additions & 3 deletions appshell/cefclient_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "config.h"
#include "resource.h"
#include "string_util.h"
#include "client_switches.h"
#include "appshell/common/client_switches.h"
#include "native_menu_model.h"
#include "appshell_node_process.h"

Expand Down Expand Up @@ -240,8 +240,8 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
CefInitialize(main_args, settings, app.get(), NULL);

CefRefPtr<CefCommandLine> cmdLine = AppGetCommandLine();
if (cmdLine->HasSwitch(cefclient::kStartupPath)) {
wcscpy(szInitialUrl, cmdLine->GetSwitchValue(cefclient::kStartupPath).c_str());
if (cmdLine->HasSwitch(client::switches::kStartupPath)) {
wcscpy(szInitialUrl, cmdLine->GetSwitchValue(client::switches::kStartupPath).c_str());
}
else {
// If the shift key is not pressed, look for the index.html file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.

// This file is shared by cefclient and cef_unittests so don't include using
// a qualified path.
#include "client_switches.h" // NOLINT(build/include)
#include "appshell/common/client_switches.h"

namespace client {
namespace switches {

namespace cefclient {

const char kStartupPath[] = "startup-path";

// CefSettings attributes.
// CEF and Chromium support a wide range of command-line switches. This file
// only contains command-line switches specific to the cefclient application.
// View CEF/Chromium documentation or search for *_switches.cc files in the
// Chromium source code to identify other existing command-line switches.
// Below is a partial listing of relevant *_switches.cc files:
// base/base_switches.cc
// cef/libcef/common/cef_switches.cc
// chrome/common/chrome_switches.cc (not all apply)
// content/public/common/content_switches.cc

const char kMultiThreadedMessageLoop[] = "multi-threaded-message-loop";
const char kCachePath[] = "cache-path";
const char kUrl[] = "url";
const char kOffScreenRenderingEnabled[] = "off-screen-rendering-enabled";
const char kOffScreenFrameRate[] = "off-screen-frame-rate";
const char kTransparentPaintingEnabled[] = "transparent-painting-enabled";
const char kShowUpdateRect[] = "show-update-rect";
const char kMouseCursorChangeDisabled[] = "mouse-cursor-change-disabled";
const char kRequestContextPerBrowser[] = "request-context-per-browser";
const char kRequestContextSharedCache[] = "request-context-shared-cache";
const char kBackgroundColor[] = "background-color";
const char kEnableGPU[] = "enable-gpu";
const char kFilterURL[] = "filter-url";

// CefSettings attributes.
const char kLogFile[] = "log-file";
const char kLogSeverity[] = "log-severity";
const char kLogSeverity_Verbose[] = "verbose";
Expand Down Expand Up @@ -79,4 +100,5 @@ const char kAcceleratedPluginsDisabled[] = "accelerated-plugins-disabled";
const char kDeveloperToolsDisabled[] = "developer-tools-disabled";
const char kFullscreenEnabled[] = "fullscreen-enabled";

} // namespace cefclient
} // namespace switches
} // namespace client
28 changes: 21 additions & 7 deletions appshell/client_switches.h → appshell/common/client_switches.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.

// Defines all of the command line switches used by cefclient.

#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_
#define CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_
#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_COMMON_SWITCHES_H_
#define CEF_TESTS_CEFCLIENT_CEFCLIENT_COMMON_SWITCHES_H_
#pragma once

namespace cefclient {
namespace client {
namespace switches {

extern const char kStartupPath[];

// CefSettings attributes.
extern const char kMultiThreadedMessageLoop[];
extern const char kCachePath[];
extern const char kUrl[];
extern const char kOffScreenRenderingEnabled[];
extern const char kOffScreenFrameRate[];
extern const char kTransparentPaintingEnabled[];
extern const char kShowUpdateRect[];
extern const char kMouseCursorChangeDisabled[];
extern const char kRequestContextPerBrowser[];
extern const char kRequestContextSharedCache[];
extern const char kBackgroundColor[];
extern const char kEnableGPU[];
extern const char kFilterURL[];

// CefSettings attributes.
extern const char kLogFile[];
extern const char kLogSeverity[];
extern const char kLogSeverity_Verbose[];
Expand Down Expand Up @@ -75,6 +88,7 @@ extern const char kAcceleratedPluginsDisabled[];
extern const char kDeveloperToolsDisabled[];
extern const char kFullscreenEnabled[];

} // namespace cefclient
} // namespace switches
} // namespace client

#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_
#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_COMMON_SWITCHES_H_
8 changes: 4 additions & 4 deletions appshell_paths.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@
'appshell/client_app_delegates.cpp',
'appshell/client_handler.cpp',
'appshell/client_handler.h',
'appshell/client_switches.cpp',
'appshell/client_switches.h',
'appshell/common/client_switches.cc',
'appshell/common/client_switches.h',
'appshell/native_menu_model.cpp',
'appshell/native_menu_model.h',
'appshell/resource_util.h',
Expand Down Expand Up @@ -264,8 +264,8 @@
'appshell/client_handler.cpp',
'appshell/client_handler.h',
'appshell/client_handler_mac.mm',
'appshell/client_switches.cpp',
'appshell/client_switches.h',
'appshell/common/client_switches.cc',
'appshell/common/client_switches.h',
'appshell/native_menu_model.cpp',
'appshell/native_menu_model.h',
'appshell/process_helper_mac.cpp',
Expand Down