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

Issue 333017: Fixes up bookmark bubbles and the browser window so that they shut down corre... (Closed)

Created:
11 years, 2 months ago by dmac
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, John Grabowski, ben+cc_chromium.org, pam+watch_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

Fixes up bookmark bubbles and the browser window so that they shut down correctly. BookmarkBubbleController has been made an NSWindowController instead of the view controller that it used to be, and now loads its window from the nib instead of creating it on the fly. Also cleans up fullscreen mode so that the window referenced from browser_window_controller stays constant instead of having [self window] and window_ potentially pointing at two different windows. BookmarkBubble.xib has been modified so that it instantiates a window containing a bubble view instead of just instantiating a view. BUG=25054, 24734 TEST=Try going in and out of full screen mode. Try bringing up a bookmark bubble by clicking on the star. Try creating a pile of windows and then quitting, Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=30095

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 86

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+858 lines, -843 lines) Patch
M chrome/app/nibs/BookmarkBubble.xib View 1 2 18 chunks +491 lines, -409 lines 0 comments Download
M chrome/browser/cocoa/bookmark_bubble_controller.h View 1 2 2 chunks +12 lines, -30 lines 1 comment Download
M chrome/browser/cocoa/bookmark_bubble_controller.mm View 1 2 3 10 chunks +36 lines, -71 lines 2 comments Download
M chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm View 1 2 7 chunks +66 lines, -46 lines 0 comments Download
M chrome/browser/cocoa/bookmark_bubble_view_unittest.mm View 1 2 1 chunk +7 lines, -17 lines 0 comments Download
M chrome/browser/cocoa/bookmark_bubble_window.h View 1 2 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/browser/cocoa/bookmark_bubble_window.mm View 1 2 1 chunk +6 lines, -4 lines 0 comments Download
M chrome/browser/cocoa/bookmark_bubble_window_unittest.mm View 1 2 1 chunk +10 lines, -13 lines 0 comments Download
M chrome/browser/cocoa/browser_window_controller.h View 1 2 2 chunks +12 lines, -10 lines 0 comments Download
M chrome/browser/cocoa/browser_window_controller.mm View 1 2 15 chunks +100 lines, -120 lines 2 comments Download
M chrome/browser/cocoa/browser_window_controller_unittest.mm View 1 2 3 4 5 6 chunks +100 lines, -89 lines 0 comments Download
M chrome/browser/cocoa/bubble_view_unittest.mm View 1 2 3 4 5 1 chunk +11 lines, -25 lines 0 comments Download
M chrome/browser/cocoa/cocoa_test_helper.h View 1 chunk +6 lines, -6 lines 0 comments Download
M chrome/browser/cocoa/sad_tab_view_unittest.mm View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 7 (0 generated)
dmac
I need to get this in before I can submit the rest of my unittest ...
11 years, 2 months ago (2009-10-23 23:03:24 UTC) #1
Mark Mentovai
LGTM with these changes. I'm not incredibly familiar with these classes, so you should wait ...
11 years, 2 months ago (2009-10-24 00:30:28 UTC) #2
Scott Hess - ex-Googler
I am so glad someone other than me is doing this. http://codereview.chromium.org/333017/diff/3001/3011 File chrome/browser/cocoa/bookmark_bubble_controller.mm (right): ...
11 years, 2 months ago (2009-10-24 01:13:44 UTC) #3
John Grabowski
Fullscreen has been a bit fragile. Please play with it a bit before landing this ...
11 years, 2 months ago (2009-10-26 04:05:53 UTC) #4
Scott Hess - ex-Googler
BTW - does this fix ISsue 25054? If so, please edit the BUG=.
11 years, 1 month ago (2009-10-26 16:49:31 UTC) #5
dmac
http://codereview.chromium.org/333017/diff/3001/3010 File chrome/browser/cocoa/bookmark_bubble_controller.h (right): http://codereview.chromium.org/333017/diff/3001/3010#newcode25 Line 25: @interface BookmarkBubbleController : NSWindowController<NSWindowDelegate> { On 2009/10/26 04:05:53, ...
11 years, 1 month ago (2009-10-26 18:46:25 UTC) #6
Scott Hess - ex-Googler
11 years, 1 month ago (2009-10-26 19:45:21 UTC) #7
I'm starting to feel past my depth, so ... LGTM!

The one pertinent comment is the last one, about whether you're turning
autoresize back on too early.  I don't know, but from the previous code to the
new code, it's not entirely clear that it's still doing what the comment
suggests it's supposed to do.

