OLD | NEW |
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/nsimage_cache_mac.h" | 7 #include "base/nsimage_cache_mac.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
10 #include "chrome/browser/bookmarks/bookmark_utils.h" | 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 NSHeight(windowFrame)))]; | 360 NSHeight(windowFrame)))]; |
361 [self showOrHideScrollArrows]; | 361 [self showOrHideScrollArrows]; |
362 [self addOrUpdateScrollTracking]; | 362 [self addOrUpdateScrollTracking]; |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 // Determine window size and position. | 366 // Determine window size and position. |
367 // Create buttons for all our nodes. | 367 // Create buttons for all our nodes. |
368 // TODO(jrg): break up into more and smaller routines for easier unit testing. | 368 // TODO(jrg): break up into more and smaller routines for easier unit testing. |
369 - (void)configureWindow { | 369 - (void)configureWindow { |
370 NSPoint newWindowTopLeft = [self windowTopLeft]; | |
371 const BookmarkNode* node = [parentButton_ bookmarkNode]; | 370 const BookmarkNode* node = [parentButton_ bookmarkNode]; |
372 DCHECK(node); | 371 DCHECK(node); |
373 int startingIndex = [[parentButton_ cell] startingChildIndex]; | 372 int startingIndex = [[parentButton_ cell] startingChildIndex]; |
374 DCHECK_LE(startingIndex, node->GetChildCount()); | 373 DCHECK_LE(startingIndex, node->GetChildCount()); |
375 // Must have at least 1 button (for "empty") | 374 // Must have at least 1 button (for "empty") |
376 int buttons = std::max(node->GetChildCount() - startingIndex, 1); | 375 int buttons = std::max(node->GetChildCount() - startingIndex, 1); |
377 | 376 |
378 // Prelim height of the window. We'll trim later as needed. | 377 // Prelim height of the window. We'll trim later as needed. |
379 int height = buttons * bookmarks::kBookmarkButtonHeight; | 378 int height = buttons * bookmarks::kBookmarkButtonHeight; |
380 // We'll need this soon... | 379 // We'll need this soon... |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 return [folderController_ controllerForNode:node]; | 1320 return [folderController_ controllerForNode:node]; |
1322 } | 1321 } |
1323 | 1322 |
1324 #pragma mark TestingAPI Only | 1323 #pragma mark TestingAPI Only |
1325 | 1324 |
1326 - (void)setIgnoreAnimations:(BOOL)ignore { | 1325 - (void)setIgnoreAnimations:(BOOL)ignore { |
1327 ignoreAnimations_ = ignore; | 1326 ignoreAnimations_ = ignore; |
1328 } | 1327 } |
1329 | 1328 |
1330 @end // BookmarkBarFolderController | 1329 @end // BookmarkBarFolderController |
OLD | NEW |