Commit 89661019 authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Remove Mac SDK dependency

Chromium compiles with the 10.14 SDK, so remove old code that handled
the case where it compiled with previous SDKs.

Also update property accesses to use property syntax.

Bug: 1044838
Change-Id: Ib7f2e5cd2cfc436dd815e5861d0448262f43955c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2021024
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: default avatarBrandon Jones <bajones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737896}
parent 8cccbcdf
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "device/gamepad/game_controller_data_fetcher_mac.h" #include "device/gamepad/game_controller_data_fetcher_mac.h"
#import <GameController/GameController.h>
#include <string.h> #include <string.h>
#include "base/mac/mac_util.h" #include "base/mac/mac_util.h"
...@@ -12,8 +13,6 @@ ...@@ -12,8 +13,6 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "device/gamepad/gamepad_standard_mappings.h" #include "device/gamepad/gamepad_standard_mappings.h"
#import <GameController/GameController.h>
namespace device { namespace device {
namespace { namespace {
...@@ -81,7 +80,7 @@ void GameControllerDataFetcherMac::GetGamepadData(bool) { ...@@ -81,7 +80,7 @@ void GameControllerDataFetcherMac::GetGamepadData(bool) {
if (!IsSupported(controller)) if (!IsSupported(controller))
continue; continue;
int player_index = [controller playerIndex]; int player_index = controller.playerIndex;
if (player_index != GCControllerPlayerIndexUnset) if (player_index != GCControllerPlayerIndexUnset)
player_indices[player_index] = true; player_indices[player_index] = true;
} }
...@@ -97,7 +96,7 @@ void GameControllerDataFetcherMac::GetGamepadData(bool) { ...@@ -97,7 +96,7 @@ void GameControllerDataFetcherMac::GetGamepadData(bool) {
if (!IsSupported(controller)) if (!IsSupported(controller))
continue; continue;
int player_index = [controller playerIndex]; int player_index = controller.playerIndex;
if (player_index == GCControllerPlayerIndexUnset) { if (player_index == GCControllerPlayerIndexUnset) {
player_index = NextUnusedPlayerIndex(); player_index = NextUnusedPlayerIndex();
if (player_index == GCControllerPlayerIndexUnset) if (player_index == GCControllerPlayerIndexUnset)
...@@ -127,16 +126,8 @@ void GameControllerDataFetcherMac::GetGamepadData(bool) { ...@@ -127,16 +126,8 @@ void GameControllerDataFetcherMac::GetGamepadData(bool) {
pad.connected = true; pad.connected = true;
connected_[player_index] = true; connected_[player_index] = true;
// In OS X 10.11, the type of the GCController playerIndex member was controller.playerIndex =
// changed from NSInteger to a GCControllerPlayerIndex enum. Once Chrome static_cast<GCControllerPlayerIndex>(player_index);
// no longer supports OSX 10.10, the integer version can be removed.
#if !defined(MAC_OS_X_VERSION_10_11) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_11
[controller setPlayerIndex:player_index];
#else
[controller
setPlayerIndex:static_cast<GCControllerPlayerIndex>(player_index)];
#endif
} }
pad.timestamp = CurrentTimeInMicroseconds(); pad.timestamp = CurrentTimeInMicroseconds();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment