refactor: Chromium code style for enum classes (#26165)
This commit is contained in:
parent
dbf2931f0e
commit
1c99a9b425
34 changed files with 300 additions and 295 deletions
|
@ -262,11 +262,11 @@ struct Converter<electron::NativeWindowMac::TitleBarStyle> {
|
|||
if (!ConvertFromV8(isolate, val, &title_bar_style))
|
||||
return false;
|
||||
if (title_bar_style == "hidden") {
|
||||
*out = TitleBarStyle::HIDDEN;
|
||||
*out = TitleBarStyle::kHidden;
|
||||
} else if (title_bar_style == "hiddenInset") {
|
||||
*out = TitleBarStyle::HIDDEN_INSET;
|
||||
*out = TitleBarStyle::kHiddenInset;
|
||||
} else if (title_bar_style == "customButtonsOnHover") {
|
||||
*out = TitleBarStyle::CUSTOM_BUTTONS_ON_HOVER;
|
||||
*out = TitleBarStyle::kCustomButtonsOnHover;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -284,11 +284,11 @@ struct Converter<electron::NativeWindowMac::VisualEffectState> {
|
|||
if (!ConvertFromV8(isolate, val, &visual_effect_state))
|
||||
return false;
|
||||
if (visual_effect_state == "followWindow") {
|
||||
*out = VisualEffectState::FOLLOW_WINDOW;
|
||||
*out = VisualEffectState::kFollowWindow;
|
||||
} else if (visual_effect_state == "active") {
|
||||
*out = VisualEffectState::ACTIVE;
|
||||
*out = VisualEffectState::kActive;
|
||||
} else if (visual_effect_state == "inactive") {
|
||||
*out = VisualEffectState::INACTIVE;
|
||||
*out = VisualEffectState::kInactive;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -392,8 +392,7 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
|
|||
}
|
||||
|
||||
NSUInteger styleMask = NSWindowStyleMaskTitled;
|
||||
bool customOnHover =
|
||||
title_bar_style_ == TitleBarStyle::CUSTOM_BUTTONS_ON_HOVER;
|
||||
bool customOnHover = title_bar_style_ == TitleBarStyle::kCustomButtonsOnHover;
|
||||
if (customOnHover && (!useStandardWindow || transparent() || !has_frame()))
|
||||
styleMask = NSWindowStyleMaskFullSizeContentView;
|
||||
|
||||
|
@ -405,7 +404,7 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
|
|||
styleMask |= NSResizableWindowMask;
|
||||
|
||||
// The window without titlebar is treated the same with frameless window.
|
||||
if (title_bar_style_ != TitleBarStyle::NORMAL)
|
||||
if (title_bar_style_ != TitleBarStyle::kNormal)
|
||||
set_has_frame(false);
|
||||
if (!useStandardWindow || transparent() || !has_frame())
|
||||
styleMask |= NSTexturedBackgroundWindowMask;
|
||||
|
@ -470,12 +469,12 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
|
|||
}
|
||||
|
||||
// Hide the title bar background
|
||||
if (title_bar_style_ != TitleBarStyle::NORMAL) {
|
||||
if (title_bar_style_ != TitleBarStyle::kNormal) {
|
||||
[window_ setTitlebarAppearsTransparent:YES];
|
||||
}
|
||||
|
||||
// Hide the title bar.
|
||||
if (title_bar_style_ == TitleBarStyle::HIDDEN_INSET) {
|
||||
if (title_bar_style_ == TitleBarStyle::kHiddenInset) {
|
||||
base::scoped_nsobject<NSToolbar> toolbar(
|
||||
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
|
||||
[toolbar setShowsBaselineSeparator:NO];
|
||||
|
@ -1044,7 +1043,7 @@ void NativeWindowMac::Invalidate() {
|
|||
|
||||
void NativeWindowMac::SetTitle(const std::string& title) {
|
||||
[window_ setTitle:base::SysUTF8ToNSString(title)];
|
||||
if (title_bar_style_ == TitleBarStyle::HIDDEN) {
|
||||
if (title_bar_style_ == TitleBarStyle::kHidden) {
|
||||
RedrawTrafficLights();
|
||||
}
|
||||
}
|
||||
|
@ -1445,7 +1444,7 @@ bool NativeWindowMac::AddTabbedWindow(NativeWindow* window) {
|
|||
}
|
||||
|
||||
bool NativeWindowMac::SetWindowButtonVisibility(bool visible) {
|
||||
if (title_bar_style_ == TitleBarStyle::CUSTOM_BUTTONS_ON_HOVER) {
|
||||
if (title_bar_style_ == TitleBarStyle::kCustomButtonsOnHover) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1477,7 +1476,7 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
|
|||
background_color_before_vibrancy_.reset([[window_ backgroundColor] retain]);
|
||||
transparency_before_vibrancy_ = [window_ titlebarAppearsTransparent];
|
||||
|
||||
if (title_bar_style_ != TitleBarStyle::NORMAL) {
|
||||
if (title_bar_style_ != TitleBarStyle::kNormal) {
|
||||
[window_ setTitlebarAppearsTransparent:YES];
|
||||
[window_ setBackgroundColor:[NSColor clearColor]];
|
||||
}
|
||||
|
@ -1491,9 +1490,9 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
|
|||
[effect_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||
[effect_view setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
|
||||
|
||||
if (visual_effect_state_ == VisualEffectState::ACTIVE) {
|
||||
if (visual_effect_state_ == VisualEffectState::kActive) {
|
||||
[effect_view setState:NSVisualEffectStateActive];
|
||||
} else if (visual_effect_state_ == VisualEffectState::INACTIVE) {
|
||||
} else if (visual_effect_state_ == VisualEffectState::kInactive) {
|
||||
[effect_view setState:NSVisualEffectStateInactive];
|
||||
} else {
|
||||
[effect_view setState:NSVisualEffectStateFollowsWindowActiveState];
|
||||
|
@ -1698,7 +1697,7 @@ void NativeWindowMac::AddContentViewLayers(bool minimizable, bool closable) {
|
|||
// The fullscreen button should always be hidden for frameless window.
|
||||
[[window_ standardWindowButton:NSWindowFullScreenButton] setHidden:YES];
|
||||
|
||||
if (title_bar_style_ == TitleBarStyle::CUSTOM_BUTTONS_ON_HOVER) {
|
||||
if (title_bar_style_ == TitleBarStyle::kCustomButtonsOnHover) {
|
||||
buttons_view_.reset(
|
||||
[[CustomWindowButtonView alloc] initWithFrame:NSZeroRect]);
|
||||
|
||||
|
@ -1712,7 +1711,7 @@ void NativeWindowMac::AddContentViewLayers(bool minimizable, bool closable) {
|
|||
|
||||
[[window_ contentView] addSubview:buttons_view_];
|
||||
} else {
|
||||
if (title_bar_style_ != TitleBarStyle::NORMAL)
|
||||
if (title_bar_style_ != TitleBarStyle::kNormal)
|
||||
return;
|
||||
|
||||
// Hide the window buttons.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue