Skip to content

Commit

Permalink
Migrate to OS_MAC and OS_APPLE in ui/
Browse files Browse the repository at this point in the history
This migrates:

 defined(OS_MACOSX) -> defined(OS_APPLE)
 defined(OS_MACOSX) && !defined(OS_IOS) -> defined(OS_MAC)
 !defined(OS_MACOSX) || defined(OS_IOS) -> !defined(OS_MAC)

Bug: 1105907
Change-Id: I1f750eadc953115462fcd276ec3ffb3bfb9808ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2321052
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792403}
  • Loading branch information
Avi Drissman authored and Commit Bot committed Jul 28, 2020
1 parent 823d8cf commit 77b05ef
Show file tree
Hide file tree
Showing 179 changed files with 483 additions and 483 deletions.
4 changes: 2 additions & 2 deletions ui/accessibility/ax_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ std::vector<AXNode::AXID> AXNode::GetTableRowNodeIds() const {
return row_node_ids;
}

#if defined(OS_MACOSX)
#if defined(OS_APPLE)

//
// Table column-like nodes. These nodes are only present on macOS.
Expand All @@ -768,7 +768,7 @@ base::Optional<int> AXNode::GetTableColColIndex() const {
return index;
}

#endif // defined(OS_MACOSX)
#endif // defined(OS_APPLE)

