refactor: convert more C++ enums to C++11 enum classes (#26850)
This commit is contained in:
parent
3bc220db29
commit
c9b813a1f9
4 changed files with 48 additions and 38 deletions
|
@ -140,12 +140,13 @@ void SystemPreferences::PostNotification(const std::string& name,
|
|||
int SystemPreferences::SubscribeNotification(
|
||||
const std::string& name,
|
||||
const NotificationCallback& callback) {
|
||||
return DoSubscribeNotification(name, callback,
|
||||
kNSDistributedNotificationCenter);
|
||||
return DoSubscribeNotification(
|
||||
name, callback, NotificationCenterKind::kNSDistributedNotificationCenter);
|
||||
}
|
||||
|
||||
void SystemPreferences::UnsubscribeNotification(int request_id) {
|
||||
DoUnsubscribeNotification(request_id, kNSDistributedNotificationCenter);
|
||||
DoUnsubscribeNotification(
|
||||
request_id, NotificationCenterKind::kNSDistributedNotificationCenter);
|
||||
}
|
||||
|
||||
void SystemPreferences::PostLocalNotification(const std::string& name,
|
||||
|
@ -159,11 +160,13 @@ void SystemPreferences::PostLocalNotification(const std::string& name,
|
|||
int SystemPreferences::SubscribeLocalNotification(
|
||||
const std::string& name,
|
||||
const NotificationCallback& callback) {
|
||||
return DoSubscribeNotification(name, callback, kNSNotificationCenter);
|
||||
return DoSubscribeNotification(name, callback,
|
||||
NotificationCenterKind::kNSNotificationCenter);
|
||||
}
|
||||
|
||||
void SystemPreferences::UnsubscribeLocalNotification(int request_id) {
|
||||
DoUnsubscribeNotification(request_id, kNSNotificationCenter);
|
||||
DoUnsubscribeNotification(request_id,
|
||||
NotificationCenterKind::kNSNotificationCenter);
|
||||
}
|
||||
|
||||
void SystemPreferences::PostWorkspaceNotification(
|
||||
|
@ -179,12 +182,13 @@ void SystemPreferences::PostWorkspaceNotification(
|
|||
int SystemPreferences::SubscribeWorkspaceNotification(
|
||||
const std::string& name,
|
||||
const NotificationCallback& callback) {
|
||||
return DoSubscribeNotification(name, callback,
|
||||
kNSWorkspaceNotificationCenter);
|
||||
return DoSubscribeNotification(
|
||||
name, callback, NotificationCenterKind::kNSWorkspaceNotificationCenter);
|
||||
}
|
||||
|
||||
void SystemPreferences::UnsubscribeWorkspaceNotification(int request_id) {
|
||||
DoUnsubscribeNotification(request_id, kNSWorkspaceNotificationCenter);
|
||||
DoUnsubscribeNotification(
|
||||
request_id, NotificationCenterKind::kNSWorkspaceNotificationCenter);
|
||||
}
|
||||
|
||||
int SystemPreferences::DoSubscribeNotification(
|
||||
|
@ -195,13 +199,13 @@ int SystemPreferences::DoSubscribeNotification(
|
|||
__block NotificationCallback copied_callback = callback;
|
||||
NSNotificationCenter* center;
|
||||
switch (kind) {
|
||||
case kNSDistributedNotificationCenter:
|
||||
case NotificationCenterKind::kNSDistributedNotificationCenter:
|
||||
center = [NSDistributedNotificationCenter defaultCenter];
|
||||
break;
|
||||
case kNSNotificationCenter:
|
||||
case NotificationCenterKind::kNSNotificationCenter:
|
||||
center = [NSNotificationCenter defaultCenter];
|
||||
break;
|
||||
case kNSWorkspaceNotificationCenter:
|
||||
case NotificationCenterKind::kNSWorkspaceNotificationCenter:
|
||||
center = [[NSWorkspace sharedWorkspace] notificationCenter];
|
||||
break;
|
||||
default:
|
||||
|
@ -239,13 +243,13 @@ void SystemPreferences::DoUnsubscribeNotification(int request_id,
|
|||
id observer = iter->second;
|
||||
NSNotificationCenter* center;
|
||||
switch (kind) {
|
||||
case kNSDistributedNotificationCenter:
|
||||
case NotificationCenterKind::kNSDistributedNotificationCenter:
|
||||
center = [NSDistributedNotificationCenter defaultCenter];
|
||||
break;
|
||||
case kNSNotificationCenter:
|
||||
case NotificationCenterKind::kNSNotificationCenter:
|
||||
center = [NSNotificationCenter defaultCenter];
|
||||
break;
|
||||
case kNSWorkspaceNotificationCenter:
|
||||
case NotificationCenterKind::kNSWorkspaceNotificationCenter:
|
||||
center = [[NSWorkspace sharedWorkspace] notificationCenter];
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue