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