Replace C-style casts with static_cast.

This commit is contained in:
Haojian Wu 2017-03-30 23:05:47 +02:00
parent ff745e1a82
commit e8abee9ca9
5 changed files with 15 additions and 15 deletions

View file

@ -78,11 +78,11 @@ void ShowMessageBox(int type,
if (mate::Converter<atom::MessageBoxCallback>::FromV8(args->isolate(),
peek,
&callback)) {
atom::ShowMessageBox(window, (atom::MessageBoxType)type, buttons,
atom::ShowMessageBox(window, static_cast<atom::MessageBoxType>(type), buttons,
default_id, cancel_id, options, title, message, detail,
checkbox_label, checkbox_checked, icon, callback);
} else {
int chosen = atom::ShowMessageBox(window, (atom::MessageBoxType)type,
int chosen = atom::ShowMessageBox(window, static_cast<atom::MessageBoxType>(type),
buttons, default_id, cancel_id,
options, title, message, detail, icon);
args->Return(chosen);

View file

@ -180,7 +180,7 @@ std::string Browser::GetExecutableFileProductName() const {
int Browser::DockBounce(BounceType type) {
return [[AtomApplication sharedApplication]
requestUserAttention:(NSRequestUserAttentionType)type];
requestUserAttention:static_cast<NSRequestUserAttentionType>(type)];
}
void Browser::DockCancelBounce(int request_id) {

View file

@ -1358,22 +1358,22 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
// they are available in the minimum SDK version
if (type == "selection") {
// NSVisualEffectMaterialSelection
vibrancyType = (NSVisualEffectMaterial) 4;
vibrancyType = static_cast<NSVisualEffectMaterial>( 4);
} else if (type == "menu") {
// NSVisualEffectMaterialMenu
vibrancyType = (NSVisualEffectMaterial) 5;
vibrancyType = static_cast<NSVisualEffectMaterial>( 5);
} else if (type == "popover") {
// NSVisualEffectMaterialPopover
vibrancyType = (NSVisualEffectMaterial) 6;
vibrancyType = static_cast<NSVisualEffectMaterial>( 6);
} else if (type == "sidebar") {
// NSVisualEffectMaterialSidebar
vibrancyType = (NSVisualEffectMaterial) 7;
vibrancyType = static_cast<NSVisualEffectMaterial>( 7);
} else if (type == "medium-light") {
// NSVisualEffectMaterialMediumLight
vibrancyType = (NSVisualEffectMaterial) 8;
vibrancyType = static_cast<NSVisualEffectMaterial>( 8);
} else if (type == "ultra-dark") {
// NSVisualEffectMaterialUltraDark
vibrancyType = (NSVisualEffectMaterial) 9;
vibrancyType = static_cast<NSVisualEffectMaterial>( 9);
}
}

View file

@ -66,7 +66,7 @@ void WebContentsPermissionHelper::RequestPermission(
void WebContentsPermissionHelper::RequestFullscreenPermission(
const base::Callback<void(bool)>& callback) {
RequestPermission((content::PermissionType)(PermissionType::FULLSCREEN),
RequestPermission(static_cast<content::PermissionType>(PermissionType::FULLSCREEN),
callback);
}
@ -86,7 +86,7 @@ void WebContentsPermissionHelper::RequestWebNotificationPermission(
void WebContentsPermissionHelper::RequestPointerLockPermission(
bool user_gesture) {
RequestPermission((content::PermissionType)(PermissionType::POINTER_LOCK),
RequestPermission(static_cast<content::PermissionType>(PermissionType::POINTER_LOCK),
base::Bind(&OnPointerLockResponse, web_contents_),
user_gesture);
}
@ -94,7 +94,7 @@ void WebContentsPermissionHelper::RequestPointerLockPermission(
void WebContentsPermissionHelper::RequestOpenExternalPermission(
const base::Callback<void(bool)>& callback,
bool user_gesture) {
RequestPermission((content::PermissionType)(PermissionType::OPEN_EXTERNAL),
RequestPermission(static_cast<content::PermissionType>(PermissionType::OPEN_EXTERNAL),
callback,
user_gesture);
}

View file

@ -168,11 +168,11 @@ v8::Local<v8::Value> Converter<content::PermissionType>::ToV8(
break;
}
if (val == (content::PermissionType)(PermissionType::POINTER_LOCK))
if (val == static_cast<content::PermissionType>(PermissionType::POINTER_LOCK))
return StringToV8(isolate, "pointerLock");
else if (val == (content::PermissionType)(PermissionType::FULLSCREEN))
else if (val == static_cast<content::PermissionType>(PermissionType::FULLSCREEN))
return StringToV8(isolate, "fullscreen");
else if (val == (content::PermissionType)(PermissionType::OPEN_EXTERNAL))
else if (val == static_cast<content::PermissionType>(PermissionType::OPEN_EXTERNAL))
return StringToV8(isolate, "openExternal");
return StringToV8(isolate, "unknown");