Commit 905a291f authored by erikchen's avatar erikchen Committed by Commit bot

Suppress -Wpartial-availability warnings that arise from NSWindowDelegate.

Some methods in the protocol NSWindowDelegate are only declared in an OSX 10.7+
SDK. There is no good way to suppress -Wpartial-availability warnings for
protocols. In BrowserWindowController, redeclare the methods in the private
header. For bridge_native_widget_unittest, use performSelector: to invoke the
methods.

BUG=471823

Review URL: https://codereview.chromium.org/1135333002

Cr-Commit-Position: refs/heads/master@{#330472}
parent 521697f5
...@@ -176,11 +176,6 @@ enum { ...@@ -176,11 +176,6 @@ enum {
aborted:(BOOL)aborted; aborted:(BOOL)aborted;
@end @end
@protocol NSWindowDelegateFullScreenAdditions
- (void)windowDidFailToEnterFullScreen:(NSWindow*)window;
- (void)windowDidFailToExitFullScreen:(NSWindow*)window;
@end
enum { enum {
CBPeripheralStateDisconnected = 0, CBPeripheralStateDisconnected = 0,
CBPeripheralStateConnecting, CBPeripheralStateConnecting,
......
...@@ -164,6 +164,15 @@ ...@@ -164,6 +164,15 @@
// out of AppKit Fullscreen. // out of AppKit Fullscreen.
- (BOOL)shouldUseCustomAppKitFullscreenTransition; - (BOOL)shouldUseCustomAppKitFullscreenTransition;
#if defined(MAC_OS_X_VERSION_10_7) && \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
// Redeclare some methods from NSWindowDelegate to suppress
// -Wpartial-availability warnings.
- (void)windowDidEnterFullScreen:(NSNotification*)notification;
- (void)windowDidExitFullScreen:(NSNotification*)notification;
- (void)windowWillExitFullScreen:(NSNotification*)notification;
#endif
@end // @interface BrowserWindowController(Private) @end // @interface BrowserWindowController(Private)
#endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_ #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#import "ui/gfx/test/ui_cocoa_test_helper.h" #import "ui/gfx/test/ui_cocoa_test_helper.h"
#import "ui/views/cocoa/bridged_content_view.h" #import "ui/views/cocoa/bridged_content_view.h"
#import "ui/views/cocoa/native_widget_mac_nswindow.h" #import "ui/views/cocoa/native_widget_mac_nswindow.h"
#import "ui/views/cocoa/views_nswindow_delegate.h"
#include "ui/views/controls/textfield/textfield.h" #include "ui/views/controls/textfield/textfield.h"
#include "ui/views/ime/input_method.h" #include "ui/views/ime/input_method.h"
#include "ui/views/view.h" #include "ui/views/view.h"
...@@ -489,7 +490,8 @@ TEST_F(BridgedNativeWidgetSimulateFullscreenTest, FailToEnterAndExit) { ...@@ -489,7 +490,8 @@ TEST_F(BridgedNativeWidgetSimulateFullscreenTest, FailToEnterAndExit) {
// Cocoa follows up with a failure message sent to the NSWindowDelegate (there // Cocoa follows up with a failure message sent to the NSWindowDelegate (there
// is no equivalent notification for failure). Called via id so that this // is no equivalent notification for failure). Called via id so that this
// compiles on 10.6. // compiles on 10.6.
id window_delegate = [window delegate]; ViewsNSWindowDelegate* window_delegate =
base::mac::ObjCCast<ViewsNSWindowDelegate>([window delegate]);
[window_delegate windowDidFailToEnterFullScreen:window]; [window_delegate windowDidFailToEnterFullScreen:window];
EXPECT_FALSE(bridge()->target_fullscreen_state()); EXPECT_FALSE(bridge()->target_fullscreen_state());
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import "base/mac/scoped_nsobject.h" #import "base/mac/scoped_nsobject.h"
#include "ui/views/views_export.h"
namespace views { namespace views {
class NativeWidgetMac; class NativeWidgetMac;
...@@ -16,6 +17,7 @@ class BridgedNativeWidget; ...@@ -16,6 +17,7 @@ class BridgedNativeWidget;
// The delegate set on the NSWindow when a views::BridgedNativeWidget is // The delegate set on the NSWindow when a views::BridgedNativeWidget is
// initialized. // initialized.
VIEWS_EXPORT
@interface ViewsNSWindowDelegate : NSObject<NSWindowDelegate> { @interface ViewsNSWindowDelegate : NSObject<NSWindowDelegate> {
@private @private
views::BridgedNativeWidget* parent_; // Weak. Owns this. views::BridgedNativeWidget* parent_; // Weak. Owns this.
...@@ -52,6 +54,11 @@ class BridgedNativeWidget; ...@@ -52,6 +54,11 @@ class BridgedNativeWidget;
returnCode:(NSInteger)returnCode returnCode:(NSInteger)returnCode
contextInfo:(void*)contextInfo; contextInfo:(void*)contextInfo;
// Redeclare methods defined in the protocol NSWindowDelegate which are only
// available on OSX 10.7+.
- (void)windowDidFailToEnterFullScreen:(NSWindow*)window;
- (void)windowDidFailToExitFullScreen:(NSWindow*)window;
@end @end
#endif // UI_VIEWS_COCOA_VIEWS_NSWINDOW_DELEGATE_H_ #endif // UI_VIEWS_COCOA_VIEWS_NSWINDOW_DELEGATE_H_
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