diff options
-rw-r--r-- | base/base.gyp | 1 | ||||
-rw-r--r-- | base/cocoa_protocols_mac.h | 36 | ||||
-rw-r--r-- | chrome/browser/app_modal_dialog_mac.mm | 3 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_mac.h | 6 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_mac.mm | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/autocomplete_text_field_unittest.mm | 4 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller.mm | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bubble_controller.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_button_cell.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_editor_controller.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.mm | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/download_item_cell.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/download_shelf_controller.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/hung_renderer_controller.h | 4 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_window_controller.h | 3 |
15 files changed, 65 insertions, 15 deletions
diff --git a/base/base.gyp b/base/base.gyp index c56839d..0db3328 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -87,6 +87,7 @@ 'clipboard_util.cc', 'clipboard_util.h', 'clipboard_win.cc', + 'cocoa_protocols_mac.h', 'command_line.cc', 'command_line.h', 'compiler_specific.h', diff --git a/base/cocoa_protocols_mac.h b/base/cocoa_protocols_mac.h new file mode 100644 index 0000000..1d38a51 --- /dev/null +++ b/base/cocoa_protocols_mac.h @@ -0,0 +1,36 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_COCOA_PROTOCOLS_MAC_H_ +#define BASE_COCOA_PROTOCOLS_MAC_H_ + +#import <Cocoa/Cocoa.h> + +// The Mac OS X 10.6 SDK introduced new protocols used for delegates. These +// protocol defintions were not present in earlier releases of the Mac OS X +// SDK. In order to support building against the new SDK, which requires +// delegates to conform to these protocols, and earlier SDKs, which do not +// define these protocols at all, this file will provide empty protocol +// definitions when used with earlier SDK versions. + +#if !defined(MAC_OS_X_VERSION_10_6) || \ + MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 + +#define DEFINE_EMPTY_PROTOCOL(p) \ +@protocol p \ +@end + +DEFINE_EMPTY_PROTOCOL(NSAlertDelegate) +DEFINE_EMPTY_PROTOCOL(NSAnimationDelegate) +DEFINE_EMPTY_PROTOCOL(NSMenuDelegate) +DEFINE_EMPTY_PROTOCOL(NSTableViewDataSource) +DEFINE_EMPTY_PROTOCOL(NSTextFieldDelegate) +DEFINE_EMPTY_PROTOCOL(NSTextViewDelegate) +DEFINE_EMPTY_PROTOCOL(NSWindowDelegate) + +#undef DEFINE_EMPTY_PROTOCOL + +#endif + +#endif // BASE_COCOA_PROTOCOLS_MAC_H_ diff --git a/chrome/browser/app_modal_dialog_mac.mm b/chrome/browser/app_modal_dialog_mac.mm index faddb4c4..f6e95f8 100644 --- a/chrome/browser/app_modal_dialog_mac.mm +++ b/chrome/browser/app_modal_dialog_mac.mm @@ -8,13 +8,14 @@ #include "app/l10n_util_mac.h" #include "app/message_box_flags.h" +#import "base/cocoa_protocols_mac.h" #include "base/sys_string_conversions.h" #include "grit/app_strings.h" #include "grit/generated_resources.h" // Helper object that receives the notification that the dialog/sheet is // going away. Is responsible for cleaning itself up. -@interface AppModalDialogHelper : NSObject { +@interface AppModalDialogHelper : NSObject<NSAlertDelegate> { @private NSAlert* alert_; NSTextField* textField_; // WEAK; owned by alert_ diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h index 53fe1ed..df7891b 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h @@ -17,8 +17,8 @@ #include "webkit/glue/window_open_disposition.h" class AutocompleteEditController; -@class AutocompleteEditHelper; class AutocompleteEditModel; +@class AutocompleteFieldDelegate; class AutocompletePopupViewMac; @class AutocompleteTextField; class BubblePositioner; @@ -88,7 +88,7 @@ class AutocompleteEditViewMac : public AutocompleteEditView { virtual bool OnAfterPossibleChange(); virtual gfx::NativeView GetNativeView() const; - // Helper functions for use from AutocompleteEditHelper Objective-C + // Helper functions for use from AutocompleteFieldDelegate Objective-C // class. // Returns true if |popup_view_| is open. @@ -176,7 +176,7 @@ class AutocompleteEditViewMac : public AutocompleteEditView { AutocompleteTextField* field_; // owned by tab controller // Objective-C object to bridge field_ delegate calls to C++. - scoped_nsobject<AutocompleteEditHelper> edit_helper_; + scoped_nsobject<AutocompleteFieldDelegate> edit_helper_; // Selection at the point where the user started using the // arrows to move around in the popup. diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm index 4575fecb..ff81db3 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm @@ -8,6 +8,7 @@ #include "app/gfx/font.h" #include "app/resource_bundle.h" #include "base/clipboard.h" +#import "base/cocoa_protocols_mac.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" @@ -125,7 +126,7 @@ NSRange ComponentToNSRange(const url_parse::Component& component) { // It intercepts various control delegate methods and vectors them to // the edit view. -@interface AutocompleteFieldDelegate : NSObject { +@interface AutocompleteFieldDelegate : NSObject<NSTextFieldDelegate> { @private AutocompleteEditViewMac* edit_view_; // weak, owns us. } diff --git a/chrome/browser/cocoa/autocomplete_text_field_unittest.mm b/chrome/browser/cocoa/autocomplete_text_field_unittest.mm index 56ddc02..8f4f098 100644 --- a/chrome/browser/cocoa/autocomplete_text_field_unittest.mm +++ b/chrome/browser/cocoa/autocomplete_text_field_unittest.mm @@ -4,6 +4,7 @@ #import <Cocoa/Cocoa.h> +#import "base/cocoa_protocols_mac.h" #include "base/scoped_nsobject.h" #import "chrome/browser/cocoa/autocomplete_text_field.h" #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" @@ -26,7 +27,8 @@ - (BOOL)receivedControlTextShouldEndEditing; @end -@interface AutocompleteTextFieldWindowTestDelegate : NSObject { +@interface AutocompleteTextFieldWindowTestDelegate : + NSObject<NSWindowDelegate> { scoped_nsobject<AutocompleteTextFieldEditor> editor_; } - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject; diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm index a8cac69..422fc8f 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller.mm @@ -184,7 +184,7 @@ const CGFloat kBookmarkHorizontalPadding = 1.0; // Return nil if menuItem has no delegate. - (BookmarkNode*)nodeFromMenuItem:(id)menuItem { - NSCell* cell = [[menuItem menu] delegate]; + NSCell* cell = reinterpret_cast<NSCell*>([[menuItem menu] delegate]); if (!cell) return nil; BookmarkNode* node = static_cast<BookmarkNode*>( diff --git a/chrome/browser/cocoa/bookmark_bubble_controller.h b/chrome/browser/cocoa/bookmark_bubble_controller.h index 0760fa0..df387a9 100644 --- a/chrome/browser/cocoa/bookmark_bubble_controller.h +++ b/chrome/browser/cocoa/bookmark_bubble_controller.h @@ -3,6 +3,7 @@ // found in the LICENSE file. #import <Cocoa/Cocoa.h> +#import "base/cocoa_protocols_mac.h" #include "base/scoped_nsobject.h" class BookmarkModel; @@ -32,7 +33,7 @@ class BookmarkNode; // programatically, but encode the view in a nib. Thus, // BookmarkBubbleController is an NSViewController, not an // NSWindowController. -@interface BookmarkBubbleController : NSViewController { +@interface BookmarkBubbleController : NSViewController<NSWindowDelegate> { @private // Unexpected for this controller, perhaps, but our window does NOT // come from a nib. diff --git a/chrome/browser/cocoa/bookmark_button_cell.h b/chrome/browser/cocoa/bookmark_button_cell.h index f6929cb..252ed08 100644 --- a/chrome/browser/cocoa/bookmark_button_cell.h +++ b/chrome/browser/cocoa/bookmark_button_cell.h @@ -5,12 +5,13 @@ #ifndef CHROME_BROWSER_COCOA_BOOKMARK_BUTTON_CELL_H_ #define CHROME_BROWSER_COCOA_BOOKMARK_BUTTON_CELL_H_ +#import "base/cocoa_protocols_mac.h" #import "chrome/browser/cocoa/gradient_button_cell.h" // A button cell that handles drawing/highlighting of buttons in the // bookmark bar. -@interface BookmarkButtonCell : GradientButtonCell { +@interface BookmarkButtonCell : GradientButtonCell<NSMenuDelegate> { } @end diff --git a/chrome/browser/cocoa/bookmark_editor_controller.h b/chrome/browser/cocoa/bookmark_editor_controller.h index 4c80161..89bdac3 100644 --- a/chrome/browser/cocoa/bookmark_editor_controller.h +++ b/chrome/browser/cocoa/bookmark_editor_controller.h @@ -7,13 +7,14 @@ #import <Cocoa/Cocoa.h> +#import "base/cocoa_protocols_mac.h" #include "base/scoped_ptr.h" #include "base/scoped_nsobject.h" #include "chrome/browser/bookmarks/bookmark_editor.h" // A controller for the bookmark editor, opened with Edit... from the // context menu of a bookmark button. -@interface BookmarkEditorController : NSWindowController { +@interface BookmarkEditorController : NSWindowController<NSTextFieldDelegate> { @private IBOutlet NSTextField* nameField_; IBOutlet NSTextField* urlField_; diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index f5764f4..371f4e4 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -799,7 +799,8 @@ willPositionSheet:(NSWindow*)sheet // Get the new controller by asking the new window for its delegate. BrowserWindowController* controller = - [newBrowser->window()->GetNativeHandle() delegate]; + reinterpret_cast<BrowserWindowController*>( + [newBrowser->window()->GetNativeHandle() delegate]); DCHECK(controller && [controller isKindOfClass:[TabWindowController class]]); // Force the added tab to the right size (remove stretching.) diff --git a/chrome/browser/cocoa/download_item_cell.h b/chrome/browser/cocoa/download_item_cell.h index b23f8b5..3c2b7d5 100644 --- a/chrome/browser/cocoa/download_item_cell.h +++ b/chrome/browser/cocoa/download_item_cell.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_COCOA_DOWNLOAD_ITEM_CELL_H_ #define CHROME_BROWSER_COCOA_DOWNLOAD_ITEM_CELL_H_ +#import "base/cocoa_protocols_mac.h" #import "chrome/browser/cocoa/gradient_button_cell.h" #include "base/file_path.h" @@ -23,7 +24,7 @@ enum DownloadItemMousePosition { kDownloadItemMouseOverDropdownPart }; -@interface DownloadItemCell : GradientButtonCell { +@interface DownloadItemCell : GradientButtonCell<NSAnimationDelegate> { @private // Track which part of the button the mouse is over DownloadItemMousePosition mousePosition_; diff --git a/chrome/browser/cocoa/download_shelf_controller.h b/chrome/browser/cocoa/download_shelf_controller.h index 11092b9..d310f7f 100644 --- a/chrome/browser/cocoa/download_shelf_controller.h +++ b/chrome/browser/cocoa/download_shelf_controller.h @@ -4,6 +4,7 @@ #import <Cocoa/Cocoa.h> +#import "base/cocoa_protocols_mac.h" #include "base/scoped_nsobject.h" #include "base/scoped_ptr.h" #import "chrome/browser/cocoa/view_resizer.h" @@ -32,7 +33,7 @@ class DownloadShelf; // UI of an item itself is represented by a button that is drawn by // download_item_cell. -@interface DownloadShelfController : NSViewController { +@interface DownloadShelfController : NSViewController<NSTextViewDelegate> { @private IBOutlet NSScrollView* linkContainer_; IBOutlet NSTextView* showAllDownloadsLink_; diff --git a/chrome/browser/cocoa/hung_renderer_controller.h b/chrome/browser/cocoa/hung_renderer_controller.h index caf61b2..593cf25 100644 --- a/chrome/browser/cocoa/hung_renderer_controller.h +++ b/chrome/browser/cocoa/hung_renderer_controller.h @@ -21,7 +21,9 @@ #include <vector> -@interface HungRendererController : NSWindowController { +#import "base/cocoa_protocols_mac.h" + +@interface HungRendererController : NSWindowController<NSTableViewDataSource> { @private IBOutlet NSButton* waitButton_; IBOutlet NSButton* killButton_; diff --git a/chrome/browser/cocoa/tab_window_controller.h b/chrome/browser/cocoa/tab_window_controller.h index 76dfdc4..9025018 100644 --- a/chrome/browser/cocoa/tab_window_controller.h +++ b/chrome/browser/cocoa/tab_window_controller.h @@ -20,12 +20,13 @@ #import <Cocoa/Cocoa.h> +#import "base/cocoa_protocols_mac.h" #include "base/scoped_nsobject.h" @class TabStripView; @class TabView; -@interface TabWindowController : NSWindowController { +@interface TabWindowController : NSWindowController<NSWindowDelegate> { @private IBOutlet NSView* tabContentArea_; IBOutlet TabStripView* tabStripView_; |