| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_button_cell.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 9 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
| 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 const int kHierarchyButtonLeftPadding = 11; | 30 const int kHierarchyButtonLeftPadding = 11; |
| 31 | 31 |
| 32 const int kIconTextSpacer = 4; | 32 const int kIconTextSpacer = 4; |
| 33 const int kTextRightPadding = 4; | 33 const int kTextRightPadding = 4; |
| 34 const int kIconLeftPadding = 4; | 34 const int kIconLeftPadding = 4; |
| 35 | 35 |
| 36 const int kDefaultFontSize = 12; | 36 const int kDefaultFontSize = 12; |
| 37 | 37 |
| 38 }; // namespace | 38 }; // namespace |
| 39 | 39 |
| 40 // TODO(lgrey): Bake setting the chevron image into this |
| 41 // class instead of setting it externally. |
| 40 @interface OffTheSideButtonCell : BookmarkButtonCell | 42 @interface OffTheSideButtonCell : BookmarkButtonCell |
| 41 | 43 |
| 42 - (NSString*)accessibilityTitle; | 44 - (NSString*)accessibilityTitle; |
| 43 | 45 |
| 44 @end | 46 @end |
| 45 @implementation OffTheSideButtonCell | 47 @implementation OffTheSideButtonCell |
| 46 | 48 |
| 47 - (BOOL)isOffTheSideButtonCell { | 49 - (BOOL)isOffTheSideButtonCell { |
| 48 return YES; | 50 return YES; |
| 49 } | 51 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 image:(NSImage*)image | 101 image:(NSImage*)image |
| 100 menuController:(BookmarkContextMenuCocoaController*)menuController { | 102 menuController:(BookmarkContextMenuCocoaController*)menuController { |
| 101 id buttonCell = | 103 id buttonCell = |
| 102 [[[BookmarkButtonCell alloc] initWithText:text | 104 [[[BookmarkButtonCell alloc] initWithText:text |
| 103 image:image | 105 image:image |
| 104 menuController:menuController] | 106 menuController:menuController] |
| 105 autorelease]; | 107 autorelease]; |
| 106 return buttonCell; | 108 return buttonCell; |
| 107 } | 109 } |
| 108 | 110 |
| 111 + (id)offTheSideButtonCell { |
| 112 return [[[OffTheSideButtonCell alloc] init] autorelease]; |
| 113 } |
| 114 |
| 109 - (id)initForNode:(const BookmarkNode*)node | 115 - (id)initForNode:(const BookmarkNode*)node |
| 110 text:(NSString*)text | 116 text:(NSString*)text |
| 111 image:(NSImage*)image | 117 image:(NSImage*)image |
| 112 menuController:(BookmarkContextMenuCocoaController*)menuController { | 118 menuController:(BookmarkContextMenuCocoaController*)menuController { |
| 113 if ((self = [super initTextCell:text])) { | 119 if ((self = [super initTextCell:text])) { |
| 114 menuController_ = menuController; | 120 menuController_ = menuController; |
| 115 [self configureBookmarkButtonCell]; | 121 [self configureBookmarkButtonCell]; |
| 116 [self setTextColor:[NSColor blackColor]]; | 122 [self setTextColor:[NSColor blackColor]]; |
| 117 [self setBookmarkNode:node]; | 123 [self setBookmarkNode:node]; |
| 118 // When opening a bookmark folder, the default behavior is that the | 124 // When opening a bookmark folder, the default behavior is that the |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 const CGFloat kLineWidth = [controlView cr_lineWidth]; | 436 const CGFloat kLineWidth = [controlView cr_lineWidth]; |
| 431 if ([self isMaterialDesignButtonType] && ![self isFolderButtonCell] && | 437 if ([self isMaterialDesignButtonType] && ![self isFolderButtonCell] && |
| 432 kLineWidth < 1) { | 438 kLineWidth < 1) { |
| 433 return -kLineWidth; | 439 return -kLineWidth; |
| 434 } | 440 } |
| 435 return 0.0; | 441 return 0.0; |
| 436 } | 442 } |
| 437 | 443 |
| 438 | 444 |
| 439 @end | 445 @end |
| OLD | NEW |