| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 #import "base/cocoa_protocols_mac.h" |
| 6 #include "base/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
| 7 | 8 |
| 8 class BookmarkModel; | 9 class BookmarkModel; |
| 9 class BookmarkNode; | 10 class BookmarkNode; |
| 10 @class BookmarkBubbleController; | 11 @class BookmarkBubbleController; |
| 11 | 12 |
| 12 // Protocol for a BookmarkBubbleController's (BBC's) delegate. | 13 // Protocol for a BookmarkBubbleController's (BBC's) delegate. |
| 13 @protocol BookmarkBubbleControllerDelegate | 14 @protocol BookmarkBubbleControllerDelegate |
| 14 | 15 |
| 15 // The bubble asks the delegate to perform an edit when needed. | 16 // The bubble asks the delegate to perform an edit when needed. |
| 16 - (void)editBookmarkNode:(const BookmarkNode*)node; | 17 - (void)editBookmarkNode:(const BookmarkNode*)node; |
| 17 | 18 |
| 18 // The bubble tells its delegate when it's done and can be deallocated. | 19 // The bubble tells its delegate when it's done and can be deallocated. |
| 19 - (void)doneWithBubbleController:(BookmarkBubbleController*)controller; | 20 - (void)doneWithBubbleController:(BookmarkBubbleController*)controller; |
| 20 | 21 |
| 21 @end | 22 @end |
| 22 | 23 |
| 23 // Controller for the bookmark bubble. The bookmark bubble is a | 24 // Controller for the bookmark bubble. The bookmark bubble is a |
| 24 // bubble that pops up when clicking on the STAR next to the URL to | 25 // bubble that pops up when clicking on the STAR next to the URL to |
| 25 // add or remove it as a bookmark. This bubble allows for editing of | 26 // add or remove it as a bookmark. This bubble allows for editing of |
| 26 // the bookmark in various ways (name, folder, etc.) | 27 // the bookmark in various ways (name, folder, etc.) |
| 27 // | 28 // |
| 28 // The bubble is stored in a nib as a view, not as a window, so we can | 29 // The bubble is stored in a nib as a view, not as a window, so we can |
| 29 // make it an actual bubble. There is no nib-rific way to encode a | 30 // make it an actual bubble. There is no nib-rific way to encode a |
| 30 // NSBorderlessWindowMask NSWindow, and the style of an NSWindow can't | 31 // NSBorderlessWindowMask NSWindow, and the style of an NSWindow can't |
| 31 // be set other than init time. To deal, we create the NSWindow | 32 // be set other than init time. To deal, we create the NSWindow |
| 32 // programatically, but encode the view in a nib. Thus, | 33 // programatically, but encode the view in a nib. Thus, |
| 33 // BookmarkBubbleController is an NSViewController, not an | 34 // BookmarkBubbleController is an NSViewController, not an |
| 34 // NSWindowController. | 35 // NSWindowController. |
| 35 @interface BookmarkBubbleController : NSViewController { | 36 @interface BookmarkBubbleController : NSViewController<NSWindowDelegate> { |
| 36 @private | 37 @private |
| 37 // Unexpected for this controller, perhaps, but our window does NOT | 38 // Unexpected for this controller, perhaps, but our window does NOT |
| 38 // come from a nib. | 39 // come from a nib. |
| 39 scoped_nsobject<NSWindow> window_; | 40 scoped_nsobject<NSWindow> window_; |
| 40 | 41 |
| 41 id<BookmarkBubbleControllerDelegate> delegate_; // weak like other delegates | 42 id<BookmarkBubbleControllerDelegate> delegate_; // weak like other delegates |
| 42 NSWindow* parentWindow_; // weak | 43 NSWindow* parentWindow_; // weak |
| 43 NSPoint topLeftForBubble_; | 44 NSPoint topLeftForBubble_; |
| 44 | 45 |
| 45 // Both weak; owned by the current browser's profile | 46 // Both weak; owned by the current browser's profile |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 - (void)updateBookmarkNode; | 90 - (void)updateBookmarkNode; |
| 90 - (void)setTitle:(NSString *)title parentFolder:(NSString*)folder; | 91 - (void)setTitle:(NSString *)title parentFolder:(NSString*)folder; |
| 91 - (NSString*)chooseAnotherFolderString; | 92 - (NSString*)chooseAnotherFolderString; |
| 92 @end | 93 @end |
| 93 | 94 |
| 94 // Also private but I need to declare them specially for @synthesize to work. | 95 // Also private but I need to declare them specially for @synthesize to work. |
| 95 @interface BookmarkBubbleController () | 96 @interface BookmarkBubbleController () |
| 96 @property (readonly) id delegate; | 97 @property (readonly) id delegate; |
| 97 @property (readonly) NSComboBox* folderComboBox; | 98 @property (readonly) NSComboBox* folderComboBox; |
| 98 @end | 99 @end |
| OLD | NEW |