return window_->IsKiosk();
}
+void Window::SetBackgroundColor(const std::string& color_name) {
+ window_->SetBackgroundColor(color_name);
+}
+
void Window::FocusOnWebView() {
window_->FocusOnWebView();
}
.SetMethod("setSkipTaskbar", &Window::SetSkipTaskbar)
.SetMethod("setKiosk", &Window::SetKiosk)
.SetMethod("isKiosk", &Window::IsKiosk)
+ .SetMethod("setBackgroundColor", &Window::SetBackgroundColor)
.SetMethod("setRepresentedFilename", &Window::SetRepresentedFilename)
.SetMethod("getRepresentedFilename", &Window::GetRepresentedFilename)
.SetMethod("setDocumentEdited", &Window::SetDocumentEdited)
void SetSkipTaskbar(bool skip);
void SetKiosk(bool kiosk);
bool IsKiosk();
+ void SetBackgroundColor(const std::string& color_name);
void FocusOnWebView();
void BlurWebView();
bool IsWebViewFocused();
if (options.Get(switches::kKiosk, &kiosk) && kiosk) {
SetKiosk(kiosk);
}
+ std::string color;
+ if (options.Get(switches::kBackgroundColor, &color)) {
+ SetBackgroundColor(color);
+ }
std::string title("Electron");
options.Get(switches::kTitle, &title);
SetTitle(title);
virtual void SetSkipTaskbar(bool skip) = 0;
virtual void SetKiosk(bool kiosk) = 0;
virtual bool IsKiosk() = 0;
+ virtual void SetBackgroundColor(const std::string& color_name) = 0;
virtual void SetRepresentedFilename(const std::string& filename);
virtual std::string GetRepresentedFilename();
virtual void SetDocumentEdited(bool edited);
void SetSkipTaskbar(bool skip) override;
void SetKiosk(bool kiosk) override;
bool IsKiosk() override;
+ void SetBackgroundColor(const std::string& color_name) override;
void SetRepresentedFilename(const std::string& filename) override;
std::string GetRepresentedFilename() override;
void SetDocumentEdited(bool edited) override;
return is_kiosk_;
}
+void NativeWindowMac::SetBackgroundColor(const std::string& color_name) {
+}
+
void NativeWindowMac::SetRepresentedFilename(const std::string& filename) {
[window_ setRepresentedFilename:base::SysUTF8ToNSString(filename)];
}
// Add web view.
SetLayoutManager(new MenuLayout(this, kMenuBarHeight));
- // web views' background color.
- SkColor background_color = SK_ColorWHITE;
- std::string color_name;
- if (options.Get(switches::kBackgroundColor, &color_name))
- background_color = ParseHexColor(color_name);
- set_background(views::Background::CreateSolidBackground(background_color));
-
AddChildView(web_view_);
#if defined(OS_WIN)
- // Set the background color of native window.
- HBRUSH brush = CreateSolidBrush(skia::SkColorToCOLORREF(background_color));
- ULONG_PTR previous_brush = SetClassLongPtr(
- GetAcceleratedWidget(), GCLP_HBRBACKGROUND, (LONG)brush);
- if (previous_brush)
- DeleteObject((HBRUSH)previous_brush);
-
// Save initial window state.
if (fullscreen)
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
return IsFullscreen();
}
+void NativeWindowViews::SetBackgroundColor(const std::string& color_name) {
+ // web views' background color.
+ SkColor background_color = ParseHexColor(color_name);
+ set_background(views::Background::CreateSolidBackground(background_color));
+
+#if defined(OS_WIN)
+ // Set the background color of native window.
+ HBRUSH brush = CreateSolidBrush(skia::SkColorToCOLORREF(background_color));
+ ULONG_PTR previous_brush = SetClassLongPtr(
+ GetAcceleratedWidget(), GCLP_HBRBACKGROUND, (LONG)brush);
+ if (previous_brush)
+ DeleteObject((HBRUSH)previous_brush);
+#endif
+}
+
void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) {
if (menu_model == nullptr) {
// Remove accelerators
void SetSkipTaskbar(bool skip) override;
void SetKiosk(bool kiosk) override;
bool IsKiosk() override;
+ void SetBackgroundColor(const std::string& color_name) override;
void SetMenu(ui::MenuModel* menu_model) override;
gfx::NativeWindow GetNativeWindow() override;
void SetOverlayIcon(const gfx::Image& overlay,