| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 if (!ui::MaterialDesignController::IsModeMaterial()) { | 262 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 263 return 2.0; | 263 return 2.0; |
| 264 } | 264 } |
| 265 return 4.0; | 265 return 4.0; |
| 266 } | 266 } |
| 267 | 267 |
| 268 CGFloat BookmarkLeftMargin() { | 268 CGFloat BookmarkLeftMargin() { |
| 269 if (!ui::MaterialDesignController::IsModeMaterial()) { | 269 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 270 return 2.0; | 270 return 2.0; |
| 271 } | 271 } |
| 272 return 10.0; | 272 return 12.0; |
| 273 } | 273 } |
| 274 | 274 |
| 275 CGFloat BookmarkRightMargin() { | 275 CGFloat BookmarkRightMargin() { |
| 276 if (!ui::MaterialDesignController::IsModeMaterial()) { | 276 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 277 return 2.0; | 277 return 2.0; |
| 278 } | 278 } |
| 279 return 10.0; | 279 return 12.0; |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace bookmarks | 282 } // namespace bookmarks |
| 283 | 283 |
| 284 @implementation BookmarkBarController | 284 @implementation BookmarkBarController |
| 285 | 285 |
| 286 @synthesize currentState = currentState_; | 286 @synthesize currentState = currentState_; |
| 287 @synthesize lastState = lastState_; | 287 @synthesize lastState = lastState_; |
| 288 @synthesize isAnimationRunning = isAnimationRunning_; | 288 @synthesize isAnimationRunning = isAnimationRunning_; |
| 289 @synthesize delegate = delegate_; | 289 @synthesize delegate = delegate_; |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 } | 1232 } |
| 1233 return menu; | 1233 return menu; |
| 1234 } | 1234 } |
| 1235 | 1235 |
| 1236 // Return an appropriate width for the given bookmark button cell. | 1236 // Return an appropriate width for the given bookmark button cell. |
| 1237 // The "+2" is needed because, sometimes, Cocoa is off by a tad. | 1237 // The "+2" is needed because, sometimes, Cocoa is off by a tad. |
| 1238 // Example: for a bookmark named "Moma" or "SFGate", it is one pixel | 1238 // Example: for a bookmark named "Moma" or "SFGate", it is one pixel |
| 1239 // too small. For "FBL" it is 2 pixels too small. | 1239 // too small. For "FBL" it is 2 pixels too small. |
| 1240 // For a bookmark named "SFGateFooWoo", it is just fine. | 1240 // For a bookmark named "SFGateFooWoo", it is just fine. |
| 1241 - (CGFloat)widthForBookmarkButtonCell:(NSCell*)cell { | 1241 - (CGFloat)widthForBookmarkButtonCell:(NSCell*)cell { |
| 1242 CGFloat desired = [cell cellSize].width + 2; | 1242 CGFloat desired = [cell cellSize].width; |
| 1243 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 1244 desired += 2; |
| 1245 } |
| 1243 return std::min(desired, bookmarks::kDefaultBookmarkWidth); | 1246 return std::min(desired, bookmarks::kDefaultBookmarkWidth); |
| 1244 } | 1247 } |
| 1245 | 1248 |
| 1246 - (IBAction)openBookmarkMenuItem:(id)sender { | 1249 - (IBAction)openBookmarkMenuItem:(id)sender { |
| 1247 int64_t tag = [self nodeIdFromMenuTag:[sender tag]]; | 1250 int64_t tag = [self nodeIdFromMenuTag:[sender tag]]; |
| 1248 const BookmarkNode* node = | 1251 const BookmarkNode* node = |
| 1249 bookmarks::GetBookmarkNodeByID(bookmarkModel_, tag); | 1252 bookmarks::GetBookmarkNodeByID(bookmarkModel_, tag); |
| 1250 WindowOpenDisposition disposition = | 1253 WindowOpenDisposition disposition = |
| 1251 ui::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); | 1254 ui::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); |
| 1252 [self openURL:node->url() disposition:disposition]; | 1255 [self openURL:node->url() disposition:disposition]; |
| (...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3087 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 3090 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 3088 (const BookmarkNode*)node { | 3091 (const BookmarkNode*)node { |
| 3089 // See if it's in the bar, then if it is in the hierarchy of visible | 3092 // See if it's in the bar, then if it is in the hierarchy of visible |
| 3090 // folder menus. | 3093 // folder menus. |
| 3091 if (bookmarkModel_->bookmark_bar_node() == node) | 3094 if (bookmarkModel_->bookmark_bar_node() == node) |
| 3092 return self; | 3095 return self; |
| 3093 return [folderController_ controllerForNode:node]; | 3096 return [folderController_ controllerForNode:node]; |
| 3094 } | 3097 } |
| 3095 | 3098 |
| 3096 @end | 3099 @end |
| OLD | NEW |