//
// Table cell-like nodes.
Expand Down
4 changes: 2 additions & 2 deletions ui/accessibility/ax_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ class AX_EXPORT AXNode final {
// Get the node ids that represent rows in a table.
std::vector<AXNode::AXID> GetTableRowNodeIds() const;

#if defined(OS_MACOSX)
#if defined(OS_APPLE)
// Table column-like nodes. These nodes are only present on macOS.
bool IsTableColumn() const;
base::Optional<int> GetTableColColIndex() const;
#endif // defined(OS_MACOSX)
#endif // defined(OS_APPLE)

// Table cell-like nodes.
bool IsTableCellOrHeader() const;
Expand Down
2 changes: 1 addition & 1 deletion ui/accessibility/ax_table_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void TestTableAPIs(const ui::AXNode* node) {

ignore_result(node->IsTableRow());
ignore_result(node->GetTableRowRowIndex());
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
ignore_result(node->IsTableColumn());
ignore_result(node->GetTableColColIndex());
#endif
Expand Down
2 changes: 1 addition & 1 deletion ui/accessibility/platform/ax_platform_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class AX_EXPORT AXPlatformNode {
// this object.
virtual void NotifyAccessibilityEvent(ax::mojom::Event event_type) = 0;

#if defined(OS_MACOSX)
#if defined(OS_APPLE)
// Fire a platform-specific notification to announce |text|.
virtual void AnnounceText(const base::string16& text) = 0;
#endif
Expand Down
2 changes: 1 addition & 1 deletion ui/accessibility/platform/ax_platform_node_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void AXPlatformNodeBase::NotifyAccessibilityEvent(ax::mojom::Event event_type) {
}
}

#if defined(OS_MACOSX)
#if defined(OS_APPLE)
void AXPlatformNodeBase::AnnounceText(const base::string16& text) {}
#endif

Expand Down
2 changes: 1 addition & 1 deletion ui/accessibility/platform/ax_platform_node_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class AX_EXPORT AXPlatformNodeBase : public AXPlatformNode {
gfx::NativeViewAccessible GetNativeViewAccessible() override;
void NotifyAccessibilityEvent(ax::mojom::Event event_type) override;

#if defined(OS_MACOSX)
#if defined(OS_APPLE)
void AnnounceText(const base::string16& text) override;
#endif

Expand Down
2 changes: 1 addition & 1 deletion ui/aura/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"

#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#error This file must not be included on macOS; Chromium Mac doesn't use Aura.
#endif

Expand Down
14 changes: 7 additions & 7 deletions ui/base/accelerators/accelerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <windows.h>
#endif

#if !defined(OS_WIN) && (defined(USE_AURA) || defined(OS_MACOSX))
#if !defined(OS_WIN) && (defined(USE_AURA) || defined(OS_APPLE))
#include "ui/events/keycodes/keyboard_code_conversion.h"
#endif

Expand Down Expand Up @@ -198,7 +198,7 @@ bool Accelerator::IsRepeat() const {
base::string16 Accelerator::GetShortcutText() const {
base::string16 shortcut;

#if defined(OS_MACOSX)
#if defined(OS_APPLE)
shortcut = KeyCodeToMacSymbol();
#else
shortcut = KeyCodeToName();
Expand All @@ -221,7 +221,7 @@ base::string16 Accelerator::GetShortcutText() const {
// VKEY_UNKNOWN), |::MapVirtualKeyW| returns 0.
if (key != 0)
shortcut += key;
#elif defined(USE_AURA) || defined(OS_MACOSX) || defined(OS_ANDROID)
#elif defined(USE_AURA) || defined(OS_APPLE) || defined(OS_ANDROID)
const uint16_t c = DomCodeToUsLayoutCharacter(
UsLayoutKeyboardCodeToDomCode(key_code_), false);
if (c != 0)
Expand All @@ -230,7 +230,7 @@ base::string16 Accelerator::GetShortcutText() const {
#endif
}

#if defined(OS_MACOSX)
#if defined(OS_APPLE)
shortcut = ApplyShortFormModifiers(shortcut);
#else
// Checking whether the character used for the accelerator is alphanumeric.
Expand Down Expand Up @@ -281,7 +281,7 @@ base::string16 Accelerator::GetShortcutText() const {
return shortcut;
}

#if defined(OS_MACOSX)
#if defined(OS_APPLE)
base::string16 Accelerator::KeyCodeToMacSymbol() const {
switch (key_code_) {
case VKEY_CAPITAL:
Expand Down Expand Up @@ -373,7 +373,7 @@ base::string16 Accelerator::KeyCodeToName() const {
case VKEY_F11:
string_id = IDS_APP_F11_KEY;
break;
#if !defined(OS_MACOSX)
#if !defined(OS_APPLE)
// On Mac, commas and periods are used literally in accelerator text.
case VKEY_OEM_COMMA:
string_id = IDS_APP_COMMA_KEY;
Expand Down Expand Up @@ -414,7 +414,7 @@ base::string16 Accelerator::ApplyLongFormModifiers(
shortcut = ApplyModifierToAcceleratorString(shortcut, IDS_APP_ALT_KEY);

if (IsCmdDown()) {
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
shortcut = ApplyModifierToAcceleratorString(shortcut, IDS_APP_COMMAND_KEY);
#elif defined(OS_CHROMEOS)
shortcut = ApplyModifierToAcceleratorString(shortcut, IDS_APP_SEARCH_KEY);
Expand Down
2 changes: 1 addition & 1 deletion ui/base/accelerators/accelerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class COMPONENT_EXPORT(UI_BASE) Accelerator {
// Returns a string with the localized shortcut if any.
base::string16 GetShortcutText() const;

#if defined(OS_MACOSX)
#if defined(OS_APPLE)
base::string16 KeyCodeToMacSymbol() const;
#endif
base::string16 KeyCodeToName() const;
Expand Down
4 changes: 2 additions & 2 deletions ui/base/accelerators/accelerator_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ TEST(AcceleratorTest, MAYBE_GetShortcutText) {
{VKEY_A, EF_ALT_DOWN | EF_SHIFT_DOWN, "Alt+Shift+A", "\u2325\u21e7A"},
// Regression test for https://crbug.com/867732:
{VKEY_OEM_COMMA, EF_CONTROL_DOWN, "Ctrl+Comma", "\u2303,"},
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
{VKEY_T, EF_COMMAND_DOWN | EF_CONTROL_DOWN, nullptr, "\u2303\u2318T"},
#endif
};

for (const auto& key : keys) {
base::string16 text =
Accelerator(key.code, key.modifiers).GetShortcutText();
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
EXPECT_EQ(text, base::UTF8ToUTF16(key.expected_short));
#else
EXPECT_EQ(text, base::UTF8ToUTF16(key.expected_long));
Expand Down
2 changes: 1 addition & 1 deletion ui/base/clipboard/clipboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD) Clipboard
case ClipboardBuffer::kCopyPaste:
return true;
case ClipboardBuffer::kSelection:
#if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
#if !defined(OS_WIN) && !defined(OS_APPLE) && !defined(OS_CHROMEOS)
return true;
#else
return false;
Expand Down
4 changes: 2 additions & 2 deletions ui/base/clipboard/clipboard_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ const char kMimeTypeDownloadURL[] = "downloadurl";
const char kMimeTypeHTML[] = "text/html";
const char kMimeTypeRTF[] = "text/rtf";
const char kMimeTypePNG[] = "image/png";
#if !defined(OS_MACOSX)
#if !defined(OS_APPLE)
// TODO(dcheng): This name is temporary. See crbug.com/106449.
const char kMimeTypeWebCustomData[] = "chromium/x-web-custom-data";
const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste";
const char kMimeTypePepperCustomData[] = "chromium/x-pepper-custom-data";
#endif // defined(OS_MACOSX)
#endif // defined(OS_APPLE)

#if defined(OS_ANDROID)
const char kMimeTypeImageURI[] = "image-uri";
Expand Down
8 changes: 4 additions & 4 deletions ui/base/clipboard/clipboard_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
#include "base/component_export.h"
#include "build/build_config.h"

#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#ifdef __OBJC__
@class NSString;
#else
class NSString;
#endif
#endif // defined(OS_MACOSX)
#endif // defined(OS_APPLE)

namespace ui {

Expand All @@ -31,7 +31,7 @@ extern const char kMimeTypeMozillaURL[];
COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES) extern const char kMimeTypeHTML[];
COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES) extern const char kMimeTypeRTF[];
COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES) extern const char kMimeTypePNG[];
#if !defined(OS_MACOSX)
#if !defined(OS_APPLE)
COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES)
extern const char kMimeTypeWebCustomData[];
COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES)
Expand All @@ -58,7 +58,7 @@ extern NSString* const kPepperCustomDataPboardType;
COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES)
extern NSString* const kUTTypeConfidentialData;

#endif // defined(OS_MACOSX)
#endif // defined(OS_APPLE)

#if defined(OS_ANDROID)
COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES) extern const char kMimeTypeImageURI[];
Expand Down
8 changes: 4 additions & 4 deletions ui/base/clipboard/clipboard_format_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
#include <objidl.h>
#endif

#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#ifdef __OBJC__
@class NSString;
#else
class NSString;
#endif
#endif // defined(OS_MACOSX)
#endif // defined(OS_APPLE)

namespace ui {

Expand Down Expand Up @@ -94,7 +94,7 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES) ClipboardFormatType {
std::string GetName() const;
#if defined(OS_WIN)
const FORMATETC& ToFormatEtc() const { return data_; }
#elif defined(OS_MACOSX)
#elif defined(OS_APPLE)
NSString* ToNSString() const { return data_; }
// Custom copy and assignment constructor to handle NSString.
ClipboardFormatType(const ClipboardFormatType& other);
Expand Down Expand Up @@ -133,7 +133,7 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES) ClipboardFormatType {
#elif defined(USE_AURA) || defined(OS_ANDROID) || defined(OS_FUCHSIA)
explicit ClipboardFormatType(const std::string& native_format);
std::string data_;
#elif defined(OS_MACOSX)
#elif defined(OS_APPLE)
explicit ClipboardFormatType(NSString* native_format);
NSString* data_;
#else
Expand Down
10 changes: 5 additions & 5 deletions ui/base/clipboard/clipboard_test_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ TYPED_TEST(ClipboardTest, UnicodeHTMLTest) {
}

// TODO(estade): Port the following test (decide what target we use for urls)
#if !defined(OS_POSIX) || defined(OS_MACOSX)
#if !defined(OS_POSIX) || defined(OS_APPLE)
TYPED_TEST(ClipboardTest, BookmarkTest) {
base::string16 title(ASCIIToUTF16("The Example Company")), title_result;
std::string url("http://www.example.com/"), url_result;
Expand All @@ -380,7 +380,7 @@ TYPED_TEST(ClipboardTest, BookmarkTest) {
EXPECT_EQ(title, title_result);
EXPECT_EQ(url, url_result);
}
#endif // !defined(OS_POSIX) || defined(OS_MACOSX)
#endif // !defined(OS_POSIX) || defined(OS_APPLE)

TYPED_TEST(ClipboardTest, MultiFormatTest) {
base::string16 text(ASCIIToUTF16("Hi!")), text_result;
Expand Down Expand Up @@ -461,7 +461,7 @@ TYPED_TEST(ClipboardTest, URLTest) {

// TODO(tonikitoo, msisov): enable back for ClipboardOzone implements
// selection support. https://crbug.com/911992
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) && \
#if defined(OS_POSIX) && !defined(OS_APPLE) && !defined(OS_ANDROID) && \
!defined(OS_CHROMEOS) && !defined(USE_OZONE)
ascii_text.clear();
this->clipboard().ReadAsciiText(ClipboardBuffer::kSelection,
Expand Down Expand Up @@ -783,7 +783,7 @@ TYPED_TEST(ClipboardTest, ReadAvailablePlatformSpecificFormatNamesTest) {
const std::vector<base::string16> raw_types =
this->clipboard().ReadAvailablePlatformSpecificFormatNames(
ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr);
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
EXPECT_THAT(raw_types, Contains(ASCIIToUTF16("public.utf8-plain-text")));
EXPECT_THAT(raw_types, Contains(ASCIIToUTF16("NSStringPboardType")));
EXPECT_EQ(raw_types.size(), static_cast<uint64_t>(2));
Expand Down Expand Up @@ -880,7 +880,7 @@ TYPED_TEST(ClipboardTest, PlatformSpecificDataTest) {
}
#endif // defined(OS_WIN) || defined(USE_X11)

#if !defined(OS_MACOSX) && !defined(OS_ANDROID)
#if !defined(OS_APPLE) && !defined(OS_ANDROID)
TYPED_TEST(ClipboardTest, HyperlinkTest) {
const std::string kTitle("The <Example> Company's \"home page\"");
const std::string kUrl("http://www.example.com?x=3&lt=3#\"'<>");
Expand Down
2 changes: 1 addition & 1 deletion ui/base/clipboard/test/test_clipboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ TestClipboard::ReadAvailablePlatformSpecificFormatNames(
#elif defined(OS_WIN)
types.push_back(base::ASCIIToUTF16("CF_LOCALE"));
types.push_back(base::ASCIIToUTF16("CF_OEMTEXT"));
#elif defined(OS_MACOSX)
#elif defined(OS_APPLE)
types.push_back(base::ASCIIToUTF16("NSStringPboardType"));
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions ui/base/default_style.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ namespace ui {
const int kMessageFontSizeDelta = 0;

// Default font size delta for dialog buttons, textfields, and labels.
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
// Aim for 12pt for Cocoa labels ([NSFont systemFontSize] is typically 13pt).
const int kLabelFontSizeDelta = -1;
#else
const int kLabelFontSizeDelta = 0;
#endif

// Font size delta for dialog titles.
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
const int kTitleFontSizeDelta = 1;
#else
const int kTitleFontSizeDelta = 3;
Expand Down
2 changes: 1 addition & 1 deletion ui/base/dragdrop/drag_drop_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class COMPONENT_EXPORT(UI_BASE) DragDropTypes {
static int DropEffectToDragOperation(uint32_t effect);
#endif

#if defined(OS_MACOSX)
#if defined(OS_APPLE)
static uint64_t DragOperationToNSDragOperation(int drag_operation);
static int NSDragOperationToDragOperation(uint64_t ns_drag_operation);
#endif
Expand Down
4 changes: 2 additions & 2 deletions ui/base/dragdrop/os_exchange_data_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "ui/base/dragdrop/file_info/file_info.h"
#include "url/gurl.h"

#if defined(USE_AURA) || defined(OS_MACOSX)
#if defined(USE_AURA) || defined(OS_APPLE)
#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/image/image_skia.h"
#endif
Expand Down Expand Up @@ -99,7 +99,7 @@ class COMPONENT_EXPORT(UI_BASE_DATA_EXCHANGE) OSExchangeDataProvider {
virtual bool HasHtml() const = 0;
#endif

#if defined(USE_AURA) || defined(OS_MACOSX)
#if defined(USE_AURA) || defined(OS_APPLE)
virtual void SetDragImage(const gfx::ImageSkia& image,
const gfx::Vector2d& cursor_offset) = 0;
virtual gfx::ImageSkia GetDragImage() const = 0;
Expand Down
4 changes: 2 additions & 2 deletions ui/base/dragdrop/os_exchange_data_provider_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#if defined(USE_X11)
#include "ui/base/dragdrop/os_exchange_data_provider_x11.h"
#endif // defined(USE_X11)
#elif defined(OS_MACOSX)
#elif defined(OS_APPLE)
#include "ui/base/dragdrop/os_exchange_data_provider_builder_mac.h"
#elif defined(OS_WIN)
#include "ui/base/dragdrop/os_exchange_data_provider_win.h"
Expand Down Expand Up @@ -58,7 +58,7 @@ OSExchangeDataProviderFactory::CreateProvider() {
#endif // defined(USE_X11)
NOTREACHED();
return nullptr;
#elif defined(OS_MACOSX)
#elif defined(OS_APPLE)
return BuildOSExchangeDataProviderMac();
#elif defined(OS_WIN)
return std::make_unique<OSExchangeDataProviderWin>();
Expand Down
2 changes: 1 addition & 1 deletion ui/base/idle/idle.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enum IdleState {
};

// For MacOSX, InitIdleMonitor needs to be called first to setup the monitor.
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
COMPONENT_EXPORT(UI_BASE_IDLE) void InitIdleMonitor();
#endif

Expand Down
Loading

0 comments on commit 77b05ef

Please sign in to comment.