Commit 4c172144 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

Run "tools/mac/rewrite_modern_objc.py out/gn ../../ui/views"

Bug: 324079
Change-Id: I06c556660ab05975b5a0726cf7e3e72afa9ed070
Reviewed-on: https://chromium-review.googlesource.com/c/1296675Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602057}
parent d7d6e62a
......@@ -21,7 +21,7 @@
// OSExchangeData into the pasteboard.
VIEWS_EXPORT
@interface CocoaDragDropDataProvider : NSObject<NSPasteboardItemDataProvider>
- (id)initWithData:(const ui::OSExchangeData&)data;
- (instancetype)initWithData:(const ui::OSExchangeData&)data;
@end
namespace gfx {
......
......@@ -15,15 +15,15 @@
#import "ui/views_bridge_mac/bridged_native_widget_impl.h"
@interface CocoaDragDropDataProvider ()
- (id)initWithData:(const ui::OSExchangeData&)data;
- (id)initWithPasteboard:(NSPasteboard*)pasteboard;
- (instancetype)initWithData:(const ui::OSExchangeData&)data;
- (instancetype)initWithPasteboard:(NSPasteboard*)pasteboard;
@end
@implementation CocoaDragDropDataProvider {
std::unique_ptr<ui::OSExchangeData> data_;
}
- (id)initWithData:(const ui::OSExchangeData&)data {
- (instancetype)initWithData:(const ui::OSExchangeData&)data {
if ((self = [super init])) {
data_.reset(new OSExchangeData(
std::unique_ptr<OSExchangeData::Provider>(data.provider().Clone())));
......@@ -31,7 +31,7 @@
return self;
}
- (id)initWithPasteboard:(NSPasteboard*)pasteboard {
- (instancetype)initWithPasteboard:(NSPasteboard*)pasteboard {
if ((self = [super init])) {
data_ = ui::OSExchangeDataProviderMac::CreateDataFromPasteboard(pasteboard);
}
......
......@@ -56,7 +56,7 @@ using base::ASCIIToUTF16;
@synthesize draggingFormation;
@synthesize springLoadingHighlight;
- (id)initWithPasteboard:(NSPasteboard*)pasteboard {
- (instancetype)initWithPasteboard:(NSPasteboard*)pasteboard {
if ((self = [super init])) {
pasteboard_ = pasteboard;
}
......
......@@ -257,8 +257,7 @@ class MenuRunnerCocoaTest : public ViewsTestBase,
// An anchor view should only be added for Native menus.
if (GetParam() == MenuType::NATIVE) {
ASSERT_EQ(native_view_subview_count_ + 1, [subviews count]);
last_anchor_frame_ =
[[subviews objectAtIndex:native_view_subview_count_] frame];
last_anchor_frame_ = [subviews[native_view_subview_count_] frame];
} else {
EXPECT_EQ(native_view_subview_count_, [subviews count]);
}
......
......@@ -304,10 +304,10 @@ TEST_F(AXNativeWidgetMacTest, FocusableElementsAreLeafNodes) {
1u,
[[button->GetNativeViewAccessible()
accessibilityAttributeValue:NSAccessibilityChildrenAttribute] count]);
EXPECT_EQ(button->label()->GetNativeViewAccessible(),
[[button->GetNativeViewAccessible()
accessibilityAttributeValue:NSAccessibilityChildrenAttribute]
objectAtIndex:0]);
EXPECT_EQ(
button->label()->GetNativeViewAccessible(),
[button->GetNativeViewAccessible()
accessibilityAttributeValue:NSAccessibilityChildrenAttribute][0]);
// If the child is disabled, it should still be traversable.
button->label()->SetEnabled(false);
......@@ -315,10 +315,10 @@ TEST_F(AXNativeWidgetMacTest, FocusableElementsAreLeafNodes) {
1u,
[[button->GetNativeViewAccessible()
accessibilityAttributeValue:NSAccessibilityChildrenAttribute] count]);
EXPECT_EQ(button->label()->GetNativeViewAccessible(),
[[button->GetNativeViewAccessible()
accessibilityAttributeValue:NSAccessibilityChildrenAttribute]
objectAtIndex:0]);
EXPECT_EQ(
button->label()->GetNativeViewAccessible(),
[button->GetNativeViewAccessible()
accessibilityAttributeValue:NSAccessibilityChildrenAttribute][0]);
}
// Test for NSAccessibilityChildrenAttribute, and ensure it excludes ignored
......@@ -558,7 +558,7 @@ TEST_F(AXNativeWidgetMacTest, ViewWritableAttributes) {
[AttributeValueAtMidpoint(NSAccessibilityFocusedAttribute) boolValue]);
EXPECT_TRUE([ax_node
accessibilityIsAttributeSettable:NSAccessibilityFocusedAttribute]);
[ax_node accessibilitySetValue:[NSNumber numberWithBool:YES]
[ax_node accessibilitySetValue:@YES
forAttribute:NSAccessibilityFocusedAttribute];
EXPECT_TRUE(
[AttributeValueAtMidpoint(NSAccessibilityFocusedAttribute) boolValue]);
......
......@@ -774,8 +774,7 @@ TEST_F(NativeWidgetMacTest, NonWidgetParent) {
child->Show();
EXPECT_TRUE(child->IsVisible());
EXPECT_EQ(1u, [[native_parent childWindows] count]);
EXPECT_EQ(child->GetNativeWindow(),
[[native_parent childWindows] objectAtIndex:0]);
EXPECT_EQ(child->GetNativeWindow(), [native_parent childWindows][0]);
EXPECT_EQ(native_parent,
[child->GetNativeWindow().GetNativeNSWindow() parentWindow]);
......
......@@ -66,8 +66,8 @@ VIEWS_EXPORT
@property(assign, nonatomic) BOOL drawMenuBackgroundForBlur;
// Initialize the NSView -> views::View bridge. |viewToHost| must be non-NULL.
- (id)initWithBridge:(views::BridgedNativeWidgetImpl*)bridge
bounds:(gfx::Rect)rect;
- (instancetype)initWithBridge:(views::BridgedNativeWidgetImpl*)bridge
bounds:(gfx::Rect)rect;
// Clear the hosted view. For example, if it is about to be destroyed.
- (void)clearView;
......
......@@ -254,7 +254,7 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) {
- (void)insertTextInternal:(id)text;
// Returns the native Widget's drag drop client. Possibly null.
- (views_bridge_mac::DragDropClient*)dragDropClient;
- (views_bridge_mac::DragDropClient*)dragDropClient NS_RETURNS_INNER_POINTER;
// Menu action handlers.
- (void)undo:(id)sender;
......@@ -273,8 +273,8 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) {
@synthesize textInputClient = textInputClient_;
@synthesize drawMenuBackgroundForBlur = drawMenuBackgroundForBlur_;
- (id)initWithBridge:(views::BridgedNativeWidgetImpl*)bridge
bounds:(gfx::Rect)bounds {
- (instancetype)initWithBridge:(views::BridgedNativeWidgetImpl*)bridge
bounds:(gfx::Rect)bounds {
// To keep things simple, assume the origin is (0, 0) until there exists a use
// case for something other than that.
DCHECK(bounds.origin().IsOrigin());
......
......@@ -54,7 +54,7 @@ constexpr auto kUIPaintTimeout = base::TimeDelta::FromSeconds(5);
@implementation ViewsNSWindowCloseAnimator
- (id)initWithWindow:(NSWindow*)window {
- (instancetype)initWithWindow:(NSWindow*)window {
if ((self = [super init])) {
window_.reset([window retain]);
animation_.reset(
......
......@@ -28,7 +28,8 @@
@end
@implementation WeakCocoaWindowMoveLoop
- (id)initWithWeakPtr:(const base::WeakPtr<views::CocoaWindowMoveLoop>&)weak {
- (instancetype)initWithWeakPtr:
(const base::WeakPtr<views::CocoaWindowMoveLoop>&)weak {
if ((self = [super init])) {
weak_ = weak;
}
......
......@@ -28,7 +28,8 @@ VIEWS_EXPORT
@property(retain, nonatomic) NSCursor* cursor;
// Initialize with the given |parent|.
- (id)initWithBridgedNativeWidget:(views::BridgedNativeWidgetImpl*)parent;
- (instancetype)initWithBridgedNativeWidget:
(views::BridgedNativeWidgetImpl*)parent;
// Notify that the window has been reordered in (or removed from) the window
// server's screen list. This is a substitute for -[NSWindowDelegate
......
......@@ -14,7 +14,8 @@
@implementation ViewsNSWindowDelegate
- (id)initWithBridgedNativeWidget:(views::BridgedNativeWidgetImpl*)parent {
- (instancetype)initWithBridgedNativeWidget:
(views::BridgedNativeWidgetImpl*)parent {
DCHECK(parent);
if ((self = [super init])) {
parent_ = parent;
......
......@@ -27,7 +27,7 @@ class ViewsScrollbarBridgeDelegate {
// Initializes with the given delegate and registers for notifications on
// scroller style changes.
- (id)initWithDelegate:(ViewsScrollbarBridgeDelegate*)delegate;
- (instancetype)initWithDelegate:(ViewsScrollbarBridgeDelegate*)delegate;
// Sets |delegate_| to nullptr.
- (void)clearDelegate;
......
......@@ -15,7 +15,7 @@
@implementation ViewsScrollbarBridge
- (id)initWithDelegate:(ViewsScrollbarBridgeDelegate*)delegate {
- (instancetype)initWithDelegate:(ViewsScrollbarBridgeDelegate*)delegate {
if ((self = [super init])) {
delegate_ = delegate;
[[NSNotificationCenter defaultCenter]
......
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