summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerikchen <erikchen@chromium.org>2015-05-18 20:44:44 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-19 03:44:41 +0000
commit905a291f9595753d0ed663761eff707d5579c48c (patch)
treed9a78490a2c553b697c2e5bdb36c73f16b26c608
parent521697f5d826185b5e7126466110e72f1da2a26f (diff)
downloadchromium_src-905a291f9595753d0ed663761eff707d5579c48c.zip
chromium_src-905a291f9595753d0ed663761eff707d5579c48c.tar.gz
chromium_src-905a291f9595753d0ed663761eff707d5579c48c.tar.bz2
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}
-rw-r--r--base/mac/sdk_forward_declarations.h5
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller_private.h9
-rw-r--r--ui/views/cocoa/bridged_native_widget_unittest.mm4
-rw-r--r--ui/views/cocoa/views_nswindow_delegate.h7
4 files changed, 19 insertions, 6 deletions
diff --git a/base/mac/sdk_forward_declarations.h b/base/mac/sdk_forward_declarations.h
index d70a6aa..e45ab43 100644
--- a/base/mac/sdk_forward_declarations.h
+++ b/base/mac/sdk_forward_declarations.h
@@ -176,11 +176,6 @@ enum {
aborted:(BOOL)aborted;
@end
-@protocol NSWindowDelegateFullScreenAdditions
-- (void)windowDidFailToEnterFullScreen:(NSWindow*)window;
-- (void)windowDidFailToExitFullScreen:(NSWindow*)window;
-@end
-
enum {
CBPeripheralStateDisconnected = 0,
CBPeripheralStateConnecting,
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.h b/chrome/browser/ui/cocoa/browser_window_controller_private.h
index d50964f..0fd1077 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.h
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.h
@@ -164,6 +164,15 @@
// out of AppKit Fullscreen.
- (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)
#endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_
diff --git a/ui/views/cocoa/bridged_native_widget_unittest.mm b/ui/views/cocoa/bridged_native_widget_unittest.mm
index 3cf3dc2..c61b18b 100644
--- a/ui/views/cocoa/bridged_native_widget_unittest.mm
+++ b/ui/views/cocoa/bridged_native_widget_unittest.mm
@@ -17,6 +17,7 @@
#import "ui/gfx/test/ui_cocoa_test_helper.h"
#import "ui/views/cocoa/bridged_content_view.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/ime/input_method.h"
#include "ui/views/view.h"
@@ -489,7 +490,8 @@ TEST_F(BridgedNativeWidgetSimulateFullscreenTest, FailToEnterAndExit) {
// Cocoa follows up with a failure message sent to the NSWindowDelegate (there
// is no equivalent notification for failure). Called via id so that this
// compiles on 10.6.
- id window_delegate = [window delegate];
+ ViewsNSWindowDelegate* window_delegate =
+ base::mac::ObjCCast<ViewsNSWindowDelegate>([window delegate]);
[window_delegate windowDidFailToEnterFullScreen:window];
EXPECT_FALSE(bridge()->target_fullscreen_state());
diff --git a/ui/views/cocoa/views_nswindow_delegate.h b/ui/views/cocoa/views_nswindow_delegate.h
index ec8e6e1..dc0b201 100644
--- a/ui/views/cocoa/views_nswindow_delegate.h
+++ b/ui/views/cocoa/views_nswindow_delegate.h
@@ -8,6 +8,7 @@
#import <Cocoa/Cocoa.h>
#import "base/mac/scoped_nsobject.h"
+#include "ui/views/views_export.h"
namespace views {
class NativeWidgetMac;
@@ -16,6 +17,7 @@ class BridgedNativeWidget;
// The delegate set on the NSWindow when a views::BridgedNativeWidget is
// initialized.
+VIEWS_EXPORT
@interface ViewsNSWindowDelegate : NSObject<NSWindowDelegate> {
@private
views::BridgedNativeWidget* parent_; // Weak. Owns this.
@@ -52,6 +54,11 @@ class BridgedNativeWidget;
returnCode:(NSInteger)returnCode
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
#endif // UI_VIEWS_COCOA_VIEWS_NSWINDOW_DELEGATE_H_