| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | |
| 11 #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" |
| 12 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" | 11 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" |
| 12 #import "chrome/browser/ui/cocoa/omnibox_icon_bubble_controller.h" |
| 13 | 13 |
| 14 @class BookmarkBubbleController; | 14 @class BookmarkBubbleController; |
| 15 @class BubbleSyncPromoController; | 15 @class BubbleSyncPromoController; |
| 16 class LocationBarDecoration; |
| 16 | 17 |
| 17 namespace bookmarks { | 18 namespace bookmarks { |
| 18 class BookmarkBubbleObserver; | 19 class BookmarkBubbleObserver; |
| 19 class BookmarkModel; | 20 class BookmarkModel; |
| 20 class BookmarkNode; | 21 class BookmarkNode; |
| 21 class ManagedBookmarkService; | 22 class ManagedBookmarkService; |
| 22 } | 23 } |
| 23 | 24 |
| 24 // Controller for the bookmark bubble. The bookmark bubble is a | 25 // Controller for the bookmark bubble. The bookmark bubble is a |
| 25 // bubble that pops up when clicking on the STAR next to the URL to | 26 // bubble that pops up when clicking on the STAR next to the URL to |
| 26 // add or remove it as a bookmark. This bubble allows for editing of | 27 // add or remove it as a bookmark. This bubble allows for editing of |
| 27 // the bookmark in various ways (name, folder, etc.) | 28 // the bookmark in various ways (name, folder, etc.) |
| 28 @interface BookmarkBubbleController | 29 @interface BookmarkBubbleController |
| 29 : BaseBubbleController<HasWeakBrowserPointer> { | 30 : OmniboxIconBubbleController<HasWeakBrowserPointer> { |
| 30 @private | 31 @private |
| 31 // |managed_|, |model_| and |node_| are weak and owned by the current | 32 // |managed_|, |model_| and |node_| are weak and owned by the current |
| 32 // browser's profile. | 33 // browser's profile. |
| 33 bookmarks::ManagedBookmarkService* managedBookmarkService_; // weak | 34 bookmarks::ManagedBookmarkService* managedBookmarkService_; // weak |
| 34 bookmarks::BookmarkModel* model_; // weak | 35 bookmarks::BookmarkModel* model_; // weak |
| 35 const bookmarks::BookmarkNode* node_; // weak | 36 const bookmarks::BookmarkNode* node_; // weak |
| 36 | 37 |
| 37 // Inform the observer when the bubble is shown or closed. | 38 // Inform the observer when the bubble is shown or closed. |
| 38 bookmarks::BookmarkBubbleObserver* bookmarkBubbleObserver_; // weak | 39 bookmarks::BookmarkBubbleObserver* bookmarkBubbleObserver_; // weak |
| 39 | 40 |
| 40 BOOL alreadyBookmarked_; | 41 BOOL alreadyBookmarked_; |
| 41 | 42 |
| 42 // Ping me when the bookmark model changes out from under us. | 43 // Ping me when the bookmark model changes out from under us. |
| 43 std::unique_ptr<BookmarkModelObserverForCocoa> bookmarkObserver_; | 44 std::unique_ptr<BookmarkModelObserverForCocoa> bookmarkObserver_; |
| 44 | 45 |
| 45 // Sync promo controller, if the sync promo is displayed. | 46 // Sync promo controller, if the sync promo is displayed. |
| 46 base::scoped_nsobject<BubbleSyncPromoController> syncPromoController_; | 47 base::scoped_nsobject<BubbleSyncPromoController> syncPromoController_; |
| 47 | 48 |
| 48 IBOutlet NSTextField* bigTitle_; // "Bookmark" or "Bookmark Added!" | 49 IBOutlet NSTextField* bigTitle_; // "Bookmark" or "Bookmark Added!" |
| 49 IBOutlet NSTextField* nameTextField_; | 50 IBOutlet NSTextField* nameTextField_; |
| 50 IBOutlet NSPopUpButton* folderPopUpButton_; | 51 IBOutlet NSPopUpButton* folderPopUpButton_; |
| 51 IBOutlet NSView* syncPromoPlaceholder_; | 52 IBOutlet NSView* syncPromoPlaceholder_; |
| 53 |
| 54 // The star icon in the omnibox. |
| 55 LocationBarDecoration* decoration_; // weak |
| 52 } | 56 } |
| 53 | 57 |
| 54 @property(readonly, nonatomic) const bookmarks::BookmarkNode* node; | 58 @property(readonly, nonatomic) const bookmarks::BookmarkNode* node; |
| 55 | 59 |
| 56 // |node| is the bookmark node we edit in this bubble. | 60 // |node| is the bookmark node we edit in this bubble. |
| 57 // |alreadyBookmarked| tells us if the node was bookmarked before the | 61 // |alreadyBookmarked| tells us if the node was bookmarked before the |
| 58 // user clicked on the star. (if NO, this is a brand new bookmark). | 62 // user clicked on the star. (if NO, this is a brand new bookmark). |
| 59 // The owner of this object is responsible for showing the bubble if | 63 // The owner of this object is responsible for showing the bubble if |
| 60 // it desires it to be visible on the screen. It is not shown by the | 64 // it desires it to be visible on the screen. It is not shown by the |
| 61 // init routine. Closing of the window happens implicitly on dealloc. | 65 // init routine. Closing of the window happens implicitly on dealloc. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 87 | 91 |
| 88 - (void)addFolderNodes:(const bookmarks::BookmarkNode*)parent | 92 - (void)addFolderNodes:(const bookmarks::BookmarkNode*)parent |
| 89 toPopUpButton:(NSPopUpButton*)button | 93 toPopUpButton:(NSPopUpButton*)button |
| 90 indentation:(int)indentation; | 94 indentation:(int)indentation; |
| 91 - (void)setTitle:(NSString*)title | 95 - (void)setTitle:(NSString*)title |
| 92 parentFolder:(const bookmarks::BookmarkNode*)parent; | 96 parentFolder:(const bookmarks::BookmarkNode*)parent; |
| 93 - (void)setParentFolderSelection:(const bookmarks::BookmarkNode*)parent; | 97 - (void)setParentFolderSelection:(const bookmarks::BookmarkNode*)parent; |
| 94 + (NSString*)chooseAnotherFolderString; | 98 + (NSString*)chooseAnotherFolderString; |
| 95 - (NSPopUpButton*)folderPopUpButton; | 99 - (NSPopUpButton*)folderPopUpButton; |
| 96 @end | 100 @end |
| OLD | NEW |