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

Side by Side Diff: chrome/browser/cocoa/browser_window_controller.mm

Issue 391057: Fix multi-window bookmark bubble problem.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 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 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 #include <Carbon/Carbon.h> 5 #include <Carbon/Carbon.h>
6 6
7 #include "app/l10n_util_mac.h" 7 #include "app/l10n_util_mac.h"
8 #include "base/mac_util.h" 8 #include "base/mac_util.h"
9 #include "base/scoped_nsdisable_screen_updates.h" 9 #include "base/scoped_nsdisable_screen_updates.h"
10 #import "base/scoped_nsobject.h" 10 #import "base/scoped_nsobject.h"
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 BookmarkModel* model = browser_->profile()->GetBookmarkModel(); 1165 BookmarkModel* model = browser_->profile()->GetBookmarkModel();
1166 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url); 1166 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url);
1167 NSPoint topLeft = [self topLeftForBubble]; 1167 NSPoint topLeft = [self topLeftForBubble];
1168 bookmarkBubbleController_ = 1168 bookmarkBubbleController_ =
1169 [[BookmarkBubbleController alloc] initWithDelegate:self 1169 [[BookmarkBubbleController alloc] initWithDelegate:self
1170 parentWindow:[self window] 1170 parentWindow:[self window]
1171 topLeftForBubble:topLeft 1171 topLeftForBubble:topLeft
1172 model:model 1172 model:model
1173 node:node 1173 node:node
1174 alreadyBookmarked:alreadyBookmarked]; 1174 alreadyBookmarked:alreadyBookmarked];
1175 NSWindow* bookmarkBubbleWindow = [bookmarkBubbleController_ window];
1176 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
1177 [nc addObserver:self
1178 selector:@selector(bubbleWindowWillClose:)
1179 name:NSWindowWillCloseNotification
1180 object:bookmarkBubbleWindow];
1181 [bookmarkBubbleController_ showWindow:self]; 1175 [bookmarkBubbleController_ showWindow:self];
1182 } 1176 }
1183 } 1177 }
1184 1178
1185 // Notification sent when our bubble window is closed. 1179 // Implement BookmarkBubbleControllerDelegate.
1186 - (void)bubbleWindowWillClose:(NSNotification*)notification { 1180 - (void)bubbleWindowWillClose:(NSWindow*)window {
1187 DCHECK([[notification object] windowController] == bookmarkBubbleController_); 1181 if (window == [bookmarkBubbleController_ window])
1188 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; 1182 bookmarkBubbleController_ = nil;
1189 [nc removeObserver:self
1190 name:NSWindowWillCloseNotification
1191 object:[bookmarkBubbleController_ window]];
1192 bookmarkBubbleController_ = nil;
1193 } 1183 }
1194 1184
1195 // Implement BookmarkBubbleControllerDelegate 1185 // Implement BookmarkBubbleControllerDelegate.
1196 - (void)editBookmarkNode:(const BookmarkNode*)node { 1186 - (void)editBookmarkNode:(const BookmarkNode*)node {
1197 // A BookmarkEditorController is a sheet that owns itself, and 1187 // A BookmarkEditorController is a sheet that owns itself, and
1198 // deallocates itself when closed. 1188 // deallocates itself when closed.
1199 [[[BookmarkEditorController alloc] 1189 [[[BookmarkEditorController alloc]
1200 initWithParentWindow:[self window] 1190 initWithParentWindow:[self window]
1201 profile:browser_->profile() 1191 profile:browser_->profile()
1202 parent:node->GetParent() 1192 parent:node->GetParent()
1203 node:node 1193 node:node
1204 configuration:BookmarkEditor::SHOW_TREE 1194 configuration:BookmarkEditor::SHOW_TREE
1205 handler:NULL] 1195 handler:NULL]
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 if (frameOverlayInactiveImage) { 1658 if (frameOverlayInactiveImage) {
1669 [theme setValue:frameOverlayInactiveImage 1659 [theme setValue:frameOverlayInactiveImage
1670 forAttribute:@"overlay" 1660 forAttribute:@"overlay"
1671 style:GTMThemeStyleWindow 1661 style:GTMThemeStyleWindow
1672 state:GTMThemeStateInactiveWindow]; 1662 state:GTMThemeStateInactiveWindow];
1673 } 1663 }
1674 1664
1675 return theme; 1665 return theme;
1676 } 1666 }
1677 @end 1667 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698