Browse Source

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

Milan Burda 4 years ago
parent
commit
1c99a9b425
34 changed files with 300 additions and 295 deletions
  1. 13 8
      shell/app/electron_content_client.cc
  2. 43 42
      shell/browser/api/electron_api_app.cc
  3. 9 9
      shell/browser/api/electron_api_protocol.cc
  4. 7 7
      shell/browser/api/electron_api_protocol.h
  5. 5 5
      shell/browser/api/electron_api_tray.cc
  6. 38 38
      shell/browser/api/electron_api_web_contents.cc
  7. 7 7
      shell/browser/api/electron_api_web_contents.h
  8. 1 1
      shell/browser/api/electron_api_web_contents_mac.mm
  9. 10 10
      shell/browser/api/process_metric.cc
  10. 5 5
      shell/browser/api/process_metric.h
  11. 2 2
      shell/browser/browser.h
  12. 2 2
      shell/browser/browser_win.cc
  13. 9 9
      shell/browser/electron_browser_client.cc
  14. 1 1
      shell/browser/electron_browser_main_parts.cc
  15. 9 9
      shell/browser/extensions/api/tabs/tabs_api.cc
  16. 9 9
      shell/browser/native_window_mac.h
  17. 17 18
      shell/browser/native_window_mac.mm
  18. 5 5
      shell/browser/net/proxying_websocket.cc
  19. 4 4
      shell/browser/net/proxying_websocket.h
  20. 1 1
      shell/browser/ui/cocoa/electron_bundle_mover.h
  21. 4 4
      shell/browser/ui/cocoa/electron_bundle_mover.mm
  22. 2 2
      shell/browser/ui/cocoa/electron_ns_window.mm
  23. 8 8
      shell/browser/ui/cocoa/electron_ns_window_delegate.mm
  24. 2 2
      shell/browser/ui/tray_icon.h
  25. 32 32
      shell/browser/ui/win/jump_list.cc
  26. 15 15
      shell/browser/ui/win/jump_list.h
  27. 5 5
      shell/browser/ui/win/notify_icon.cc
  28. 14 14
      shell/browser/web_contents_zoom_controller.cc
  29. 5 5
      shell/browser/web_contents_zoom_controller.h
  30. 12 12
      shell/common/node_bindings.cc
  31. 1 1
      shell/common/node_bindings.h
  32. 1 1
      shell/renderer/api/electron_api_context_bridge.cc
  33. 1 1
      shell/renderer/electron_renderer_client.cc
  34. 1 1
      shell/renderer/web_worker_observer.cc

+ 13 - 8
shell/app/electron_content_client.cc

