Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: chrome/browser/cocoa/bookmark_bubble_controller.h

Issue 171016: Bookmark STAR bubble (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #import <Cocoa/Cocoa.h>
6 #include "base/scoped_nsobject.h"
7
8 class BookmarkModel;
9 class BookmarkNode;
10 @class BookmarkBubbleController;
11
12 // Protocol for a BookmarkBubbleController's (BBC's) delegate.
13 @protocol BookmarkBubbleControllerDelegate
14
15 // The bubble asks the delegate to perform an edit when needed.
16 - (void)editBookmarkNode:(const BookmarkNode*)node;
17
18 // The bubble tells its delegate when it's done and can be deallocated.
19 - (void)doneWithBubbleController:(BookmarkBubbleController*)controller;
20
21 @end
22
23 // 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 // add or remove it as a bookmark. This bubble allows for editing of
26 // the bookmark in various ways (name, folder, etc.)
27 //
28 // 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 // NSBorderlessWindowMask NSWindow, and the style of an NSWindow can't
31 // be set other than init time. To deal, we create the NSWindow
32 // programatically, but encode the view in a nib. Thus,
33 // BookmarkBubbleController is an NSViewController, not an
34 // NSWindowController.
35 @interface BookmarkBubbleController : NSViewController {
36 @private
37 // Unexpected for this controller, perhaps, but our window does NOT
38 // come from a nib.
39 scoped_nsobject<NSWindow> window_;
40
41 id<BookmarkBubbleControllerDelegate> delegate_; // weak like other delegates
42 NSWindow* parentWindow_; // weak
43 NSPoint topLeftForBubble_;
44
45 // Both weak; owned by the current browser's profile
46 BookmarkModel* model_;
47 const BookmarkNode* node_;
48
49 // A mapping from titles to nodes so we only have to walk this once.
50 scoped_nsobject<NSMutableArray> titleMapping_;
51
52 BOOL alreadyBookmarked_;
53 scoped_nsobject<NSString> chooseAnotherFolder_;
54
55 IBOutlet NSTextField* bigTitle_; // "Bookmark" or "Bookmark Added!"
56 IBOutlet NSTextField* nameTextField_;
57 IBOutlet NSComboBox* folderComboBox_;
58 }
59
60 // |node| is the bookmark node we edit in this bubble.
61 // |alreadyBookmarked| tells us if the node was bookmarked before the
62 // user clicked on the star. (if NO, this is a brand new bookmark).
63 // The owner of this object is responsible for showing the bubble if
64 // it desires it to be visible on the screen. It is not shown by the
65 // init routine. Closing of the window happens implicitly on dealloc.
66 - (id)initWithDelegate:(id<BookmarkBubbleControllerDelegate>)delegate
67 parentWindow:(NSWindow*)parentWindow
68 topLeftForBubble:(NSPoint)topLeftForBubble
69 model:(BookmarkModel*)model
70 node:(const BookmarkNode*)node
71 alreadyBookmarked:(BOOL)alreadyBookmarked;
72
73 - (void)showWindow;
74
75 // Actions for buttons in the dialog.
76 - (IBAction)edit:(id)sender;
77 - (IBAction)close:(id)sender;
78 - (IBAction)remove:(id)sender;
79
80 @end
81
82
83 // Exposed only for unit testing.
84 @interface BookmarkBubbleController(ExposedForUnitTesting)
85 - (NSWindow*)createBubbleWindow;
86 - (void)fillInFolderList;
87 - (BOOL)windowHasBeenClosed;
88 - (void)addFolderNodes:(const BookmarkNode*)parent toComboBox:(NSComboBox*)box;
89 - (void)updateBookmarkNode;
90 - (void)setTitle:(NSString *)title parentFolder:(NSString*)folder;
91 - (NSString*)chooseAnotherFolderString;
92 @end
93
94 // Also private but I need to declare them specially for @synthesize to work.
95 @interface BookmarkBubbleController ()
96 @property (readonly) id delegate;
97 @property (readonly) NSComboBox* folderComboBox;
98 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_controller.mm ('k') | chrome/browser/cocoa/bookmark_bubble_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698