refactor: Chromium code style for enum classes (#26165)

This commit is contained in:
Milan Burda 2020-10-27 18:51:45 +01:00 committed by GitHub
parent dbf2931f0e
commit 1c99a9b425
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 300 additions and 295 deletions

View file

@ -17,7 +17,7 @@ class Arguments;
namespace electron {
// Possible bundle movement conflicts
enum class BundlerMoverConflictType { EXISTS, EXISTS_AND_RUNNING };
enum class BundlerMoverConflictType { kExists, kExistsAndRunning };
class ElectronBundleMover {
public:

View file

@ -24,9 +24,9 @@ struct Converter<electron::BundlerMoverConflictType> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
electron::BundlerMoverConflictType value) {
switch (value) {
case electron::BundlerMoverConflictType::EXISTS:
case electron::BundlerMoverConflictType::kExists:
return gin::StringToV8(isolate, "exists");
case electron::BundlerMoverConflictType::EXISTS_AND_RUNNING:
case electron::BundlerMoverConflictType::kExistsAndRunning:
return gin::StringToV8(isolate, "existsAndRunning");
default:
return gin::StringToV8(isolate, "");
@ -117,7 +117,7 @@ bool ElectronBundleMover::Move(gin_helper::ErrorThrower thrower,
if (IsApplicationAtPathRunning(destinationPath)) {
// Check for callback handler and get user choice for open/quit
if (!ShouldContinueMove(
thrower, BundlerMoverConflictType::EXISTS_AND_RUNNING, args))
thrower, BundlerMoverConflictType::kExistsAndRunning, args))
return false;
// Unless explicitly denied, give running app focus and terminate self
@ -130,7 +130,7 @@ bool ElectronBundleMover::Move(gin_helper::ErrorThrower thrower,
return true;
} else {
// Check callback handler and get user choice for app trashing
if (!ShouldContinueMove(thrower, BundlerMoverConflictType::EXISTS,
if (!ShouldContinueMove(thrower, BundlerMoverConflictType::kExists,
args))
return false;

View file

@ -193,7 +193,7 @@ bool ScopedDisableResize::disable_resize_ = false;
- (void)performClose:(id)sender {
if (shell_->title_bar_style() ==
electron::NativeWindowMac::TitleBarStyle::CUSTOM_BUTTONS_ON_HOVER) {
electron::NativeWindowMac::TitleBarStyle::kCustomButtonsOnHover) {
[[self delegate] windowShouldClose:self];
} else if (shell_->IsSimpleFullScreen()) {
if ([[self delegate] respondsToSelector:@selector(windowShouldClose:)]) {
@ -234,7 +234,7 @@ bool ScopedDisableResize::disable_resize_ = false;
- (void)performMiniaturize:(id)sender {
if (shell_->title_bar_style() ==
electron::NativeWindowMac::TitleBarStyle::CUSTOM_BUTTONS_ON_HOVER)
electron::NativeWindowMac::TitleBarStyle::kCustomButtonsOnHover)
[self miniaturize:self];
else
[super performMiniaturize:sender];

View file

@ -151,7 +151,7 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
- (void)windowDidResize:(NSNotification*)notification {
[super windowDidResize:notification];
shell_->NotifyWindowResize();
if (shell_->title_bar_style() == TitleBarStyle::HIDDEN) {
if (shell_->title_bar_style() == TitleBarStyle::kHidden) {
shell_->RedrawTrafficLights();
}
}
@ -216,7 +216,7 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
shell_->SetResizable(true);
// Hide the native toolbar before entering fullscreen, so there is no visual
// artifacts.
if (shell_->title_bar_style() == TitleBarStyle::HIDDEN_INSET) {
if (shell_->title_bar_style() == TitleBarStyle::kHiddenInset) {
NSWindow* window = shell_->GetNativeWindow().GetNativeNSWindow();
[window setToolbar:nil];
}
@ -233,14 +233,14 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
// FIXME(zcbenz): Showing titlebar for hiddenInset window is weird under
// fullscreen mode.
// Show title if fullscreen_window_title flag is set
(shell_->title_bar_style() != TitleBarStyle::HIDDEN_INSET ||
(shell_->title_bar_style() != TitleBarStyle::kHiddenInset ||
shell_->fullscreen_window_title())) {
[window setTitleVisibility:NSWindowTitleVisible];
}
// Restore the native toolbar immediately after entering fullscreen, if we
// do this before leaving fullscreen, traffic light buttons will be jumping.
if (shell_->title_bar_style() == TitleBarStyle::HIDDEN_INSET) {
if (shell_->title_bar_style() == TitleBarStyle::kHiddenInset) {
base::scoped_nsobject<NSToolbar> toolbar(
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
[toolbar setShowsBaselineSeparator:NO];
@ -257,18 +257,18 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
// Restore the titlebar visibility.
NSWindow* window = shell_->GetNativeWindow().GetNativeNSWindow();
if ((shell_->transparent() || !shell_->has_frame()) &&
(shell_->title_bar_style() != TitleBarStyle::HIDDEN_INSET ||
(shell_->title_bar_style() != TitleBarStyle::kHiddenInset ||
shell_->fullscreen_window_title())) {
[window setTitleVisibility:NSWindowTitleHidden];
}
// Turn off the style for toolbar.
if (shell_->title_bar_style() == TitleBarStyle::HIDDEN_INSET) {
if (shell_->title_bar_style() == TitleBarStyle::kHiddenInset) {
shell_->SetStyleMask(false, NSWindowStyleMaskFullSizeContentView);
[window setTitlebarAppearsTransparent:YES];
}
shell_->SetExitingFullScreen(true);
if (shell_->title_bar_style() == TitleBarStyle::HIDDEN) {
if (shell_->title_bar_style() == TitleBarStyle::kHidden) {
shell_->RedrawTrafficLights();
}
}
@ -277,7 +277,7 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
shell_->SetResizable(is_resizable_);
shell_->NotifyWindowLeaveFullScreen();
shell_->SetExitingFullScreen(false);
if (shell_->title_bar_style() == TitleBarStyle::HIDDEN) {
if (shell_->title_bar_style() == TitleBarStyle::kHidden) {
shell_->RedrawTrafficLights();
}
}