http://codereview.chromium.org/333017/diff/3001/3009
File chrome/browser/cocoa/browser_window_controller.h (right):

http://codereview.chromium.org/333017/diff/3001/3009#newcode73
Line 73: BookmarkBubbleController* bookmarkBubbleController_;
On 2009/10/26 18:46:25, dmac wrote:
> On 2009/10/24 01:13:44, shess wrote:
> > For these cases, another option would be to continue to use the
> > scoped_nsobject<>, but to call .reset() in the appropriate place.
> > 
> > Regardless, with all of these if you're going to make them bare pointers,
then
> > you should NULL or nil them out as appropriate after you release or delete
> them.
> >  And, just to be safe, you might also want to throw a DCHECK in -dealloc to
> make
> > sure we aren't getting there inappropriately.
> 
> Unfortunately I don't want to call reset on them. I want to call [close] on
> them. Also if we are going to be explicitly calling "reset" on an
> scoped_nsobject is there any point in wrapping it in the scoped_nsobject in
the
> first place?

Sorry, didn't mean to imply .reset() to clean them up.  Rather meant to imply
that manually arranging things doesn't mean you can't use scoped_*, just that
you have an option.  Saying [object.release() close]; handles making certain
that the object has a valid value all along, and it sometimes nice.

Guess I'm just debating our pattern going forward :-).

> Good call on nilling things out though.

I love clearing variables.  I for the longest time was upset that -release
didn't return nil.  Darn them!

http://codereview.chromium.org/333017/diff/3001/3004
File chrome/browser/cocoa/browser_window_controller.mm (right):

http://codereview.chromium.org/333017/diff/3001/3004#newcode932
Line 932: dstWindow = [saved_regular_window_ autorelease];
On 2009/10/26 18:46:25, dmac wrote:
> On 2009/10/24 01:13:44, shess wrote:
> > Could this be a -release?  If so, you could make saved_regular_window_ a
> > scoped_nsobject, and here dstWindow = saved_regular_window_.release().
> > 
> > [Yes, consistency is the hobgoblin of small minds ... working with what I've
> > got, here!]
> 
> Can't release it until I'm done with it at the end of this method. If I
released
> it here we may lose it before I need it on line 944+

Darn, my comment doesn't make sense to me, now.  I think I was thinking in terms
of stealing the owning reference using .release().  Having to think it through
indicates it was probably a bad idea.

http://codereview.chromium.org/333017/diff/3001/3004#newcode1268
Line 1268: }
On 2009/10/26 18:46:25, dmac wrote:
> On 2009/10/24 01:13:44, shess wrote:
> > What happens when you're running fullscreen and use Expose?
> 
> Works fine.

Aha - because we aren't using a weirdo window in that case.  OK.

http://codereview.chromium.org/333017/diff/8016/8025
File chrome/browser/cocoa/bookmark_bubble_controller.h (right):

http://codereview.chromium.org/333017/diff/8016/8025#newcode29
Line 29: NSPoint topLeftForBubble_;  // weak
Probably don't need weak on NSPoint.

http://codereview.chromium.org/333017/diff/8016/8026
File chrome/browser/cocoa/bookmark_bubble_controller.mm (right):

http://codereview.chromium.org/333017/diff/8016/8026#newcode89
Line 89: [self ok:sender];
Having -cancel: call -close: made reasonable sense, but having it call -ok:
seems misleading.  If you click the star, edit on the bookmark, then hit ESC,
does that undo your editing?

http://codereview.chromium.org/333017/diff/8016/8026#newcode97
Line 97: [self ok:sender];
Same here, -ok: feels odd.

http://codereview.chromium.org/333017/diff/8016/8019
File chrome/browser/cocoa/browser_window_controller.mm (right):

http://codereview.chromium.org/333017/diff/8016/8019#newcode942
Line 942: // Cocoa calls.  Stack added to suppressions_mac.txt.
Just checking - does this comment now apply to -setAutoresizesSubviews:?  Before
it was on -makeKeyAndOrderFront:.

http://codereview.chromium.org/333017/diff/8016/8019#newcode943
Line 943: [content setAutoresizesSubviews:YES];
Previously this line was way down the list.  The comment at disable makes it
sounds like some of these methods caused those extra resizes ... maybe
-adjustUIForFullScreen: could cause resizing?

Powered by Google App Engine
This is Rietveld 408576698