| 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 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 class BookmarkNode; | 41 class BookmarkNode; |
| 42 class ManagedBookmarkService; | 42 class ManagedBookmarkService; |
| 43 | 43 |
| 44 // Magic numbers from Cole | 44 // Magic numbers from Cole |
| 45 // TODO(jrg): create an objc-friendly version of bookmark_bar_constants.h? | 45 // TODO(jrg): create an objc-friendly version of bookmark_bar_constants.h? |
| 46 | 46 |
| 47 // Used as a maximum width for buttons on the bar. | 47 // Used as a maximum width for buttons on the bar. |
| 48 const CGFloat kDefaultBookmarkWidth = 150.0; | 48 const CGFloat kDefaultBookmarkWidth = 150.0; |
| 49 | 49 |
| 50 // Horizontal frame inset for buttons in the bookmark bar. | 50 // Horizontal frame inset for buttons in the bookmark bar. |
| 51 const CGFloat kBookmarkHorizontalPadding = 1.0; | 51 CGFloat BookmarkHorizontalPadding(); |
| 52 | 52 |
| 53 // Vertical frame inset for buttons in the bookmark bar. | 53 // Vertical frame inset for buttons in the bookmark bar. |
| 54 const CGFloat kBookmarkVerticalPadding = 2.0; | 54 CGFloat BookmarkVerticalPadding(); |
| 55 | 55 |
| 56 // Left margin before the first button in the bookmark bar. | 56 // Left margin before the first button in the bookmark bar. |
| 57 const CGFloat kBookmarkLeftMargin = 2.0; | 57 CGFloat BookmarkLeftMargin(); |
| 58 | 58 |
| 59 // Right margin before the last button in the bookmark bar. | 59 // Right margin before the last button in the bookmark bar. |
| 60 const CGFloat kBookmarkRightMargin = 2.0; | 60 CGFloat BookmarkRightMargin(); |
| 61 | 61 |
| 62 // Used as a min/max width for buttons on menus (not on the bar). | 62 // Used as a min/max width for buttons on menus (not on the bar). |
| 63 const CGFloat kBookmarkMenuButtonMinimumWidth = 100.0; | 63 const CGFloat kBookmarkMenuButtonMinimumWidth = 100.0; |
| 64 const CGFloat kBookmarkMenuButtonMaximumWidth = 485.0; | 64 const CGFloat kBookmarkMenuButtonMaximumWidth = 485.0; |
| 65 | 65 |
| 66 // The minimum separation between a folder menu and the edge of the screen. | 66 // The minimum separation between a folder menu and the edge of the screen. |
| 67 // If the menu gets closer to the edge of the screen (either right or left) | 67 // If the menu gets closer to the edge of the screen (either right or left) |
| 68 // then it is pops up in the opposite direction. | 68 // then it is pops up in the opposite direction. |
| 69 // (See -[BookmarkBarFolderController childFolderWindowLeftForWidth:]). | 69 // (See -[BookmarkBarFolderController childFolderWindowLeftForWidth:]). |
| 70 const CGFloat kBookmarkHorizontalScreenPadding = 8.0; | 70 const CGFloat kBookmarkHorizontalScreenPadding = 8.0; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // node from the item. When adding items in, we start with seedId_. | 189 // node from the item. When adding items in, we start with seedId_. |
| 190 int32_t seedId_; | 190 int32_t seedId_; |
| 191 std::map<int32_t, int64_t> menuTagMap_; | 191 std::map<int32_t, int64_t> menuTagMap_; |
| 192 | 192 |
| 193 // Our bookmark buttons, ordered from L-->R. | 193 // Our bookmark buttons, ordered from L-->R. |
| 194 base::scoped_nsobject<NSMutableArray> buttons_; | 194 base::scoped_nsobject<NSMutableArray> buttons_; |
| 195 | 195 |
| 196 // The folder image so we can use one copy for all buttons | 196 // The folder image so we can use one copy for all buttons |
| 197 base::scoped_nsobject<NSImage> folderImage_; | 197 base::scoped_nsobject<NSImage> folderImage_; |
| 198 | 198 |
| 199 // The Material Design Incognito folder image so we can use one copy for all |
| 200 // buttons |
| 201 base::scoped_nsobject<NSImage> folderImageWhite_; |
| 202 |
| 199 // The default image, so we can use one copy for all buttons. | 203 // The default image, so we can use one copy for all buttons. |
| 200 base::scoped_nsobject<NSImage> defaultImage_; | 204 base::scoped_nsobject<NSImage> defaultImage_; |
| 201 | 205 |
| 202 // If the bar is disabled, we hide it and ignore show/hide commands. | 206 // If the bar is disabled, we hide it and ignore show/hide commands. |
| 203 // Set when using fullscreen mode. | 207 // Set when using fullscreen mode. |
| 204 BOOL barIsEnabled_; | 208 BOOL barIsEnabled_; |
| 205 | 209 |
| 206 // Bridge from Chrome-style C++ notifications (e.g. derived from | 210 // Bridge from Chrome-style C++ notifications (e.g. derived from |
| 207 // BookmarkModelObserver) | 211 // BookmarkModelObserver) |
| 208 std::unique_ptr<BookmarkBarBridge> bridge_; | 212 std::unique_ptr<BookmarkBarBridge> bridge_; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 - (CGFloat)toolbarDividerOpacity; | 360 - (CGFloat)toolbarDividerOpacity; |
| 357 | 361 |
| 358 // Updates the sizes and positions of the subviews. | 362 // Updates the sizes and positions of the subviews. |
| 359 // TODO(viettrungluu): I'm not convinced this should be public, but I currently | 363 // TODO(viettrungluu): I'm not convinced this should be public, but I currently |
| 360 // need it for animations. Try not to propagate its use. | 364 // need it for animations. Try not to propagate its use. |
| 361 - (void)layoutSubviews; | 365 - (void)layoutSubviews; |
| 362 | 366 |
| 363 // Called by our view when it is moved to a window. | 367 // Called by our view when it is moved to a window. |
| 364 - (void)viewDidMoveToWindow; | 368 - (void)viewDidMoveToWindow; |
| 365 | 369 |
| 366 // Provide a favicon for a bookmark node. May return nil. | 370 // Provide a favicon for a bookmark node, specifying whether or not it's for |
| 367 - (NSImage*)faviconForNode:(const bookmarks::BookmarkNode*)node; | 371 // use with a dark window theme. May return nil. |
| 372 - (NSImage*)faviconForNode:(const bookmarks::BookmarkNode*)node |
| 373 forADarkTheme:(BOOL)forADarkTheme; |
| 368 | 374 |
| 369 // Used for situations where the bookmark bar folder menus should no longer | 375 // Used for situations where the bookmark bar folder menus should no longer |
| 370 // be actively popping up. Called when the window loses focus, a click has | 376 // be actively popping up. Called when the window loses focus, a click has |
| 371 // occured outside the menus or a bookmark has been activated. (Note that this | 377 // occured outside the menus or a bookmark has been activated. (Note that this |
| 372 // differs from the behavior of the -[BookmarkButtonControllerProtocol | 378 // differs from the behavior of the -[BookmarkButtonControllerProtocol |
| 373 // closeAllBookmarkFolders] method in that the latter does not terminate menu | 379 // closeAllBookmarkFolders] method in that the latter does not terminate menu |
| 374 // tracking since it may be being called in response to actions (such as | 380 // tracking since it may be being called in response to actions (such as |
| 375 // dragging) where a 'stale' menu presentation should first be collapsed before | 381 // dragging) where a 'stale' menu presentation should first be collapsed before |
| 376 // presenting a new menu.) | 382 // presenting a new menu.) |
| 377 - (void)closeFolderAndStopTrackingMenus; | 383 - (void)closeFolderAndStopTrackingMenus; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 - (BookmarkButton*)buttonForDroppingOnAtPoint:(NSPoint)point; | 449 - (BookmarkButton*)buttonForDroppingOnAtPoint:(NSPoint)point; |
| 444 - (BOOL)isEventAnExitEvent:(NSEvent*)event; | 450 - (BOOL)isEventAnExitEvent:(NSEvent*)event; |
| 445 - (BOOL)shrinkOrHideView:(NSView*)view forMaxX:(CGFloat)maxViewX; | 451 - (BOOL)shrinkOrHideView:(NSView*)view forMaxX:(CGFloat)maxViewX; |
| 446 - (void)unhighlightBookmark:(const bookmarks::BookmarkNode*)node; | 452 - (void)unhighlightBookmark:(const bookmarks::BookmarkNode*)node; |
| 447 | 453 |
| 448 // The following are for testing purposes only and are not used internally. | 454 // The following are for testing purposes only and are not used internally. |
| 449 - (NSMenu *)menuForFolderNode:(const bookmarks::BookmarkNode*)node; | 455 - (NSMenu *)menuForFolderNode:(const bookmarks::BookmarkNode*)node; |
| 450 @end | 456 @end |
| 451 | 457 |
| 452 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ | 458 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ |
| OLD | NEW |