| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #import "base/mac/bundle_locations.h" | 9 #import "base/mac/bundle_locations.h" |
| 10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 } | 495 } |
| 496 | 496 |
| 497 // We are enabled by default. | 497 // We are enabled by default. |
| 498 barIsEnabled_ = YES; | 498 barIsEnabled_ = YES; |
| 499 | 499 |
| 500 // Remember the original sizes of the 'no items' and 'import bookmarks' | 500 // Remember the original sizes of the 'no items' and 'import bookmarks' |
| 501 // fields to aid in resizing when the window frame changes. | 501 // fields to aid in resizing when the window frame changes. |
| 502 originalNoItemsRect_ = [[buttonView_ noItemTextfield] frame]; | 502 originalNoItemsRect_ = [[buttonView_ noItemTextfield] frame]; |
| 503 originalImportBookmarksRect_ = [[buttonView_ importBookmarksButton] frame]; | 503 originalImportBookmarksRect_ = [[buttonView_ importBookmarksButton] frame]; |
| 504 if (isModeMaterial) { | 504 if (isModeMaterial) { |
| 505 // Bookmark buttons are shorter and start farther from the bookmark bar's | 505 // Bookmark buttons start farther from the bookmark bar's left edge so |
| 506 // left edge so adjust the positions of the noItems and importBookmarks | 506 // adjust the positions of the noItems and importBookmarks textfields. |
| 507 // textfields. | |
| 508 const CGFloat kMaterialBookmarksTextfieldOffsetX = 14; | 507 const CGFloat kMaterialBookmarksTextfieldOffsetX = 14; |
| 509 const CGFloat kMaterialBookmarksTextfieldOffsetY = -2; | 508 originalNoItemsRect_.origin.x += kMaterialBookmarksTextfieldOffsetX; |
| 510 originalNoItemsRect_.origin = | |
| 511 NSOffsetRect(originalNoItemsRect_, | |
| 512 kMaterialBookmarksTextfieldOffsetX, | |
| 513 kMaterialBookmarksTextfieldOffsetY).origin; | |
| 514 [[buttonView_ noItemTextfield] setFrame:originalNoItemsRect_]; | 509 [[buttonView_ noItemTextfield] setFrame:originalNoItemsRect_]; |
| 515 | 510 |
| 516 originalImportBookmarksRect_.origin = | 511 originalImportBookmarksRect_.origin.x += kMaterialBookmarksTextfieldOffsetX; |
| 517 NSOffsetRect(originalImportBookmarksRect_, | |
| 518 kMaterialBookmarksTextfieldOffsetX, | |
| 519 kMaterialBookmarksTextfieldOffsetY).origin; | |
| 520 [[buttonView_ importBookmarksButton] setFrame:originalImportBookmarksRect_]; | 512 [[buttonView_ importBookmarksButton] setFrame:originalImportBookmarksRect_]; |
| 521 } | 513 } |
| 522 | 514 |
| 523 // To make life happier when the bookmark bar is floating, the chevron is a | 515 // To make life happier when the bookmark bar is floating, the chevron is a |
| 524 // child of the button view. | 516 // child of the button view. |
| 525 [offTheSideButton_ removeFromSuperview]; | 517 [offTheSideButton_ removeFromSuperview]; |
| 526 [buttonView_ addSubview:offTheSideButton_]; | 518 [buttonView_ addSubview:offTheSideButton_]; |
| 527 | 519 |
| 528 // When resized we may need to add new buttons, or remove them (if | 520 // When resized we may need to add new buttons, or remove them (if |
| 529 // no longer visible), or add/remove the "off the side" menu. | 521 // no longer visible), or add/remove the "off the side" menu. |
| (...skipping 2560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3090 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 3082 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 3091 (const BookmarkNode*)node { | 3083 (const BookmarkNode*)node { |
| 3092 // See if it's in the bar, then if it is in the hierarchy of visible | 3084 // See if it's in the bar, then if it is in the hierarchy of visible |
| 3093 // folder menus. | 3085 // folder menus. |
| 3094 if (bookmarkModel_->bookmark_bar_node() == node) | 3086 if (bookmarkModel_->bookmark_bar_node() == node) |
| 3095 return self; | 3087 return self; |
| 3096 return [folderController_ controllerForNode:node]; | 3088 return [folderController_ controllerForNode:node]; |
| 3097 } | 3089 } |
| 3098 | 3090 |
| 3099 @end | 3091 @end |
| OLD | NEW |