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

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

Issue 884003: Fix mac unit tests (Closed)
Patch Set: Created 10 years, 9 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
« no previous file with comments | « no previous file | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/cocoa/bookmark_bar_folder_controller.h" 5 #import "chrome/browser/cocoa/bookmark_bar_folder_controller.h"
6 #include "base/mac_util.h" 6 #include "base/mac_util.h"
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "chrome/browser/bookmarks/bookmark_model.h" 8 #include "chrome/browser/bookmarks/bookmark_model.h"
9 #import "chrome/browser/browser_theme_provider.h" 9 #import "chrome/browser/browser_theme_provider.h"
10 #import "chrome/browser/cocoa/bookmark_bar_constants.h" // namespace bookmarks 10 #import "chrome/browser/cocoa/bookmark_bar_constants.h" // namespace bookmarks
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 for (BookmarkButton* button in buttons_.get()) { 252 for (BookmarkButton* button in buttons_.get()) {
253 NSRect buttonFrame = [button frame]; 253 NSRect buttonFrame = [button frame];
254 buttonFrame.size.width = width; 254 buttonFrame.size.width = width;
255 [button setFrame:buttonFrame]; 255 [button setFrame:buttonFrame];
256 } 256 }
257 257
258 // Finally, set our window size (make sure it fits on screen). 258 // Finally, set our window size (make sure it fits on screen).
259 width += (2 * bookmarks::kBookmarkVerticalPadding); 259 width += (2 * bookmarks::kBookmarkVerticalPadding);
260 windowFrame.size.width = width; 260 windowFrame.size.width = width;
261 261
262 // Make the window fit on screen, with a distance of at least |padding| to 262 // Make the window fit on screen, with a distance of at least |padding| to
viettrungluu 2010/03/12 08:11:28 That should've been "*from* the sides". Stupid pre
263 // the sides. 263 // the sides.
264 const CGFloat padding = 8; 264 if ([[self window] screen]) { // nil in unit tests
viettrungluu 2010/03/12 08:11:28 Possibly also nil under other strange situations,
265 NSRect screenFrame = [[[self window] screen] frame]; 265 const CGFloat padding = 8;
266 if (NSMaxX(windowFrame) + padding > NSMaxX(screenFrame)) 266 NSRect screen = [[[self window] screen] frame];
viettrungluu 2010/03/12 08:11:28 Did you rename it so that things would still fit o
267 windowFrame.origin.x -= NSMaxX(windowFrame) + padding - NSMaxX(screenFrame); 267 if (NSMaxX(windowFrame) + padding > NSMaxX(screen))
268 else if (NSMinX(windowFrame) - padding < NSMinX(screenFrame)) 268 windowFrame.origin.x -= NSMaxX(windowFrame) + padding - NSMaxX(screen);
269 windowFrame.origin.x += NSMinX(screenFrame) - NSMinX(windowFrame) + padding; 269 else if (NSMinX(windowFrame) - padding < NSMinX(screen))
270 windowFrame.origin.x += NSMinX(screen) - NSMinX(windowFrame) + padding;
271 }
270 272
271 [[self window] setFrame:windowFrame display:YES]; 273 [[self window] setFrame:windowFrame display:YES];
272 274
273 [[parentController_ parentWindow] addChildWindow:[self window] 275 [[parentController_ parentWindow] addChildWindow:[self window]
274 ordered:NSWindowAbove]; 276 ordered:NSWindowAbove];
275 } 277 }
276 278
277 - (ThemeProvider*)themeProvider { 279 - (ThemeProvider*)themeProvider {
278 return [parentController_ themeProvider]; 280 return [parentController_ themeProvider];
279 } 281 }
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 initWithParentButton:sender 651 initWithParentButton:sender
650 parentController:self]; 652 parentController:self];
651 [folderController_ showWindow:self]; 653 [folderController_ showWindow:self];
652 } 654 }
653 655
654 - (NSArray*)buttons { 656 - (NSArray*)buttons {
655 return buttons_.get(); 657 return buttons_.get();
656 } 658 }
657 659
658 @end // BookmarkBarFolderController 660 @end // BookmarkBarFolderController
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698