| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 6 |
| 7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 9 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h" |
| 11 | 11 |
| 12 class ChromeBookmarkClient; | |
| 13 @class BookmarkBubbleController; | 12 @class BookmarkBubbleController; |
| 14 @class BookmarkSyncPromoController; | 13 @class BookmarkSyncPromoController; |
| 15 | 14 |
| 16 namespace bookmarks { | 15 namespace bookmarks { |
| 17 class BookmarkModel; | 16 class BookmarkModel; |
| 18 class BookmarkNode; | 17 class BookmarkNode; |
| 18 class ManagedBookmarkService; |
| 19 } | 19 } |
| 20 | 20 |
| 21 // Controller for the bookmark bubble. The bookmark bubble is a | 21 // Controller for the bookmark bubble. The bookmark bubble is a |
| 22 // bubble that pops up when clicking on the STAR next to the URL to | 22 // bubble that pops up when clicking on the STAR next to the URL to |
| 23 // add or remove it as a bookmark. This bubble allows for editing of | 23 // add or remove it as a bookmark. This bubble allows for editing of |
| 24 // the bookmark in various ways (name, folder, etc.) | 24 // the bookmark in various ways (name, folder, etc.) |
| 25 @interface BookmarkBubbleController : BaseBubbleController { | 25 @interface BookmarkBubbleController : BaseBubbleController { |
| 26 @private | 26 @private |
| 27 // |client_|, |model_| and |node_| are weak and owned by the current browser's | 27 // |managed_|, |model_| and |node_| are weak and owned by the current |
| 28 // profile. | 28 // browser's profile. |
| 29 ChromeBookmarkClient* client_; // weak | 29 bookmarks::ManagedBookmarkService* managed_; // weak |
| 30 bookmarks::BookmarkModel* model_; // weak | 30 bookmarks::BookmarkModel* model_; // weak |
| 31 const bookmarks::BookmarkNode* node_; // weak | 31 const bookmarks::BookmarkNode* node_; // weak |
| 32 | 32 |
| 33 // The bookmark node whose button we asked to pulse. | 33 // The bookmark node whose button we asked to pulse. |
| 34 const bookmarks::BookmarkNode* pulsingBookmarkNode_; // weak | 34 const bookmarks::BookmarkNode* pulsingBookmarkNode_; // weak |
| 35 | 35 |
| 36 BOOL alreadyBookmarked_; | 36 BOOL alreadyBookmarked_; |
| 37 | 37 |
| 38 // Ping me when the bookmark model changes out from under us. | 38 // Ping me when the bookmark model changes out from under us. |
| 39 scoped_ptr<BookmarkModelObserverForCocoa> bookmarkObserver_; | 39 scoped_ptr<BookmarkModelObserverForCocoa> bookmarkObserver_; |
| 40 | 40 |
| 41 // Sync promo controller, if the sync promo is displayed. | 41 // Sync promo controller, if the sync promo is displayed. |
| 42 base::scoped_nsobject<BookmarkSyncPromoController> syncPromoController_; | 42 base::scoped_nsobject<BookmarkSyncPromoController> syncPromoController_; |
| 43 | 43 |
| 44 IBOutlet NSTextField* bigTitle_; // "Bookmark" or "Bookmark Added!" | 44 IBOutlet NSTextField* bigTitle_; // "Bookmark" or "Bookmark Added!" |
| 45 IBOutlet NSTextField* nameTextField_; | 45 IBOutlet NSTextField* nameTextField_; |
| 46 IBOutlet NSPopUpButton* folderPopUpButton_; | 46 IBOutlet NSPopUpButton* folderPopUpButton_; |
| 47 IBOutlet NSView* syncPromoPlaceholder_; | 47 IBOutlet NSView* syncPromoPlaceholder_; |
| 48 } | 48 } |
| 49 | 49 |
| 50 @property(readonly, nonatomic) const bookmarks::BookmarkNode* node; | 50 @property(readonly, nonatomic) const bookmarks::BookmarkNode* node; |
| 51 | 51 |
| 52 // |node| is the bookmark node we edit in this bubble. | 52 // |node| is the bookmark node we edit in this bubble. |
| 53 // |alreadyBookmarked| tells us if the node was bookmarked before the | 53 // |alreadyBookmarked| tells us if the node was bookmarked before the |
| 54 // user clicked on the star. (if NO, this is a brand new bookmark). | 54 // user clicked on the star. (if NO, this is a brand new bookmark). |
| 55 // The owner of this object is responsible for showing the bubble if | 55 // The owner of this object is responsible for showing the bubble if |
| 56 // it desires it to be visible on the screen. It is not shown by the | 56 // it desires it to be visible on the screen. It is not shown by the |
| 57 // init routine. Closing of the window happens implicitly on dealloc. | 57 // init routine. Closing of the window happens implicitly on dealloc. |
| 58 - (id)initWithParentWindow:(NSWindow*)parentWindow | 58 - (id)initWithParentWindow:(NSWindow*)parentWindow |
| 59 client:(ChromeBookmarkClient*)client | 59 managed:(bookmarks::ManagedBookmarkService*)managed |
| 60 model:(bookmarks::BookmarkModel*)model | 60 model:(bookmarks::BookmarkModel*)model |
| 61 node:(const bookmarks::BookmarkNode*)node | 61 node:(const bookmarks::BookmarkNode*)node |
| 62 alreadyBookmarked:(BOOL)alreadyBookmarked; | 62 alreadyBookmarked:(BOOL)alreadyBookmarked; |
| 63 | 63 |
| 64 // Actions for buttons in the dialog. | 64 // Actions for buttons in the dialog. |
| 65 - (IBAction)ok:(id)sender; | 65 - (IBAction)ok:(id)sender; |
| 66 - (IBAction)remove:(id)sender; | 66 - (IBAction)remove:(id)sender; |
| 67 - (IBAction)cancel:(id)sender; | 67 - (IBAction)cancel:(id)sender; |
| 68 | 68 |
| 69 // These actions send a -editBookmarkNode: action up the responder chain. | 69 // These actions send a -editBookmarkNode: action up the responder chain. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 80 | 80 |
| 81 - (void)addFolderNodes:(const bookmarks::BookmarkNode*)parent | 81 - (void)addFolderNodes:(const bookmarks::BookmarkNode*)parent |
| 82 toPopUpButton:(NSPopUpButton*)button | 82 toPopUpButton:(NSPopUpButton*)button |
| 83 indentation:(int)indentation; | 83 indentation:(int)indentation; |
| 84 - (void)setTitle:(NSString*)title | 84 - (void)setTitle:(NSString*)title |
| 85 parentFolder:(const bookmarks::BookmarkNode*)parent; | 85 parentFolder:(const bookmarks::BookmarkNode*)parent; |
| 86 - (void)setParentFolderSelection:(const bookmarks::BookmarkNode*)parent; | 86 - (void)setParentFolderSelection:(const bookmarks::BookmarkNode*)parent; |
| 87 + (NSString*)chooseAnotherFolderString; | 87 + (NSString*)chooseAnotherFolderString; |
| 88 - (NSPopUpButton*)folderPopUpButton; | 88 - (NSPopUpButton*)folderPopUpButton; |
| 89 @end | 89 @end |
| OLD | NEW |