| 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 <map> | 9 #include <map> |
| 10 | 10 |
| 11 #import "base/mac/cocoa_protocols.h" | 11 #import "base/mac/cocoa_protocols.h" |
| 12 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h" | 14 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h" |
| 15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
| 16 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_state.h" | 16 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_state.h" |
| 17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h" | 17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h" |
| 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| 19 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" | 19 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" |
| 20 #include "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" | 20 #include "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" |
| 21 #include "ui/base/window_open_disposition.h" | 21 #include "ui/base/window_open_disposition.h" |
| 22 | 22 |
| 23 @class BookmarkBarController; | 23 @class BookmarkBarController; |
| 24 @class BookmarkBarFolderController; | 24 @class BookmarkBarFolderController; |
| 25 @class BookmarkBarView; | 25 @class BookmarkBarView; |
| 26 @class BookmarkButtonCell; | 26 @class BookmarkButtonCell; |
| 27 @class BookmarkContextMenuCocoaController; |
| 27 @class BookmarkFolderTarget; | 28 @class BookmarkFolderTarget; |
| 28 @class BookmarkContextMenuCocoaController; | 29 class BookmarkModelObserverForCocoa; |
| 29 class Browser; | 30 class Browser; |
| 30 class GURL; | 31 class GURL; |
| 31 namespace ui { | 32 namespace ui { |
| 32 class ThemeProvider; | 33 class ThemeProvider; |
| 33 } | 34 } |
| 34 | 35 |
| 35 namespace bookmarks { | 36 namespace bookmarks { |
| 36 | 37 |
| 37 class BookmarkModel; | 38 class BookmarkModel; |
| 38 class BookmarkNode; | 39 class BookmarkNode; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // YES if there is a possible drop about to happen in the bar. | 280 // YES if there is a possible drop about to happen in the bar. |
| 280 BOOL hasInsertionPos_; | 281 BOOL hasInsertionPos_; |
| 281 | 282 |
| 282 // The x point on the bar where the left edge of the new item will end | 283 // The x point on the bar where the left edge of the new item will end |
| 283 // up if it is dropped. | 284 // up if it is dropped. |
| 284 CGFloat insertionPos_; | 285 CGFloat insertionPos_; |
| 285 | 286 |
| 286 // Controller responsible for all bookmark context menus. | 287 // Controller responsible for all bookmark context menus. |
| 287 base::scoped_nsobject<BookmarkContextMenuCocoaController> | 288 base::scoped_nsobject<BookmarkContextMenuCocoaController> |
| 288 contextMenuController_; | 289 contextMenuController_; |
| 290 |
| 291 // Weak pointer to the pulsed button for the currently pulsing node. We need |
| 292 // to store this as it may not be possible to determine the pulsing button if |
| 293 // the pulsing node is deleted. Nil if there is no pulsing node. |
| 294 BookmarkButton* pulsingButton_; |
| 295 |
| 296 // Specifically watch the currently pulsing node. This lets us stop pulsing |
| 297 // when anything happens to the node. Null if there is no pulsing node. |
| 298 scoped_ptr<BookmarkModelObserverForCocoa> pulsingBookmarkObserver_; |
| 289 } | 299 } |
| 290 | 300 |
| 291 @property(readonly, nonatomic) BookmarkBar::State currentState; | 301 @property(readonly, nonatomic) BookmarkBar::State currentState; |
| 292 @property(readonly, nonatomic) BookmarkBar::State lastState; | 302 @property(readonly, nonatomic) BookmarkBar::State lastState; |
| 293 @property(readonly, nonatomic) BOOL isAnimationRunning; | 303 @property(readonly, nonatomic) BOOL isAnimationRunning; |
| 294 @property(assign, nonatomic) id<BookmarkBarControllerDelegate> delegate; | 304 @property(assign, nonatomic) id<BookmarkBarControllerDelegate> delegate; |
| 295 @property(assign, nonatomic) BOOL stateAnimationsEnabled; | 305 @property(assign, nonatomic) BOOL stateAnimationsEnabled; |
| 296 @property(assign, nonatomic) BOOL innerContentAnimationsEnabled; | 306 @property(assign, nonatomic) BOOL innerContentAnimationsEnabled; |
| 297 | 307 |
| 298 // Initializes the bookmark bar controller with the given browser | 308 // Initializes the bookmark bar controller with the given browser |
| 299 // profile and delegates. | 309 // profile and delegates. |
| 300 - (id)initWithBrowser:(Browser*)browser | 310 - (id)initWithBrowser:(Browser*)browser |
| 301 initialWidth:(CGFloat)initialWidth | 311 initialWidth:(CGFloat)initialWidth |
| 302 delegate:(id<BookmarkBarControllerDelegate>)delegate | 312 delegate:(id<BookmarkBarControllerDelegate>)delegate |
| 303 resizeDelegate:(id<ViewResizer>)resizeDelegate; | 313 resizeDelegate:(id<ViewResizer>)resizeDelegate; |
| 304 | 314 |
| 305 // The Browser corresponding to this BookmarkBarController. | 315 // The Browser corresponding to this BookmarkBarController. |
| 306 - (Browser*)browser; | 316 - (Browser*)browser; |
| 307 | 317 |
| 308 // The controller for all bookmark bar context menus. | 318 // The controller for all bookmark bar context menus. |
| 309 - (BookmarkContextMenuCocoaController*)menuController; | 319 - (BookmarkContextMenuCocoaController*)menuController; |
| 310 | 320 |
| 321 // Pulses the given bookmark node, or the closest parent node that is visible. |
| 322 - (void)startPulsingBookmarkNode:(const bookmarks::BookmarkNode*)node; |
| 323 |
| 324 // Stops pulsing any bookmark nodes. |
| 325 - (void)stopPulsingBookmarkNode; |
| 326 |
| 311 // Updates the bookmark bar (from its current, possibly in-transition) state to | 327 // Updates the bookmark bar (from its current, possibly in-transition) state to |
| 312 // the new state. | 328 // the new state. |
| 313 - (void)updateState:(BookmarkBar::State)newState | 329 - (void)updateState:(BookmarkBar::State)newState |
| 314 changeType:(BookmarkBar::AnimateChangeType)changeType; | 330 changeType:(BookmarkBar::AnimateChangeType)changeType; |
| 315 | 331 |
| 316 // Update the visible state of the bookmark bar. | 332 // Update the visible state of the bookmark bar. |
| 317 - (void)updateVisibility; | 333 - (void)updateVisibility; |
| 318 | 334 |
| 319 // Update the visible state of the extra buttons on the bookmark bar: the | 335 // Update the visible state of the extra buttons on the bookmark bar: the |
| 320 // apps shortcut, the managed bookmarks folder, and the supervised bookmarks | 336 // apps shortcut, the managed bookmarks folder, and the supervised bookmarks |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 - (BookmarkButton*)buttonForDroppingOnAtPoint:(NSPoint)point; | 440 - (BookmarkButton*)buttonForDroppingOnAtPoint:(NSPoint)point; |
| 425 - (BOOL)isEventAnExitEvent:(NSEvent*)event; | 441 - (BOOL)isEventAnExitEvent:(NSEvent*)event; |
| 426 - (BOOL)shrinkOrHideView:(NSView*)view forMaxX:(CGFloat)maxViewX; | 442 - (BOOL)shrinkOrHideView:(NSView*)view forMaxX:(CGFloat)maxViewX; |
| 427 - (void)unhighlightBookmark:(const bookmarks::BookmarkNode*)node; | 443 - (void)unhighlightBookmark:(const bookmarks::BookmarkNode*)node; |
| 428 | 444 |
| 429 // The following are for testing purposes only and are not used internally. | 445 // The following are for testing purposes only and are not used internally. |
| 430 - (NSMenu *)menuForFolderNode:(const bookmarks::BookmarkNode*)node; | 446 - (NSMenu *)menuForFolderNode:(const bookmarks::BookmarkNode*)node; |
| 431 @end | 447 @end |
| 432 | 448 |
| 433 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ | 449 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ |
| OLD | NEW |