add switches
This commit is contained in:
parent
847866847e
commit
e3175def71
@ -2,7 +2,7 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "CEF/HumanApp.h"
|
||||
#include "CEF/HumanAppBrowser.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
#include "include/views/cef_window.h"
|
||||
#include "include/wrapper/cef_helpers.h"
|
||||
|
||||
#include "CEF/HumanAppSwitches.h"
|
||||
|
||||
|
||||
HumanAppBrowser::HumanAppBrowser() {
|
||||
CreateDelegates(delegates_);
|
||||
@ -22,12 +24,12 @@ void HumanAppBrowser::PopulateSettings(CefRefPtr<CefCommandLine> command_line,
|
||||
CefSettings& settings) {
|
||||
#if (defined(OS_WIN) || defined(OS_LINUX))
|
||||
settings.multi_threaded_message_loop =
|
||||
command_line->HasSwitch(client::switches::kMultiThreadedMessageLoop);
|
||||
command_line->HasSwitch(kMultiThreadedMessageLoop);
|
||||
#endif
|
||||
|
||||
if (!settings.multi_threaded_message_loop) {
|
||||
settings.external_message_pump =
|
||||
command_line->HasSwitch(client::switches::kExternalMessagePump);
|
||||
command_line->HasSwitch(kExternalMessagePump);
|
||||
}
|
||||
|
||||
std::vector<std::string> cookieable_schemes;
|
||||
@ -49,19 +51,19 @@ void HumanAppBrowser::OnBeforeCommandLineProcessing(
|
||||
// Pass additional command-line flags to the browser process.
|
||||
if (process_type.empty()) {
|
||||
// Pass additional command-line flags when off-screen rendering is enabled.
|
||||
if (command_line->HasSwitch(switches::kOffScreenRenderingEnabled) &&
|
||||
!command_line->HasSwitch(switches::kSharedTextureEnabled)) {
|
||||
if (command_line->HasSwitch(kOffScreenRenderingEnabled) &&
|
||||
!command_line->HasSwitch(kSharedTextureEnabled)) {
|
||||
// Use software rendering and compositing (disable GPU) for increased FPS
|
||||
// and decreased CPU usage. This will also disable WebGL so remove these
|
||||
// switches if you need that capability.
|
||||
// See https://bitbucket.org/chromiumembedded/cef/issues/1257 for details.
|
||||
if (!command_line->HasSwitch(switches::kEnableGPU)) {
|
||||
if (!command_line->HasSwitch(kEnableGPU)) {
|
||||
command_line->AppendSwitch("disable-gpu");
|
||||
command_line->AppendSwitch("disable-gpu-compositing");
|
||||
}
|
||||
}
|
||||
|
||||
if (command_line->HasSwitch(switches::kUseViews) &&
|
||||
if (command_line->HasSwitch(kUseViews) &&
|
||||
!command_line->HasSwitch("top-chrome-md")) {
|
||||
// Use non-material mode on all platforms by default. Among other things
|
||||
// this causes menu buttons to show hover state. See usage of
|
||||
@ -69,7 +71,7 @@ void HumanAppBrowser::OnBeforeCommandLineProcessing(
|
||||
command_line->AppendSwitchWithValue("top-chrome-md", "non-material");
|
||||
}
|
||||
|
||||
if (!command_line->HasSwitch(switches::kCachePath) &&
|
||||
if (!command_line->HasSwitch(kCachePath) &&
|
||||
!command_line->HasSwitch("disable-gpu-shader-disk-cache")) {
|
||||
// Don't create a "GPUCache" directory when cache-path is unspecified.
|
||||
command_line->AppendSwitch("disable-gpu-shader-disk-cache");
|
||||
@ -103,9 +105,9 @@ void HumanAppBrowser::OnBeforeChildProcessLaunch(
|
||||
}
|
||||
|
||||
void HumanAppBrowser::OnScheduleMessagePumpWork(int64 delay) {
|
||||
// Only used when `--external-message-pump` is passed via the command-line.
|
||||
MainMessageLoopExternalPump* message_pump =
|
||||
MainMessageLoopExternalPump::Get();
|
||||
if (message_pump)
|
||||
message_pump->OnScheduleMessagePumpWork(delay);
|
||||
//// Only used when `--external-message-pump` is passed via the command-line.
|
||||
//MainMessageLoopExternalPump* message_pump =
|
||||
// MainMessageLoopExternalPump::Get();
|
||||
//if (message_pump)
|
||||
// message_pump->OnScheduleMessagePumpWork(delay);
|
||||
}
|
||||
|
41
src/CEF/HumanAppSwitches.cpp
Normal file
41
src/CEF/HumanAppSwitches.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
// 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.
|
||||
|
||||
#include "CEF/HumanAppSwitches.h"
|
||||
|
||||
|
||||
const char kMultiThreadedMessageLoop[] = "multi-threaded-message-loop";
|
||||
const char kExternalMessagePump[] = "external-message-pump";
|
||||
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 kSharedTextureEnabled[] = "shared-texture-enabled";
|
||||
const char kExternalBeginFrameEnabled[] = "external-begin-frame-enabled";
|
||||
const char kMouseCursorChangeDisabled[] = "mouse-cursor-change-disabled";
|
||||
const char kOffline[] = "offline";
|
||||
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";
|
||||
const char kUseViews[] = "use-views";
|
||||
const char kUseNative[] = "use-native";
|
||||
const char kHideFrame[] = "hide-frame";
|
||||
const char kHideControls[] = "hide-controls";
|
||||
const char kHideOverlays[] = "hide-overlays";
|
||||
const char kAlwaysOnTop[] = "always-on-top";
|
||||
const char kHideTopMenu[] = "hide-top-menu";
|
||||
const char kSslClientCertificate[] = "ssl-client-certificate";
|
||||
const char kCRLSetsPath[] = "crl-sets-path";
|
||||
const char kLoadExtension[] = "load-extension";
|
||||
const char kNoActivate[] = "no-activate";
|
||||
const char kEnableChromeRuntime[] = "enable-chrome-runtime";
|
||||
const char kShowChromeToolbar[] = "show-chrome-toolbar";
|
||||
const char kInitialShowState[] = "initial-show-state";
|
||||
const char kHideChromeStatusBubble[] = "hide-chrome-status-bubble";
|
||||
const char kUseDefaultPopup[] = "use-default-popup";
|
||||
const char kUseClientDialogs[] = "use-client-dialogs";
|
43
src/CEF/HumanAppSwitches.h
Normal file
43
src/CEF/HumanAppSwitches.h
Normal file
@ -0,0 +1,43 @@
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
extern const char kMultiThreadedMessageLoop[];
|
||||
extern const char kExternalMessagePump[];
|
||||
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 kSharedTextureEnabled[];
|
||||
extern const char kExternalBeginFrameEnabled[];
|
||||
extern const char kMouseCursorChangeDisabled[];
|
||||
extern const char kOffline[];
|
||||
extern const char kRequestContextPerBrowser[];
|
||||
extern const char kRequestContextSharedCache[];
|
||||
extern const char kBackgroundColor[];
|
||||
extern const char kEnableGPU[];
|
||||
extern const char kFilterURL[];
|
||||
extern const char kUseViews[];
|
||||
extern const char kUseNative[];
|
||||
extern const char kHideFrame[];
|
||||
extern const char kHideControls[];
|
||||
extern const char kHideOverlays[];
|
||||
extern const char kAlwaysOnTop[];
|
||||
extern const char kHideTopMenu[];
|
||||
extern const char kSslClientCertificate[];
|
||||
extern const char kCRLSetsPath[];
|
||||
extern const char kLoadExtension[];
|
||||
extern const char kNoActivate[];
|
||||
extern const char kEnableChromeRuntime[];
|
||||
extern const char kShowChromeToolbar[];
|
||||
extern const char kInitialShowState[];
|
||||
extern const char kHideChromeStatusBubble[];
|
||||
extern const char kUseDefaultPopup[];
|
||||
extern const char kUseClientDialogs[];
|
||||
|
Loading…
Reference in New Issue
Block a user