@@ -49,29 +49,34 @@ namespace electron {
 
 namespace {
 
+enum class WidevineCdmFileCheck {
+  kNotChecked,
+  kFound,
+  kNotFound,
+};
+
 #if defined(WIDEVINE_CDM_AVAILABLE)
 bool IsWidevineAvailable(
     base::FilePath* cdm_path,
     std::vector<media::VideoCodec>* codecs_supported,
     base::flat_set<media::CdmSessionType>* session_types_supported,
     base::flat_set<media::EncryptionMode>* modes_supported) {
-  static enum {
-    NOT_CHECKED,
-    FOUND,
-    NOT_FOUND,
-  } widevine_cdm_file_check = NOT_CHECKED;
+  static WidevineCdmFileCheck widevine_cdm_file_check =
+      WidevineCdmFileCheck::kNotChecked;
 
-  if (widevine_cdm_file_check == NOT_CHECKED) {
+  if (widevine_cdm_file_check == WidevineCdmFileCheck::kNotChecked) {
     base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
     *cdm_path = command_line->GetSwitchValuePath(switches::kWidevineCdmPath);
     if (!cdm_path->empty()) {
       *cdm_path = cdm_path->AppendASCII(
           base::GetNativeLibraryName(kWidevineCdmLibraryName));
-      widevine_cdm_file_check = base::PathExists(*cdm_path) ? FOUND : NOT_FOUND;
+      widevine_cdm_file_check = base::PathExists(*cdm_path)
+                                    ? WidevineCdmFileCheck::kFound
+                                    : WidevineCdmFileCheck::kNotFound;
     }
   }
 
-  if (widevine_cdm_file_check == FOUND) {
+  if (widevine_cdm_file_check == WidevineCdmFileCheck::kFound) {
     // Add the supported codecs as if they came from the component manifest.
     // This list must match the CDM that is being bundled with Chrome.
     codecs_supported->push_back(media::VideoCodec::kCodecVP8);

+ 43 - 42
shell/browser/api/electron_api_app.cc

@@ -78,13 +78,13 @@ struct Converter<electron::ProcessIntegrityLevel> {
   static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
                                    electron::ProcessIntegrityLevel value) {
     switch (value) {
-      case electron::ProcessIntegrityLevel::Untrusted:
+      case electron::ProcessIntegrityLevel::kUntrusted:
         return StringToV8(isolate, "untrusted");
-      case electron::ProcessIntegrityLevel::Low:
+      case electron::ProcessIntegrityLevel::kLow:
         return StringToV8(isolate, "low");
-      case electron::ProcessIntegrityLevel::Medium:
+      case electron::ProcessIntegrityLevel::kMedium:
         return StringToV8(isolate, "medium");
-      case electron::ProcessIntegrityLevel::High:
+      case electron::ProcessIntegrityLevel::kHigh:
         return StringToV8(isolate, "high");
       default:
         return StringToV8(isolate, "unknown");
@@ -127,11 +127,11 @@ struct Converter<JumpListItem::Type> {
       return false;
 
     if (item_type == "task")
-      *out = JumpListItem::Type::TASK;
+      *out = JumpListItem::Type::kTask;
     else if (item_type == "separator")
-      *out = JumpListItem::Type::SEPARATOR;
+      *out = JumpListItem::Type::kSeparator;
     else if (item_type == "file")
-      *out = JumpListItem::Type::FILE;
+      *out = JumpListItem::Type::kFile;
     else
       return false;
 
@@ -142,15 +142,15 @@ struct Converter<JumpListItem::Type> {
                                    JumpListItem::Type val) {
     std::string item_type;
     switch (val) {
-      case JumpListItem::Type::TASK:
+      case JumpListItem::Type::kTask:
         item_type = "task";
         break;
 
-      case JumpListItem::Type::SEPARATOR:
+      case JumpListItem::Type::kSeparator:
         item_type = "separator";
         break;
 
-      case JumpListItem::Type::FILE:
+      case JumpListItem::Type::kFile:
         item_type = "file";
         break;
     }
@@ -171,7 +171,7 @@ struct Converter<JumpListItem> {
       return false;
 
     switch (out->type) {
-      case JumpListItem::Type::TASK:
+      case JumpListItem::Type::kTask:
         if (!dict.Get("program", &(out->path)) ||
             !dict.Get("title", &(out->title)))
           return false;
@@ -185,10 +185,10 @@ struct Converter<JumpListItem> {
         dict.Get("workingDirectory", &(out->working_dir));
         return true;
 
-      case JumpListItem::Type::SEPARATOR:
+      case JumpListItem::Type::kSeparator:
         return true;
 
-      case JumpListItem::Type::FILE:
+      case JumpListItem::Type::kFile:
         return dict.Get("path", &(out->path));
     }
 
@@ -202,7 +202,7 @@ struct Converter<JumpListItem> {
     dict.Set("type", val.type);
 
     switch (val.type) {
-      case JumpListItem::Type::TASK:
+      case JumpListItem::Type::kTask:
         dict.Set("program", val.path);
         dict.Set("args", val.arguments);
         dict.Set("title", val.title);
@@ -212,10 +212,10 @@ struct Converter<JumpListItem> {
         dict.Set("workingDirectory", val.working_dir);
         break;
 
-      case JumpListItem::Type::SEPARATOR:
+      case JumpListItem::Type::kSeparator:
         break;
 
-      case JumpListItem::Type::FILE:
+      case JumpListItem::Type::kFile:
         dict.Set("path", val.path);
         break;
     }
@@ -233,13 +233,13 @@ struct Converter<JumpListCategory::Type> {
       return false;
 
     if (category_type == "tasks")
-      *out = JumpListCategory::Type::TASKS;
+      *out = JumpListCategory::Type::kTasks;
     else if (category_type == "frequent")
-      *out = JumpListCategory::Type::FREQUENT;
+      *out = JumpListCategory::Type::kFrequent;
     else if (category_type == "recent")
-      *out = JumpListCategory::Type::RECENT;
+      *out = JumpListCategory::Type::kRecent;
     else if (category_type == "custom")
-      *out = JumpListCategory::Type::CUSTOM;
+      *out = JumpListCategory::Type::kCustom;
     else
       return false;
 
@@ -250,19 +250,19 @@ struct Converter<JumpListCategory::Type> {
                                    JumpListCategory::Type val) {
     std::string category_type;
     switch (val) {
-      case JumpListCategory::Type::TASKS:
+      case JumpListCategory::Type::kTasks:
         category_type = "tasks";
         break;
 
-      case JumpListCategory::Type::FREQUENT:
+      case JumpListCategory::Type::kFrequent:
         category_type = "frequent";
         break;
 
-      case JumpListCategory::Type::RECENT:
+      case JumpListCategory::Type::kRecent:
         category_type = "recent";
         break;
 
-      case JumpListCategory::Type::CUSTOM:
+      case JumpListCategory::Type::kCustom:
         category_type = "custom";
         break;
     }
@@ -284,13 +284,13 @@ struct Converter<JumpListCategory> {
 
     if (!dict.Get("type", &(out->type))) {
       if (out->name.empty())
-        out->type = JumpListCategory::Type::TASKS;
+        out->type = JumpListCategory::Type::kTasks;
       else
-        out->type = JumpListCategory::Type::CUSTOM;
+        out->type = JumpListCategory::Type::kCustom;
     }
 
-    if ((out->type == JumpListCategory::Type::TASKS) ||
-        (out->type == JumpListCategory::Type::CUSTOM)) {
+    if ((out->type == JumpListCategory::Type::kTasks) ||
+        (out->type == JumpListCategory::Type::kCustom)) {
       if (!dict.Get("items", &(out->items)))
         return false;
     }
@@ -305,27 +305,27 @@ struct Converter<JumpListResult> {
   static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, JumpListResult val) {
     std::string result_code;
     switch (val) {
-      case JumpListResult::SUCCESS:
+      case JumpListResult::kSuccess:
         result_code = "ok";
         break;
 
-      case JumpListResult::ARGUMENT_ERROR:
+      case JumpListResult::kArgumentError:
         result_code = "argumentError";
         break;
 
-      case JumpListResult::GENERIC_ERROR:
+      case JumpListResult::kGenericError:
         result_code = "error";
         break;
 
-      case JumpListResult::CUSTOM_CATEGORY_SEPARATOR_ERROR:
+      case JumpListResult::kCustomCategorySeparatorError:
         result_code = "invalidSeparatorError";
         break;
 
-      case JumpListResult::MISSING_FILE_TYPE_REGISTRATION_ERROR:
+      case JumpListResult::kMissingFileTypeRegistrationError:
         result_code = "fileTypeRegistrationError";
         break;
 
-      case JumpListResult::CUSTOM_CATEGORY_ACCESS_DENIED_ERROR:
+      case JumpListResult::kCustomCategoryAccessDeniedError:
         result_code = "customCategoryAccessDeniedError";
         break;
     }
@@ -1253,19 +1253,19 @@ JumpListResult App::SetJumpList(v8::Local<v8::Value> val,
       !gin::ConvertFromV8(args->isolate(), val, &categories)) {
     gin_helper::ErrorThrower(args->isolate())
         .ThrowError("Argument must be null or an array of categories");
-    return JumpListResult::ARGUMENT_ERROR;
+    return JumpListResult::kArgumentError;
   }
 
   JumpList jump_list(Browser::Get()->GetAppUserModelID());
 
   if (delete_jump_list) {
-    return jump_list.Delete() ? JumpListResult::SUCCESS
-                              : JumpListResult::GENERIC_ERROR;
+    return jump_list.Delete() ? JumpListResult::kSuccess
+                              : JumpListResult::kGenericError;
   }
 
   // Start a transaction that updates the JumpList of this application.
   if (!jump_list.Begin())
-    return JumpListResult::GENERIC_ERROR;
+    return JumpListResult::kGenericError;
 
   JumpListResult result = jump_list.AppendCategories(categories);
   // AppendCategories may have failed to add some categories, but it's better
@@ -1275,8 +1275,8 @@ JumpListResult App::SetJumpList(v8::Local<v8::Value> val,
     // It's more useful to return the earlier error code that might give
     // some indication as to why the transaction actually failed, so don't
     // overwrite it with a "generic error" code here.
-    if (result == JumpListResult::SUCCESS)
-      result = JumpListResult::GENERIC_ERROR;
+    if (result == JumpListResult::kSuccess)
+      result = JumpListResult::kGenericError;
   }
 
   return result;
@@ -1488,9 +1488,10 @@ int DockBounce(gin::Arguments* args) {
   args->GetNext(&type);
 
   if (type == "critical")
-    request_id = Browser::Get()->DockBounce(Browser::BounceType::CRITICAL);
+    request_id = Browser::Get()->DockBounce(Browser::BounceType::kCritical);
   else if (type == "informational")
-    request_id = Browser::Get()->DockBounce(Browser::BounceType::INFORMATIONAL);
+    request_id =
+        Browser::Get()->DockBounce(Browser::BounceType::kInformational);
   return request_id;
 }
 

+ 9 - 9
shell/browser/api/electron_api_protocol.cc

@@ -160,13 +160,13 @@ const char* kBuiltinSchemes[] = {
 // Convert error code to string.
 std::string ErrorCodeToString(ProtocolError error) {
   switch (error) {
-    case ProtocolError::REGISTERED:
+    case ProtocolError::kRegistered:
       return "The scheme has been registered";
-    case ProtocolError::NOT_REGISTERED:
+    case ProtocolError::kNotRegistered:
       return "The scheme has not been registered";
-    case ProtocolError::INTERCEPTED:
+    case ProtocolError::kIntercepted:
       return "The scheme has been intercepted";
-    case ProtocolError::NOT_INTERCEPTED:
+    case ProtocolError::kNotIntercepted:
       return "The scheme has not been intercepted";
     default:
       return "Unexpected error";
@@ -184,14 +184,14 @@ ProtocolError Protocol::RegisterProtocol(ProtocolType type,
                                          const std::string& scheme,
                                          const ProtocolHandler& handler) {
   bool added = protocol_registry_->RegisterProtocol(type, scheme, handler);
-  return added ? ProtocolError::OK : ProtocolError::REGISTERED;
+  return added ? ProtocolError::kOK : ProtocolError::kRegistered;
 }
 
 bool Protocol::UnregisterProtocol(const std::string& scheme,
                                   gin::Arguments* args) {
   bool removed = protocol_registry_->UnregisterProtocol(scheme);
   HandleOptionalCallback(
-      args, removed ? ProtocolError::OK : ProtocolError::NOT_REGISTERED);
+      args, removed ? ProtocolError::kOK : ProtocolError::kNotRegistered);
   return removed;
 }
 
@@ -203,14 +203,14 @@ ProtocolError Protocol::InterceptProtocol(ProtocolType type,
                                           const std::string& scheme,
                                           const ProtocolHandler& handler) {
   bool added = protocol_registry_->InterceptProtocol(type, scheme, handler);
-  return added ? ProtocolError::OK : ProtocolError::INTERCEPTED;
+  return added ? ProtocolError::kOK : ProtocolError::kIntercepted;
 }
 
 bool Protocol::UninterceptProtocol(const std::string& scheme,
                                    gin::Arguments* args) {
   bool removed = protocol_registry_->UninterceptProtocol(scheme);
   HandleOptionalCallback(
-      args, removed ? ProtocolError::OK : ProtocolError::NOT_INTERCEPTED);
+      args, removed ? ProtocolError::kOK : ProtocolError::kNotIntercepted);
   return removed;
 }
 
@@ -248,7 +248,7 @@ void Protocol::HandleOptionalCallback(gin::Arguments* args,
         env,
         "The callback argument of protocol module APIs is no longer needed.",
         "ProtocolDeprecateCallback");
-    if (error == ProtocolError::OK)
+    if (error == ProtocolError::kOK)
       callback.Run(v8::Null(args->isolate()));
     else
       callback.Run(v8::Exception::Error(

+ 7 - 7
shell/browser/api/electron_api_protocol.h

@@ -27,11 +27,11 @@ void RegisterSchemesAsPrivileged(gin_helper::ErrorThrower thrower,
 
 // Possible errors.
 enum class ProtocolError {
-  OK,  // no error
-  REGISTERED,
-  NOT_REGISTERED,
-  INTERCEPTED,
-  NOT_INTERCEPTED,
+  kOK,  // no error
+  kRegistered,
+  kNotRegistered,
+  kIntercepted,
+  kNotIntercepted,
 };
 
 // Protocol implementation based on network services.
@@ -78,7 +78,7 @@ class Protocol : public gin::Wrappable<Protocol> {
                            gin::Arguments* args) {
     auto result = RegisterProtocol(type, scheme, handler);
     HandleOptionalCallback(args, result);
-    return result == ProtocolError::OK;
+    return result == ProtocolError::kOK;
   }
   template <ProtocolType type>
   bool InterceptProtocolFor(const std::string& scheme,
@@ -86,7 +86,7 @@ class Protocol : public gin::Wrappable<Protocol> {
                             gin::Arguments* args) {
     auto result = InterceptProtocol(type, scheme, handler);
     HandleOptionalCallback(args, result);
-    return result == ProtocolError::OK;
+    return result == ProtocolError::kOK;
   }
 
   // Be compatible with old interface, which accepts optional callback.

+ 5 - 5
shell/browser/api/electron_api_tray.cc

@@ -33,19 +33,19 @@ struct Converter<electron::TrayIcon::IconType> {
     std::string mode;
     if (ConvertFromV8(isolate, val, &mode)) {
       if (mode == "none") {
-        *out = IconType::None;
+        *out = IconType::kNone;
         return true;
       } else if (mode == "info") {
-        *out = IconType::Info;
+        *out = IconType::kInfo;
         return true;
       } else if (mode == "warning") {
-        *out = IconType::Warning;
+        *out = IconType::kWarning;
         return true;
       } else if (mode == "error") {
-        *out = IconType::Error;
+        *out = IconType::kError;
         return true;
       } else if (mode == "custom") {
-        *out = IconType::Custom;
+        *out = IconType::kCustom;
         return true;
       }
     }

+ 38 - 38
shell/browser/api/electron_api_web_contents.cc

@@ -273,22 +273,22 @@ struct Converter<electron::api::WebContents::Type> {
     using Type = electron::api::WebContents::Type;
     std::string type;
     switch (val) {
-      case Type::BACKGROUND_PAGE:
+      case Type::kBackgroundPage:
         type = "backgroundPage";
         break;
-      case Type::BROWSER_WINDOW:
+      case Type::kBrowserWindow:
         type = "window";
         break;
-      case Type::BROWSER_VIEW:
+      case Type::kBrowserView:
         type = "browserView";
         break;
-      case Type::REMOTE:
+      case Type::kRemote:
         type = "remote";
         break;
-      case Type::WEB_VIEW:
+      case Type::kWebView:
         type = "webview";
         break;
-      case Type::OFF_SCREEN:
+      case Type::kOffScreen:
         type = "offscreen";
         break;
       default:
@@ -305,14 +305,14 @@ struct Converter<electron::api::WebContents::Type> {
     if (!ConvertFromV8(isolate, val, &type))
       return false;
     if (type == "backgroundPage") {
-      *out = Type::BACKGROUND_PAGE;
+      *out = Type::kBackgroundPage;
     } else if (type == "browserView") {
-      *out = Type::BROWSER_VIEW;
+      *out = Type::kBrowserView;
     } else if (type == "webview") {
-      *out = Type::WEB_VIEW;
+      *out = Type::kWebView;
 #if BUILDFLAG(ENABLE_OSR)
     } else if (type == "offscreen") {
-      *out = Type::OFF_SCREEN;
+      *out = Type::kOffScreen;
 #endif
     } else {
       return false;
@@ -428,7 +428,7 @@ const void* kElectronApiWebContentsKey = &kElectronApiWebContentsKey;
 WebContents::Type GetTypeFromViewType(extensions::ViewType view_type) {
   switch (view_type) {
     case extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE:
-      return WebContents::Type::BACKGROUND_PAGE;
+      return WebContents::Type::kBackgroundPage;
 
     case extensions::VIEW_TYPE_APP_WINDOW:
     case extensions::VIEW_TYPE_COMPONENT:
@@ -438,7 +438,7 @@ WebContents::Type GetTypeFromViewType(extensions::ViewType view_type) {
     case extensions::VIEW_TYPE_EXTENSION_GUEST:
     case extensions::VIEW_TYPE_TAB_CONTENTS:
     case extensions::VIEW_TYPE_INVALID:
-      return WebContents::Type::REMOTE;
+      return WebContents::Type::kRemote;
   }
 }
 
@@ -447,7 +447,7 @@ WebContents::Type GetTypeFromViewType(extensions::ViewType view_type) {
 WebContents::WebContents(v8::Isolate* isolate,
                          content::WebContents* web_contents)
     : content::WebContentsObserver(web_contents),
-      type_(Type::REMOTE),
+      type_(Type::kRemote),
       id_(GetAllWebContents().Add(this)),
       weak_factory_(this) {
 #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
@@ -485,7 +485,7 @@ WebContents::WebContents(v8::Isolate* isolate,
       type_(type),
       id_(GetAllWebContents().Add(this)),
       weak_factory_(this) {
-  DCHECK(type != Type::REMOTE)
+  DCHECK(type != Type::kRemote)
       << "Can't take ownership of a remote WebContents";
   auto session = Session::CreateFrom(isolate, GetBrowserContext());
   session_.Reset(isolate, session.ToV8());
@@ -505,7 +505,7 @@ WebContents::WebContents(v8::Isolate* isolate,
 #if BUILDFLAG(ENABLE_OSR)
   bool b = false;
   if (options.Get(options::kOffscreen, &b) && b)
-    type_ = Type::OFF_SCREEN;
+    type_ = Type::kOffScreen;
 #endif
 
   // Init embedder earlier
@@ -517,7 +517,7 @@ WebContents::WebContents(v8::Isolate* isolate,
   // BrowserViews are not attached to a window initially so they should start
   // off as hidden. This is also important for compositor recycling. See:
   // https://github.com/electron/electron/pull/21372
-  initially_shown_ = type_ != Type::BROWSER_VIEW;
+  initially_shown_ = type_ != Type::kBrowserView;
   options.Get(options::kShow, &initially_shown_);
 
   // Obtain the session.
@@ -685,7 +685,7 @@ void WebContents::InitWithExtensionView(v8::Isolate* isolate,
                                         extensions::ViewType view_type) {
   // Must reassign type prior to calling `Init`.
   type_ = GetTypeFromViewType(view_type);
-  if (GetType() == Type::REMOTE)
+  if (GetType() == Type::kRemote)
     return;
 
   // Allow toggling DevTools for background pages
@@ -701,7 +701,7 @@ WebContents::~WebContents() {
   // The destroy() is called.
   if (managed_web_contents()) {
 #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
-    if (type_ == Type::BACKGROUND_PAGE) {
+    if (type_ == Type::kBackgroundPage) {
       // Background pages are owned by extensions::ExtensionHost
       managed_web_contents()->ReleaseWebContents();
     }
@@ -713,7 +713,7 @@ WebContents::~WebContents() {
       RenderViewDeleted(web_contents()->GetRenderViewHost());
     }
 
-    if (type_ == Type::BROWSER_WINDOW && owner_window()) {
+    if (type_ == Type::kBrowserWindow && owner_window()) {
       // For BrowserWindow we should close the window and clean up everything
       // before WebContents is destroyed.
       for (ExtendedWebContentsObserver& observer : observers_)
@@ -727,7 +727,7 @@ WebContents::~WebContents() {
     } else {
       // Destroy WebContents asynchronously unless app is shutting down,
       // because destroy() might be called inside WebContents's event handler.
-      bool is_browser_view = type_ == Type::BROWSER_VIEW;
+      bool is_browser_view = type_ == Type::kBrowserView;
       DestroyWebContents(!(IsGuest() || is_browser_view) /* async */);
       // The WebContentsDestroyed will not be called automatically because we
       // destroy the webContents in the next tick. So we have to manually
@@ -820,7 +820,7 @@ void WebContents::AddNewContents(
   v8::Locker locker(isolate);
   v8::HandleScope handle_scope(isolate);
   auto api_web_contents =
-      CreateAndTake(isolate, std::move(new_contents), Type::BROWSER_WINDOW);
+      CreateAndTake(isolate, std::move(new_contents), Type::kBrowserWindow);
   if (Emit("-add-new-contents", api_web_contents, disposition, user_gesture,
            initial_rect.x(), initial_rect.y(), initial_rect.width(),
            initial_rect.height(), tracker->url, tracker->frame_name,
@@ -848,7 +848,7 @@ content::WebContents* WebContents::OpenURLFromTab(
 void WebContents::BeforeUnloadFired(content::WebContents* tab,
                                     bool proceed,
                                     bool* proceed_to_fire_unload) {
-  if (type_ == Type::BROWSER_WINDOW || type_ == Type::OFF_SCREEN)
+  if (type_ == Type::kBrowserWindow || type_ == Type::kOffScreen)
     *proceed_to_fire_unload = proceed;
   else
     *proceed_to_fire_unload = true;
@@ -890,7 +890,7 @@ void WebContents::UpdateTargetURL(content::WebContents* source,
 bool WebContents::HandleKeyboardEvent(
     content::WebContents* source,
     const content::NativeWebKeyboardEvent& event) {
-  if (type_ == Type::WEB_VIEW && embedder_) {
+  if (type_ == Type::kWebView && embedder_) {
     // Send the unhandled keyboard events back to the embedder.
     return embedder_->HandleKeyboardEvent(source, event);
   } else {
@@ -1800,14 +1800,14 @@ v8::Local<v8::Promise> WebContents::SavePage(
 }
 
 void WebContents::OpenDevTools(gin::Arguments* args) {
-  if (type_ == Type::REMOTE)
+  if (type_ == Type::kRemote)
     return;
 
   if (!enable_devtools_)
     return;
 
   std::string state;
-  if (type_ == Type::WEB_VIEW || type_ == Type::BACKGROUND_PAGE ||
+  if (type_ == Type::kWebView || type_ == Type::kBackgroundPage ||
       !owner_window()) {
     state = "detach";
   }
@@ -1826,7 +1826,7 @@ void WebContents::OpenDevTools(gin::Arguments* args) {
 }
 
 void WebContents::CloseDevTools() {
-  if (type_ == Type::REMOTE)
+  if (type_ == Type::kRemote)
     return;
 
   DCHECK(managed_web_contents());
@@ -1834,7 +1834,7 @@ void WebContents::CloseDevTools() {
 }
 
 bool WebContents::IsDevToolsOpened() {
-  if (type_ == Type::REMOTE)
+  if (type_ == Type::kRemote)
     return false;
 
   DCHECK(managed_web_contents());
@@ -1842,7 +1842,7 @@ bool WebContents::IsDevToolsOpened() {
 }
 
 bool WebContents::IsDevToolsFocused() {
-  if (type_ == Type::REMOTE)
+  if (type_ == Type::kRemote)
     return false;
 
   DCHECK(managed_web_contents());
@@ -1851,7 +1851,7 @@ bool WebContents::IsDevToolsFocused() {
 
 void WebContents::EnableDeviceEmulation(
     const blink::DeviceEmulationParams& params) {
-  if (type_ == Type::REMOTE)
+  if (type_ == Type::kRemote)
     return;
 
   DCHECK(web_contents());
@@ -1869,7 +1869,7 @@ void WebContents::EnableDeviceEmulation(
 }
 
 void WebContents::DisableDeviceEmulation() {
-  if (type_ == Type::REMOTE)
+  if (type_ == Type::kRemote)
     return;
 
   DCHECK(web_contents());
@@ -1894,7 +1894,7 @@ void WebContents::ToggleDevTools() {
 }
 
 void WebContents::InspectElement(int x, int y) {
-  if (type_ == Type::REMOTE)
+  if (type_ == Type::kRemote)
     return;
 
   if (!enable_devtools_)
@@ -1907,7 +1907,7 @@ void WebContents::InspectElement(int x, int y) {
 }
 
 void WebContents::InspectSharedWorkerById(const std::string& workerId) {
-  if (type_ == Type::REMOTE)
+  if (type_ == Type::kRemote)
     return;
 
   if (!enable_devtools_)
@@ -1929,7 +1929,7 @@ std::vector<scoped_refptr<content::DevToolsAgentHost>>
 WebContents::GetAllSharedWorkers() {
   std::vector<scoped_refptr<content::DevToolsAgentHost>> shared_workers;
 
-  if (type_ == Type::REMOTE)
+  if (type_ == Type::kRemote)
     return shared_workers;
 
   if (!enable_devtools_)
@@ -1945,7 +1945,7 @@ WebContents::GetAllSharedWorkers() {
 }
 
 void WebContents::InspectSharedWorker() {
-  if (type_ == Type::REMOTE)
+  if (type_ == Type::kRemote)
     return;
 
   if (!enable_devtools_)
@@ -1962,7 +1962,7 @@ void WebContents::InspectSharedWorker() {
 }
 
 void WebContents::InspectServiceWorker() {
-  if (type_ == Type::REMOTE)
+  if (type_ == Type::kRemote)
     return;
 
   if (!enable_devtools_)
@@ -2356,7 +2356,7 @@ bool WebContents::IsFocused() const {
   if (!view)
     return false;
 
-  if (GetType() != Type::BACKGROUND_PAGE) {
+  if (GetType() != Type::kBackgroundPage) {
     auto* window = web_contents()->GetNativeView()->GetToplevelWindow();
     if (window && !window->IsVisible())
       return false;
@@ -2624,7 +2624,7 @@ void WebContents::OnCursorChanged(const content::WebCursor& webcursor) {
 }
 
 bool WebContents::IsGuest() const {
-  return type_ == Type::WEB_VIEW;
+  return type_ == Type::kWebView;
 }
 
 void WebContents::AttachToIframe(content::WebContents* embedder_web_contents,
@@ -2635,7 +2635,7 @@ void WebContents::AttachToIframe(content::WebContents* embedder_web_contents,
 
 bool WebContents::IsOffScreen() const {
 #if BUILDFLAG(ENABLE_OSR)
-  return type_ == Type::OFF_SCREEN;
+  return type_ == Type::kOffScreen;
 #else
   return false;
 #endif

+ 7 - 7
shell/browser/api/electron_api_web_contents.h

@@ -146,12 +146,12 @@ class WebContents : public gin::Wrappable<WebContents>,
                     public mojom::ElectronBrowser {
  public:
   enum class Type {
-    BACKGROUND_PAGE,  // An extension background page.
-    BROWSER_WINDOW,   // Used by BrowserWindow.
-    BROWSER_VIEW,     // Used by BrowserView.
-    REMOTE,           // Thin wrap around an existing WebContents.
-    WEB_VIEW,         // Used by <webview>.
-    OFF_SCREEN,       // Used for offscreen rendering
+    kBackgroundPage,  // An extension background page.
+    kBrowserWindow,   // Used by BrowserWindow.
+    kBrowserView,     // Used by BrowserView.
+    kRemote,          // Thin wrap around an existing WebContents.
+    kWebView,         // Used by <webview>.
+    kOffScreen,       // Used for offscreen rendering
   };
 
   // Create a new WebContents and return the V8 wrapper of it.
@@ -677,7 +677,7 @@ class WebContents : public gin::Wrappable<WebContents>,
   WebContentsZoomController* zoom_controller_ = nullptr;
 
   // The type of current WebContents.
-  Type type_ = Type::BROWSER_WINDOW;
+  Type type_ = Type::kBrowserWindow;
 
   int32_t id_;
 

+ 1 - 1
shell/browser/api/electron_api_web_contents_mac.mm

@@ -16,7 +16,7 @@ bool WebContents::IsFocused() const {
   if (!view)
     return false;
 
-  if (GetType() != Type::BACKGROUND_PAGE) {
+  if (GetType() != Type::kBackgroundPage) {
     auto window = [web_contents()->GetNativeView().GetNativeNSView() window];
     // On Mac the render widget host view does not lose focus when the window
     // loses focus so check if the top level window is the key window.

+ 10 - 10
shell/browser/api/process_metric.cc

@@ -92,7 +92,7 @@ ProcessMemoryInfo ProcessMetric::GetMemoryInfo() const {
 ProcessIntegrityLevel ProcessMetric::GetIntegrityLevel() const {
   HANDLE token = nullptr;
   if (!::OpenProcessToken(process.Handle(), TOKEN_QUERY, &token)) {
-    return ProcessIntegrityLevel::Unknown;
+    return ProcessIntegrityLevel::kUnknown;
   }
 
   base::win::ScopedHandle token_scoped(token);
@@ -101,7 +101,7 @@ ProcessIntegrityLevel ProcessMetric::GetIntegrityLevel() const {
   if (::GetTokenInformation(token, TokenIntegrityLevel, nullptr, 0,
                             &token_info_length) ||
       ::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-    return ProcessIntegrityLevel::Unknown;
+    return ProcessIntegrityLevel::kUnknown;
   }
 
   auto token_label_bytes = std::make_unique<char[]>(token_info_length);
@@ -109,7 +109,7 @@ ProcessIntegrityLevel ProcessMetric::GetIntegrityLevel() const {
       reinterpret_cast<TOKEN_MANDATORY_LABEL*>(token_label_bytes.get());
   if (!::GetTokenInformation(token, TokenIntegrityLevel, token_label,
                              token_info_length, &token_info_length)) {
-    return ProcessIntegrityLevel::Unknown;
+    return ProcessIntegrityLevel::kUnknown;
   }
 
   DWORD integrity_level = *::GetSidSubAuthority(
@@ -119,31 +119,31 @@ ProcessIntegrityLevel ProcessMetric::GetIntegrityLevel() const {
 
   if (integrity_level >= SECURITY_MANDATORY_UNTRUSTED_RID &&
       integrity_level < SECURITY_MANDATORY_LOW_RID) {
-    return ProcessIntegrityLevel::Untrusted;
+    return ProcessIntegrityLevel::kUntrusted;
   }
 
   if (integrity_level >= SECURITY_MANDATORY_LOW_RID &&
       integrity_level < SECURITY_MANDATORY_MEDIUM_RID) {
-    return ProcessIntegrityLevel::Low;
+    return ProcessIntegrityLevel::kLow;
   }
 
   if (integrity_level >= SECURITY_MANDATORY_MEDIUM_RID &&
       integrity_level < SECURITY_MANDATORY_HIGH_RID) {
-    return ProcessIntegrityLevel::Medium;
+    return ProcessIntegrityLevel::kMedium;
   }
 
   if (integrity_level >= SECURITY_MANDATORY_HIGH_RID &&
       integrity_level < SECURITY_MANDATORY_SYSTEM_RID) {
-    return ProcessIntegrityLevel::High;
+    return ProcessIntegrityLevel::kHigh;
   }
 
-  return ProcessIntegrityLevel::Unknown;
+  return ProcessIntegrityLevel::kUnknown;
 }
 
 // static
 bool ProcessMetric::IsSandboxed(ProcessIntegrityLevel integrity_level) {
-  return integrity_level > ProcessIntegrityLevel::Unknown &&
-         integrity_level < ProcessIntegrityLevel::Medium;
+  return integrity_level > ProcessIntegrityLevel::kUnknown &&
+         integrity_level < ProcessIntegrityLevel::kMedium;
 }
 
 #elif defined(OS_MAC)

+ 5 - 5
shell/browser/api/process_metric.h

@@ -26,11 +26,11 @@ struct ProcessMemoryInfo {
 
 #if defined(OS_WIN)
 enum class ProcessIntegrityLevel {
-  Unknown,
-  Untrusted,
-  Low,
-  Medium,
-  High,
+  kUnknown,
+  kUntrusted,
+  kLow,
+  kMedium,
+  kHigh,
 };
 #endif
 

+ 2 - 2
shell/browser/browser.h

@@ -201,8 +201,8 @@ class Browser : public WindowListObserver {
 
   // Bounce the dock icon.
   enum class BounceType{
-      CRITICAL = 0,        // NSCriticalRequest
-      INFORMATIONAL = 10,  // NSInformationalRequest
+      kCritical = 0,        // NSCriticalRequest
+      kInformational = 10,  // NSInformationalRequest
   };
   int DockBounce(BounceType type);
   void DockCancelBounce(int request_id);

+ 2 - 2
shell/browser/browser_win.cc

@@ -403,10 +403,10 @@ bool Browser::SetUserTasks(const std::vector<UserTask>& tasks) {
     return false;
 
   JumpListCategory category;
-  category.type = JumpListCategory::Type::TASKS;
+  category.type = JumpListCategory::Type::kTasks;
   category.items.reserve(tasks.size());
   JumpListItem item;
-  item.type = JumpListItem::Type::TASK;
+  item.type = JumpListItem::Type::kTask;
   for (const auto& task : tasks) {
     item.title = task.title;
     item.path = task.program;

+ 9 - 9
shell/browser/electron_browser_client.cc

@@ -237,10 +237,10 @@ const base::FilePath::StringPieceType kPathDelimiter = FILE_PATH_LITERAL(":");
 // granted to their RenderProcessHosts.  This classification allows us to make
 // sure URLs are served by hosts with the right set of privileges.
 enum class RenderProcessHostPrivilege {
-  Normal,
-  Hosted,
-  Isolated,
-  Extension,
+  kNormal,
+  kHosted,
+  kIsolated,
+  kExtension,
 };
 
 RenderProcessHostPrivilege GetPrivilegeRequiredByUrl(
@@ -253,12 +253,12 @@ RenderProcessHostPrivilege GetPrivilegeRequiredByUrl(
   // than normal webrenderer, the navigation logic will correct us out of band
   // anyways.
   if (!url.is_valid())
-    return RenderProcessHostPrivilege::Normal;
+    return RenderProcessHostPrivilege::kNormal;
 
   if (!url.SchemeIs(extensions::kExtensionScheme))
-    return RenderProcessHostPrivilege::Normal;
+    return RenderProcessHostPrivilege::kNormal;
 
-  return RenderProcessHostPrivilege::Extension;
+  return RenderProcessHostPrivilege::kExtension;
 }
 
 RenderProcessHostPrivilege GetProcessPrivilege(
@@ -268,9 +268,9 @@ RenderProcessHostPrivilege GetProcessPrivilege(
   std::set<std::string> extension_ids =
       process_map->GetExtensionsInProcess(process_host->GetID());
   if (extension_ids.empty())
-    return RenderProcessHostPrivilege::Normal;
+    return RenderProcessHostPrivilege::kNormal;
 
-  return RenderProcessHostPrivilege::Extension;
+  return RenderProcessHostPrivilege::kExtension;
 }
 
 const extensions::Extension* GetEnabledExtensionFromEffectiveURL(

+ 1 - 1
shell/browser/electron_browser_main_parts.cc

@@ -206,7 +206,7 @@ ElectronBrowserMainParts::ElectronBrowserMainParts(
     : fake_browser_process_(new BrowserProcessImpl),
       browser_(new Browser),
       node_bindings_(
-          NodeBindings::Create(NodeBindings::BrowserEnvironment::BROWSER)),
+          NodeBindings::Create(NodeBindings::BrowserEnvironment::kBrowser)),
       electron_bindings_(new ElectronBindings(node_bindings_->uv_loop())) {
   DCHECK(!self_) << "Cannot have two ElectronBrowserMainParts";
   self_ = this;

+ 9 - 9
shell/browser/extensions/api/tabs/tabs_api.cc

@@ -34,19 +34,19 @@ void ZoomModeToZoomSettings(WebContentsZoomController::ZoomMode zoom_mode,
                             api::tabs::ZoomSettings* zoom_settings) {
   DCHECK(zoom_settings);
   switch (zoom_mode) {
-    case WebContentsZoomController::ZoomMode::DEFAULT:
+    case WebContentsZoomController::ZoomMode::kDefault:
       zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_AUTOMATIC;
       zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN;
       break;
-    case WebContentsZoomController::ZoomMode::ISOLATED:
+    case WebContentsZoomController::ZoomMode::kIsolated:
       zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_AUTOMATIC;
       zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_TAB;
       break;
-    case WebContentsZoomController::ZoomMode::MANUAL:
+    case WebContentsZoomController::ZoomMode::kManual:
       zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_MANUAL;
       zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_TAB;
       break;
-    case WebContentsZoomController::ZoomMode::DISABLED:
+    case WebContentsZoomController::ZoomMode::kDisabled:
       zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_DISABLED;
       zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_TAB;
       break;
@@ -282,24 +282,24 @@ ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
   // Determine the correct internal zoom mode to set |web_contents| to from the
   // user-specified |zoom_settings|.
   WebContentsZoomController::ZoomMode zoom_mode =
-      WebContentsZoomController::ZoomMode::DEFAULT;
+      WebContentsZoomController::ZoomMode::kDefault;
   switch (params->zoom_settings.mode) {
     case tabs::ZOOM_SETTINGS_MODE_NONE:
     case tabs::ZOOM_SETTINGS_MODE_AUTOMATIC:
       switch (params->zoom_settings.scope) {
         case tabs::ZOOM_SETTINGS_SCOPE_NONE:
         case tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN:
-          zoom_mode = WebContentsZoomController::ZoomMode::DEFAULT;
+          zoom_mode = WebContentsZoomController::ZoomMode::kDefault;
           break;
         case tabs::ZOOM_SETTINGS_SCOPE_PER_TAB:
-          zoom_mode = WebContentsZoomController::ZoomMode::ISOLATED;
+          zoom_mode = WebContentsZoomController::ZoomMode::kIsolated;
       }
       break;
     case tabs::ZOOM_SETTINGS_MODE_MANUAL:
-      zoom_mode = WebContentsZoomController::ZoomMode::MANUAL;
+      zoom_mode = WebContentsZoomController::ZoomMode::kManual;
       break;
     case tabs::ZOOM_SETTINGS_MODE_DISABLED:
-      zoom_mode = WebContentsZoomController::ZoomMode::DISABLED;
+      zoom_mode = WebContentsZoomController::ZoomMode::kDisabled;
   }
 
   contents->GetZoomController()->SetZoomMode(zoom_mode);

+ 9 - 9
shell/browser/native_window_mac.h

@@ -164,16 +164,16 @@ class NativeWindowMac : public NativeWindow, public ui::NativeThemeObserver {
   void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;
 
   enum class VisualEffectState {
-    FOLLOW_WINDOW,
-    ACTIVE,
-    INACTIVE,
+    kFollowWindow,
+    kActive,
+    kInactive,
   };
 
   enum class TitleBarStyle {
-    NORMAL,
-    HIDDEN,
-    HIDDEN_INSET,
-    CUSTOM_BUTTONS_ON_HOVER,
+    kNormal,
+    kHidden,
+    kHiddenInset,
+    kCustomButtonsOnHover,
   };
   TitleBarStyle title_bar_style() const { return title_bar_style_; }
 
@@ -228,10 +228,10 @@ class NativeWindowMac : public NativeWindow, public ui::NativeThemeObserver {
   NSApplicationPresentationOptions kiosk_options_;
 
   // The "titleBarStyle" option.
-  TitleBarStyle title_bar_style_ = TitleBarStyle::NORMAL;
+  TitleBarStyle title_bar_style_ = TitleBarStyle::kNormal;
 
   // The "visualEffectState" option.
-  VisualEffectState visual_effect_state_ = VisualEffectState::FOLLOW_WINDOW;
+  VisualEffectState visual_effect_state_ = VisualEffectState::kFollowWindow;
 
   // The visibility mode of window button controls when explicitly set through
   // setWindowButtonVisibility().

+ 17 - 18
shell/browser/native_window_mac.mm

@@ -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.

+ 5 - 5
shell/browser/net/proxying_websocket.cc

@@ -380,15 +380,15 @@ void ProxyingWebSocket::OnAuthRequiredComplete(AuthRequiredResponse rv) {
   CHECK(auth_required_callback_);
   ResumeIncomingMethodCallProcessing();
   switch (rv) {
-    case AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_NO_ACTION:
-    case AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_CANCEL_AUTH:
+    case AuthRequiredResponse::kNoAction:
+    case AuthRequiredResponse::kCancelAuth:
       std::move(auth_required_callback_).Run(base::nullopt);
       break;
 
-    case AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_SET_AUTH:
+    case AuthRequiredResponse::kSetAuth:
       std::move(auth_required_callback_).Run(auth_credentials_);
       break;
-    case AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_IO_PENDING:
+    case AuthRequiredResponse::kIoPending:
       NOTREACHED();
       break;
   }
@@ -406,7 +406,7 @@ void ProxyingWebSocket::OnHeadersReceivedCompleteForAuth(
 
   auto continuation = base::BindRepeating(
       &ProxyingWebSocket::OnAuthRequiredComplete, weak_factory_.GetWeakPtr());
-  auto auth_rv = AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_IO_PENDING;
+  auto auth_rv = AuthRequiredResponse::kIoPending;
   PauseIncomingMethodCallProcessing();
 
   OnAuthRequiredComplete(auth_rv);

+ 4 - 4
shell/browser/net/proxying_websocket.h

@@ -40,16 +40,16 @@ class ProxyingWebSocket : public network::mojom::WebSocketHandshakeClient,
   // AuthRequiredResponse indicates how an OnAuthRequired call is handled.
   enum class AuthRequiredResponse {
     // No credentials were provided.
-    AUTH_REQUIRED_RESPONSE_NO_ACTION,
+    kNoAction,
     // AuthCredentials is filled in with a username and password, which should
     // be used in a response to the provided auth challenge.
-    AUTH_REQUIRED_RESPONSE_SET_AUTH,
+    kSetAuth,
     // The request should be canceled.
-    AUTH_REQUIRED_RESPONSE_CANCEL_AUTH,
+    kCancelAuth,
     // The action will be decided asynchronously. |callback| will be invoked
     // when the decision is made, and one of the other AuthRequiredResponse
     // values will be passed in with the same semantics as described above.
-    AUTH_REQUIRED_RESPONSE_IO_PENDING,
+    kIoPending,
   };
 
   ProxyingWebSocket(

+ 1 - 1
shell/browser/ui/cocoa/electron_bundle_mover.h

@@ -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:

+ 4 - 4
shell/browser/ui/cocoa/electron_bundle_mover.mm

@@ -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;
 

+ 2 - 2
shell/browser/ui/cocoa/electron_ns_window.mm

@@ -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];

+ 8 - 8
shell/browser/ui/cocoa/electron_ns_window_delegate.mm

@@ -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();
   }
 }

+ 2 - 2
shell/browser/ui/tray_icon.h

@@ -55,10 +55,10 @@ class TrayIcon {
   virtual std::string GetTitle() = 0;
 #endif
 
-  enum class IconType { None, Info, Warning, Error, Custom };
+  enum class IconType { kNone, kInfo, kWarning, kError, kCustom };
 
   struct BalloonOptions {
-    IconType icon_type = IconType::Custom;
+    IconType icon_type = IconType::kCustom;
 #if defined(OS_WIN)
     HICON icon = nullptr;
 #else

+ 32 - 32
shell/browser/ui/win/jump_list.cc

@@ -83,7 +83,7 @@ bool ConvertShellLinkToJumpListItem(IShellLink* shell_link,
   DCHECK(shell_link);
   DCHECK(item);
 
-  item->type = JumpListItem::Type::TASK;
+  item->type = JumpListItem::Type::kTask;
   wchar_t path[MAX_PATH];
   if (FAILED(shell_link->GetPath(path, base::size(path), nullptr, 0)))
     return false;
@@ -134,7 +134,7 @@ void ConvertRemovedJumpListItems(IObjectArray* in,
     IShellLink* shell_link;
     for (UINT i = 0; i < removed_count; ++i) {
       if (SUCCEEDED(in->GetAt(i, IID_PPV_ARGS(&shell_item)))) {
-        item.type = JumpListItem::Type::FILE;
+        item.type = JumpListItem::Type::kFile;
         GetShellItemFileName(shell_item, &item.path);
         out->push_back(item);
         shell_item->Release();
@@ -217,22 +217,22 @@ bool JumpList::Delete() {
 JumpListResult JumpList::AppendCategory(const JumpListCategory& category) {
   DCHECK(destinations_);
   if (!destinations_)
-    return JumpListResult::GENERIC_ERROR;
+    return JumpListResult::kGenericError;
 
   if (category.items.empty())
-    return JumpListResult::SUCCESS;
+    return JumpListResult::kSuccess;
 
   CComPtr<IObjectCollection> collection;
   if (FAILED(collection.CoCreateInstance(CLSID_EnumerableObjectCollection))) {
-    return JumpListResult::GENERIC_ERROR;
+    return JumpListResult::kGenericError;
   }
 
-  auto result = JumpListResult::SUCCESS;
+  auto result = JumpListResult::kSuccess;
   // Keep track of how many items were actually appended to the category.
   int appended_count = 0;
   for (const auto& item : category.items) {
     switch (item.type) {
-      case JumpListItem::Type::TASK:
+      case JumpListItem::Type::kTask:
         if (AppendTask(item, collection))
           ++appended_count;
         else
@@ -241,8 +241,8 @@ JumpListResult JumpList::AppendCategory(const JumpListCategory& category) {
                         "to Jump List.";
         break;
 
-      case JumpListItem::Type::SEPARATOR:
-        if (category.type == JumpListCategory::Type::TASKS) {
+      case JumpListItem::Type::kSeparator:
+        if (category.type == JumpListCategory::Type::kTasks) {
           if (AppendSeparator(collection))
             ++appended_count;
         } else {
@@ -250,11 +250,11 @@ JumpListResult JumpList::AppendCategory(const JumpListCategory& category) {
                      << "'" << category.name << "'. "
                      << "Separators are only allowed in the standard 'Tasks' "
                         "Jump List category.";
-          result = JumpListResult::CUSTOM_CATEGORY_SEPARATOR_ERROR;
+          result = JumpListResult::kCustomCategorySeparatorError;
         }
         break;
 
-      case JumpListItem::Type::FILE:
+      case JumpListItem::Type::kFile:
         if (AppendFile(item, collection))
           ++appended_count;
         else
@@ -269,17 +269,17 @@ JumpListResult JumpList::AppendCategory(const JumpListCategory& category) {
     return result;
 
   if ((static_cast<size_t>(appended_count) < category.items.size()) &&
-      (result == JumpListResult::SUCCESS)) {
-    result = JumpListResult::GENERIC_ERROR;
+      (result == JumpListResult::kSuccess)) {
+    result = JumpListResult::kGenericError;
   }
 
   CComQIPtr<IObjectArray> items(collection);
 
-  if (category.type == JumpListCategory::Type::TASKS) {
+  if (category.type == JumpListCategory::Type::kTasks) {
     if (FAILED(destinations_->AddUserTasks(items))) {
       LOG(ERROR) << "Failed to append items to the standard Tasks category.";
-      if (result == JumpListResult::SUCCESS)
-        result = JumpListResult::GENERIC_ERROR;
+      if (result == JumpListResult::kSuccess)
+        result = JumpListResult::kGenericError;
     }
   } else {
     HRESULT hr = destinations_->AppendCategory(category.name.c_str(), items);
@@ -288,17 +288,17 @@ JumpListResult JumpList::AppendCategory(const JumpListCategory& category) {
         LOG(ERROR) << "Failed to append custom category "
                    << "'" << category.name << "' "
                    << "to Jump List due to missing file type registration.";
-        result = JumpListResult::MISSING_FILE_TYPE_REGISTRATION_ERROR;
+        result = JumpListResult::kMissingFileTypeRegistrationError;
       } else if (hr == E_ACCESSDENIED) {
         LOG(ERROR) << "Failed to append custom category "
                    << "'" << category.name << "' "
                    << "to Jump List due to system privacy settings.";
-        result = JumpListResult::CUSTOM_CATEGORY_ACCESS_DENIED_ERROR;
+        result = JumpListResult::kCustomCategoryAccessDeniedError;
       } else {
         LOG(ERROR) << "Failed to append custom category "
                    << "'" << category.name << "' to Jump List.";
-        if (result == JumpListResult::SUCCESS)
-          result = JumpListResult::GENERIC_ERROR;
+        if (result == JumpListResult::kSuccess)
+          result = JumpListResult::kGenericError;
       }
     }
   }
@@ -313,36 +313,36 @@ JumpListResult JumpList::AppendCategories(
     const std::vector<JumpListCategory>& categories) {
   DCHECK(destinations_);
   if (!destinations_)
-    return JumpListResult::GENERIC_ERROR;
+    return JumpListResult::kGenericError;
 
-  auto result = JumpListResult::SUCCESS;
+  auto result = JumpListResult::kSuccess;
   for (const auto& category : categories) {
-    auto latestResult = JumpListResult::SUCCESS;
+    auto latestResult = JumpListResult::kSuccess;
     switch (category.type) {
-      case JumpListCategory::Type::TASKS:
-      case JumpListCategory::Type::CUSTOM:
+      case JumpListCategory::Type::kTasks:
+      case JumpListCategory::Type::kCustom:
         latestResult = AppendCategory(category);
         break;
 
-      case JumpListCategory::Type::RECENT:
+      case JumpListCategory::Type::kRecent:
         if (FAILED(destinations_->AppendKnownCategory(KDC_RECENT))) {
           LOG(ERROR) << "Failed to append Recent category to Jump List.";
-          latestResult = JumpListResult::GENERIC_ERROR;
+          latestResult = JumpListResult::kGenericError;
         }
         break;
 
-      case JumpListCategory::Type::FREQUENT:
+      case JumpListCategory::Type::kFrequent:
         if (FAILED(destinations_->AppendKnownCategory(KDC_FREQUENT))) {
           LOG(ERROR) << "Failed to append Frequent category to Jump List.";
-          latestResult = JumpListResult::GENERIC_ERROR;
+          latestResult = JumpListResult::kGenericError;
         }
         break;
     }
     // Keep the first non-generic error code as only one can be returned from
     // the function (so try to make it the most useful one).
-    if (((result == JumpListResult::SUCCESS) ||
-         (result == JumpListResult::GENERIC_ERROR)) &&
-        (latestResult != JumpListResult::SUCCESS))
+    if (((result == JumpListResult::kSuccess) ||
+         (result == JumpListResult::kGenericError)) &&
+        (latestResult != JumpListResult::kSuccess))
       result = latestResult;
   }
   return result;

+ 15 - 15
shell/browser/ui/win/jump_list.h

@@ -15,34 +15,34 @@
 namespace electron {
 
 enum class JumpListResult : int {
-  SUCCESS = 0,
+  kSuccess = 0,
   // In JS code this error will manifest as an exception.
-  ARGUMENT_ERROR = 1,
+  kArgumentError = 1,
   // Generic error, the runtime logs may provide some clues.
-  GENERIC_ERROR = 2,
+  kGenericError = 2,
   // Custom categories can't contain separators.
-  CUSTOM_CATEGORY_SEPARATOR_ERROR = 3,
+  kCustomCategorySeparatorError = 3,
   // The app isn't registered to handle a file type found in a custom category.
-  MISSING_FILE_TYPE_REGISTRATION_ERROR = 4,
+  kMissingFileTypeRegistrationError = 4,
   // Custom categories can't be created due to user privacy settings.
-  CUSTOM_CATEGORY_ACCESS_DENIED_ERROR = 5,
+  kCustomCategoryAccessDeniedError = 5,
 };
 
 struct JumpListItem {
   enum class Type {
     // A task will launch an app (usually the one that created the Jump List)
     // with specific arguments.
-    TASK,
+    kTask,
     // Separators can only be inserted between items in the standard Tasks
     // category, they can't appear in custom categories.
-    SEPARATOR,
+    kSeparator,
     // A file link will open a file using the app that created the Jump List,
     // for this to work the app must be registered as a handler for the file
     // type (though the app doesn't have to be the default handler).
-    FILE
+    kFile
   };
 
-  Type type = Type::TASK;
+  Type type = Type::kTask;
   // For tasks this is the path to the program executable, for file links this
   // is the full filename.
   base::FilePath path;
@@ -61,18 +61,18 @@ struct JumpListItem {
 struct JumpListCategory {
   enum class Type {
     // A custom category can contain tasks and files, but not separators.
-    CUSTOM,
+    kCustom,
     // Frequent/Recent categories are managed by the OS, their name and items
     // can't be set by the app (though items can be set indirectly).
-    FREQUENT,
-    RECENT,
+    kFrequent,
+    kRecent,
     // The standard Tasks category can't be renamed by the app, but the app
     // can set the items that should appear in this category, and those items
     // can include tasks, files, and separators.
-    TASKS
+    kTasks
   };
 
-  Type type = Type::TASKS;
+  Type type = Type::kTasks;
   base::string16 name;
   std::vector<JumpListItem> items;
 

+ 5 - 5
shell/browser/ui/win/notify_icon.cc

@@ -25,15 +25,15 @@ namespace {
 UINT ConvertIconType(electron::TrayIcon::IconType type) {
   using IconType = electron::TrayIcon::IconType;
   switch (type) {
-    case IconType::None:
+    case IconType::kNone:
       return NIIF_NONE;
-    case IconType::Info:
+    case IconType::kInfo:
       return NIIF_INFO;
-    case IconType::Warning:
+    case IconType::kWarning:
       return NIIF_WARNING;
-    case IconType::Error:
+    case IconType::kError:
       return NIIF_ERROR;
-    case IconType::Custom:
+    case IconType::kCustom:
       return NIIF_USER;
     default:
       NOTREACHED() << "Invalid icon type";

+ 14 - 14
shell/browser/web_contents_zoom_controller.cc

@@ -44,14 +44,14 @@ void WebContentsZoomController::SetEmbedderZoomController(
 void WebContentsZoomController::SetZoomLevel(double level) {
   if (!web_contents()->GetRenderViewHost()->IsRenderViewLive() ||
       blink::PageZoomValuesEqual(GetZoomLevel(), level) ||
-      zoom_mode_ == ZoomMode::DISABLED)
+      zoom_mode_ == ZoomMode::kDisabled)
     return;
 
   int render_process_id =
       web_contents()->GetRenderViewHost()->GetProcess()->GetID();
   int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID();
 
-  if (zoom_mode_ == ZoomMode::MANUAL) {
+  if (zoom_mode_ == ZoomMode::kManual) {
     zoom_level_ = level;
 
     for (Observer& observer : observers_)
@@ -62,7 +62,7 @@ void WebContentsZoomController::SetZoomLevel(double level) {
 
   content::HostZoomMap* zoom_map =
       content::HostZoomMap::GetForWebContents(web_contents());
-  if (zoom_mode_ == ZoomMode::ISOLATED ||
+  if (zoom_mode_ == ZoomMode::kIsolated ||
       zoom_map->UsesTemporaryZoomLevel(render_process_id, render_view_id)) {
     zoom_map->SetTemporaryZoomLevel(render_process_id, render_view_id, level);
     // Notify observers of zoom level changes.
@@ -78,7 +78,7 @@ void WebContentsZoomController::SetZoomLevel(double level) {
 }
 
 double WebContentsZoomController::GetZoomLevel() {
-  return zoom_mode_ == ZoomMode::MANUAL
+  return zoom_mode_ == ZoomMode::kManual
              ? zoom_level_
              : content::HostZoomMap::GetZoomLevel(web_contents());
 }
@@ -120,7 +120,7 @@ void WebContentsZoomController::SetZoomMode(ZoomMode new_mode) {
   double original_zoom_level = GetZoomLevel();
 
   switch (new_mode) {
-    case ZoomMode::DEFAULT: {
+    case ZoomMode::kDefault: {
       content::NavigationEntry* entry =
           web_contents()->GetController().GetLastCommittedEntry();
 
@@ -148,11 +148,11 @@ void WebContentsZoomController::SetZoomMode(ZoomMode new_mode) {
       zoom_map->ClearTemporaryZoomLevel(render_process_id, render_view_id);
       break;
     }
-    case ZoomMode::ISOLATED: {
-      // Unless the zoom mode was |ZoomMode::DISABLED| before this call, the
+    case ZoomMode::kIsolated: {
+      // Unless the zoom mode was |ZoomMode::kDisabled| before this call, the
       // page needs an initial isolated zoom back to the same level it was at
       // in the other mode.
-      if (zoom_mode_ != ZoomMode::DISABLED) {
+      if (zoom_mode_ != ZoomMode::kDisabled) {
         zoom_map->SetTemporaryZoomLevel(render_process_id, render_view_id,
                                         original_zoom_level);
       } else {
@@ -164,11 +164,11 @@ void WebContentsZoomController::SetZoomMode(ZoomMode new_mode) {
       }
       break;
     }
-    case ZoomMode::MANUAL: {
-      // Unless the zoom mode was |ZoomMode::DISABLED| before this call, the
+    case ZoomMode::kManual: {
+      // Unless the zoom mode was |ZoomMode::kDisabled| before this call, the
       // page needs to be resized to the default zoom. While in manual mode,
       // the zoom level is handled independently.
-      if (zoom_mode_ != ZoomMode::DISABLED) {
+      if (zoom_mode_ != ZoomMode::kDisabled) {
         zoom_map->SetTemporaryZoomLevel(render_process_id, render_view_id,
                                         GetDefaultZoomLevel());
         zoom_level_ = original_zoom_level;
@@ -181,7 +181,7 @@ void WebContentsZoomController::SetZoomMode(ZoomMode new_mode) {
       }
       break;
     }
-    case ZoomMode::DISABLED: {
+    case ZoomMode::kDisabled: {
       // The page needs to be zoomed back to default before disabling the zoom
       zoom_map->SetTemporaryZoomLevel(render_process_id, render_view_id,
                                       GetDefaultZoomLevel());
@@ -194,7 +194,7 @@ void WebContentsZoomController::SetZoomMode(ZoomMode new_mode) {
 
 void WebContentsZoomController::ResetZoomModeOnNavigationIfNeeded(
     const GURL& url) {
-  if (zoom_mode_ != ZoomMode::ISOLATED && zoom_mode_ != ZoomMode::MANUAL)
+  if (zoom_mode_ != ZoomMode::kIsolated && zoom_mode_ != ZoomMode::kManual)
     return;
 
   int render_process_id =
@@ -208,7 +208,7 @@ void WebContentsZoomController::ResetZoomModeOnNavigationIfNeeded(
   for (Observer& observer : observers_)
     observer.OnZoomLevelChanged(web_contents(), new_zoom_level, false);
   zoom_map->ClearTemporaryZoomLevel(render_process_id, render_view_id);
-  zoom_mode_ = ZoomMode::DEFAULT;
+  zoom_mode_ = ZoomMode::kDefault;
 }
 
 void WebContentsZoomController::DidFinishNavigation(

+ 5 - 5
shell/browser/web_contents_zoom_controller.h

@@ -36,19 +36,19 @@ class WebContentsZoomController
     // Results in default zoom behavior, i.e. zoom changes are handled
     // automatically and on a per-origin basis, meaning that other tabs
     // navigated to the same origin will also zoom.
-    DEFAULT,
+    kDefault,
     // Results in zoom changes being handled automatically, but on a per-tab
     // basis. Tabs in this zoom mode will not be affected by zoom changes in
     // other tabs, and vice versa.
-    ISOLATED,
+    kIsolated,
     // Overrides the automatic handling of zoom changes. The |onZoomChange|
     // event will still be dispatched, but the page will not actually be zoomed.
     // These zoom changes can be handled manually by listening for the
     // |onZoomChange| event. Zooming in this mode is also on a per-tab basis.
-    MANUAL,
+    kManual,
     // Disables all zooming in this tab. The tab will revert to the default
     // zoom level, and all attempted zoom changes will be ignored.
-    DISABLED,
+    kDisabled,
   };
 
   explicit WebContentsZoomController(content::WebContents* web_contents);
@@ -95,7 +95,7 @@ class WebContentsZoomController
   void SetZoomFactorOnNavigationIfNeeded(const GURL& url);
 
   // The current zoom mode.
-  ZoomMode zoom_mode_ = ZoomMode::DEFAULT;
+  ZoomMode zoom_mode_ = ZoomMode::kDefault;
 
   // Current zoom level.
   double zoom_level_ = 1.0;

+ 12 - 12
shell/common/node_bindings.cc

@@ -281,7 +281,7 @@ base::FilePath GetResourcesPath() {
 
 NodeBindings::NodeBindings(BrowserEnvironment browser_env)
     : browser_env_(browser_env), weak_factory_(this) {
-  if (browser_env == BrowserEnvironment::WORKER) {
+  if (browser_env == BrowserEnvironment::kWorker) {
     uv_loop_init(&worker_loop_);
     uv_loop_ = &worker_loop_;
   } else {
@@ -331,7 +331,7 @@ void NodeBindings::Initialize() {
 
 #if defined(OS_LINUX)
   // Get real command line in renderer process forked by zygote.
-  if (browser_env_ != BrowserEnvironment::BROWSER)
+  if (browser_env_ != BrowserEnvironment::kBrowser)
     ElectronCommandLine::InitializeFromCommandLine();
 #endif
 
@@ -360,7 +360,7 @@ void NodeBindings::Initialize() {
 #if defined(OS_WIN)
   // uv_init overrides error mode to suppress the default crash dialog, bring
   // it back if user wants to show it.
-  if (browser_env_ == BrowserEnvironment::BROWSER ||
+  if (browser_env_ == BrowserEnvironment::kBrowser ||
       env->HasVar("ELECTRON_DEFAULT_ERROR_MODE"))
     SetErrorMode(GetErrorMode() & ~SEM_NOGPFAULTERRORBOX);
 #endif
@@ -383,13 +383,13 @@ node::Environment* NodeBindings::CreateEnvironment(
   // Feed node the path to initialization script.
   std::string process_type;
   switch (browser_env_) {
-    case BrowserEnvironment::BROWSER:
+    case BrowserEnvironment::kBrowser:
       process_type = "browser";
       break;
-    case BrowserEnvironment::RENDERER:
+    case BrowserEnvironment::kRenderer:
       process_type = "renderer";
       break;
-    case BrowserEnvironment::WORKER:
+    case BrowserEnvironment::kWorker:
       process_type = "worker";
       break;
   }
@@ -398,7 +398,7 @@ node::Environment* NodeBindings::CreateEnvironment(
   // Do not set DOM globals for renderer process.
   // We must set this before the node bootstrapper which is run inside
   // CreateEnvironment
-  if (browser_env_ != BrowserEnvironment::BROWSER)
+  if (browser_env_ != BrowserEnvironment::kBrowser)
     global.Set("_noBrowserGlobals", true);
 
   std::vector<std::string> exec_args;
@@ -411,7 +411,7 @@ node::Environment* NodeBindings::CreateEnvironment(
       node::CreateIsolateData(context->GetIsolate(), uv_loop_, platform);
 
   node::Environment* env;
-  if (browser_env_ != BrowserEnvironment::BROWSER) {
+  if (browser_env_ != BrowserEnvironment::kBrowser) {
     // Only one ESM loader can be registered per isolate -
     // in renderer processes this should be blink. We need to tell Node.js
     // not to register its handler (overriding blinks) in non-browser processes.
@@ -436,7 +436,7 @@ node::Environment* NodeBindings::CreateEnvironment(
 
   // Clean up the global _noBrowserGlobals that we unironically injected into
   // the global scope
-  if (browser_env_ != BrowserEnvironment::BROWSER) {
+  if (browser_env_ != BrowserEnvironment::kBrowser) {
     // We need to bootstrap the env in non-browser processes so that
     // _noBrowserGlobals is read correctly before we remove it
     global.Delete("_noBrowserGlobals");
@@ -458,7 +458,7 @@ node::Environment* NodeBindings::CreateEnvironment(
   // renderer process.
   is.allow_wasm_code_generation_callback = AllowWasmCodeGenerationCallback;
 
-  if (browser_env_ == BrowserEnvironment::BROWSER) {
+  if (browser_env_ == BrowserEnvironment::kBrowser) {
     // Node.js requires that microtask checkpoints be explicitly invoked.
     is.policy = v8::MicrotasksPolicy::kExplicit;
   } else {
@@ -532,13 +532,13 @@ void NodeBindings::UvRunOnce() {
   // Perform microtask checkpoint after running JavaScript.
   gin_helper::MicrotasksScope microtasks_scope(env->isolate());
 
-  if (browser_env_ != BrowserEnvironment::BROWSER)
+  if (browser_env_ != BrowserEnvironment::kBrowser)
     TRACE_EVENT_BEGIN0("devtools.timeline", "FunctionCall");
 
   // Deal with uv events.
   int r = uv_run(uv_loop_, UV_RUN_NOWAIT);
 
-  if (browser_env_ != BrowserEnvironment::BROWSER)
+  if (browser_env_ != BrowserEnvironment::kBrowser)
     TRACE_EVENT_END0("devtools.timeline", "FunctionCall");
 
   if (r == 0)

+ 1 - 1
shell/common/node_bindings.h

@@ -76,7 +76,7 @@ class UvHandle {
 
 class NodeBindings {
  public:
-  enum class BrowserEnvironment { BROWSER, RENDERER, WORKER };
+  enum class BrowserEnvironment { kBrowser, kRenderer, kWorker };
 
   static NodeBindings* Create(BrowserEnvironment browser_env);
   static void RegisterBuiltinModules();

+ 1 - 1
shell/renderer/api/electron_api_context_bridge.cc

@@ -128,7 +128,7 @@ v8::MaybeLocal<v8::Value> GetPrivate(v8::Local<v8::Context> context,
 }
 
 // Where the context bridge should create the exception it is about to throw
-enum BridgeErrorTarget {
+enum class BridgeErrorTarget {
   // The source / calling context.  This is default and correct 99% of the time,
   // the caller / context asking for the conversion will receive the error and
   // therefore the error should be made in that context

+ 1 - 1
shell/renderer/electron_renderer_client.cc

@@ -39,7 +39,7 @@ ElectronRendererClient* ElectronRendererClient::self_ = nullptr;
 
 ElectronRendererClient::ElectronRendererClient()
     : node_bindings_(
-          NodeBindings::Create(NodeBindings::BrowserEnvironment::RENDERER)),
+          NodeBindings::Create(NodeBindings::BrowserEnvironment::kRenderer)),
       electron_bindings_(new ElectronBindings(node_bindings_->uv_loop())) {
   DCHECK(!self_) << "Cannot have two ElectronRendererClient";
   self_ = this;

+ 1 - 1
shell/renderer/web_worker_observer.cc

@@ -30,7 +30,7 @@ WebWorkerObserver* WebWorkerObserver::GetCurrent() {
 
 WebWorkerObserver::WebWorkerObserver()
     : node_bindings_(
-          NodeBindings::Create(NodeBindings::BrowserEnvironment::WORKER)),
+          NodeBindings::Create(NodeBindings::BrowserEnvironment::kWorker)),
       electron_bindings_(new ElectronBindings(node_bindings_->uv_loop())) {
   lazy_tls.Pointer()->Set(this);
 }