- cefclient: Add background-color command-line argument (issue #1161).

- Rename cef_url.h to cef_parser.h.
- Add new CefParseCSSColor function.
This commit is contained in:
Marshall Greenblatt
2015-04-09 16:59:34 +02:00
parent 2c03492160
commit ae91d8f4e5
33 changed files with 645 additions and 434 deletions

View File

@ -4,6 +4,7 @@
#include "cefclient/browser/main_context_impl.h"
#include "include/cef_parser.h"
#include "cefclient/common/client_switches.h"
namespace client {
@ -20,7 +21,8 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> command_line,
: command_line_(command_line),
terminate_when_all_windows_closed_(terminate_when_all_windows_closed),
initialized_(false),
shutdown_(false) {
shutdown_(false),
background_color_(CefColorSetARGB(255, 255, 255, 255)) {
DCHECK(command_line_.get());
// Set the main URL.
@ -28,6 +30,12 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> command_line,
main_url_ = command_line_->GetSwitchValue(switches::kUrl);
if (main_url_.empty())
main_url_ = kDefaultUrl;
if (command_line_->HasSwitch(switches::kBackgroundColor)) {
// Parse the background color value.
CefParseCSSColor(command_line_->GetSwitchValue(switches::kBackgroundColor),
false, background_color_);
}
}
MainContextImpl::~MainContextImpl() {
@ -44,6 +52,10 @@ std::string MainContextImpl::GetMainURL() {
return main_url_;
}
cef_color_t MainContextImpl::GetBackgroundColor() {
return background_color_;
}
void MainContextImpl::PopulateSettings(CefSettings* settings) {
#if defined(OS_WIN)
settings->multi_threaded_message_loop =
@ -55,6 +67,8 @@ void MainContextImpl::PopulateSettings(CefSettings* settings) {
if (command_line_->HasSwitch(switches::kOffScreenRenderingEnabled))
settings->windowless_rendering_enabled = true;
settings->background_color = background_color_;
}
void MainContextImpl::PopulateBrowserSettings(CefBrowserSettings* settings) {
@ -64,6 +78,14 @@ void MainContextImpl::PopulateBrowserSettings(CefBrowserSettings* settings) {
}
}
void MainContextImpl::PopulateOsrSettings(OsrRenderer::Settings* settings) {
settings->transparent =
command_line_->HasSwitch(switches::kTransparentPaintingEnabled);
settings->show_update_rect =
command_line_->HasSwitch(switches::kShowUpdateRect);
settings->background_color = background_color_;
}
RootWindowManager* MainContextImpl::GetRootWindowManager() {
DCHECK(InValidState());
return root_window_manager_.get();