| 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 2791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2802 return x; | 2802 return x; |
| 2803 } | 2803 } |
| 2804 | 2804 |
| 2805 - (void)childFolderWillShow:(id<BookmarkButtonControllerProtocol>)child { | 2805 - (void)childFolderWillShow:(id<BookmarkButtonControllerProtocol>)child { |
| 2806 // If the bookmarkbar is not in detached mode, lock bar visibility, forcing | 2806 // If the bookmarkbar is not in detached mode, lock bar visibility, forcing |
| 2807 // the overlay to stay open when in fullscreen mode. | 2807 // the overlay to stay open when in fullscreen mode. |
| 2808 if (![self isInState:BookmarkBar::DETACHED] && | 2808 if (![self isInState:BookmarkBar::DETACHED] && |
| 2809 ![self isAnimatingToState:BookmarkBar::DETACHED]) { | 2809 ![self isAnimatingToState:BookmarkBar::DETACHED]) { |
| 2810 BrowserWindowController* browserController = | 2810 BrowserWindowController* browserController = |
| 2811 [BrowserWindowController browserWindowControllerForView:[self view]]; | 2811 [BrowserWindowController browserWindowControllerForView:[self view]]; |
| 2812 [browserController lockBarVisibilityForOwner:child withAnimation:NO]; | 2812 [browserController lockToolbarVisibilityForOwner:child withAnimation:NO]; |
| 2813 } | 2813 } |
| 2814 } | 2814 } |
| 2815 | 2815 |
| 2816 - (void)childFolderWillClose:(id<BookmarkButtonControllerProtocol>)child { | 2816 - (void)childFolderWillClose:(id<BookmarkButtonControllerProtocol>)child { |
| 2817 // Release bar visibility, allowing the overlay to close if in fullscreen | 2817 // Release bar visibility, allowing the overlay to close if in fullscreen |
| 2818 // mode. | 2818 // mode. |
| 2819 BrowserWindowController* browserController = | 2819 BrowserWindowController* browserController = |
| 2820 [BrowserWindowController browserWindowControllerForView:[self view]]; | 2820 [BrowserWindowController browserWindowControllerForView:[self view]]; |
| 2821 [browserController releaseBarVisibilityForOwner:child withAnimation:NO]; | 2821 [browserController releaseToolbarVisibilityForOwner:child withAnimation:NO]; |
| 2822 } | 2822 } |
| 2823 | 2823 |
| 2824 // Add a new folder controller as triggered by the given folder button. | 2824 // Add a new folder controller as triggered by the given folder button. |
| 2825 - (void)addNewFolderControllerWithParentButton:(BookmarkButton*)parentButton { | 2825 - (void)addNewFolderControllerWithParentButton:(BookmarkButton*)parentButton { |
| 2826 | 2826 |
| 2827 // If doing a close/open, make sure the fullscreen chrome doesn't | 2827 // If doing a close/open, make sure the fullscreen chrome doesn't |
| 2828 // have a chance to begin animating away in the middle of things. | 2828 // have a chance to begin animating away in the middle of things. |
| 2829 BrowserWindowController* browserController = | 2829 BrowserWindowController* browserController = |
| 2830 [BrowserWindowController browserWindowControllerForView:[self view]]; | 2830 [BrowserWindowController browserWindowControllerForView:[self view]]; |
| 2831 // Confirm we're not re-locking with ourself as an owner before locking. | 2831 // Confirm we're not re-locking with ourself as an owner before locking. |
| 2832 DCHECK([browserController isBarVisibilityLockedForOwner:self] == NO); | 2832 DCHECK([browserController isToolbarVisibilityLockedForOwner:self] == NO); |
| 2833 [browserController lockBarVisibilityForOwner:self withAnimation:NO]; | 2833 [browserController lockToolbarVisibilityForOwner:self withAnimation:NO]; |
| 2834 | 2834 |
| 2835 if (folderController_) | 2835 if (folderController_) |
| 2836 [self closeAllBookmarkFolders]; | 2836 [self closeAllBookmarkFolders]; |
| 2837 | 2837 |
| 2838 // Folder controller, like many window controllers, owns itself. | 2838 // Folder controller, like many window controllers, owns itself. |
| 2839 folderController_ = | 2839 folderController_ = |
| 2840 [[BookmarkBarFolderController alloc] | 2840 [[BookmarkBarFolderController alloc] |
| 2841 initWithParentButton:parentButton | 2841 initWithParentButton:parentButton |
| 2842 parentController:nil | 2842 parentController:nil |
| 2843 barController:self | 2843 barController:self |
| 2844 profile:browser_->profile()]; | 2844 profile:browser_->profile()]; |
| 2845 [folderController_ showWindow:self]; | 2845 [folderController_ showWindow:self]; |
| 2846 | 2846 |
| 2847 // Only BookmarkBarController has this; the | 2847 // Only BookmarkBarController has this; the |
| 2848 // BookmarkBarFolderController does not. | 2848 // BookmarkBarFolderController does not. |
| 2849 [self watchForExitEvent:YES]; | 2849 [self watchForExitEvent:YES]; |
| 2850 | 2850 |
| 2851 // No longer need to hold the lock; the folderController_ now owns it. | 2851 // No longer need to hold the lock; the folderController_ now owns it. |
| 2852 [browserController releaseBarVisibilityForOwner:self withAnimation:NO]; | 2852 [browserController releaseToolbarVisibilityForOwner:self withAnimation:NO]; |
| 2853 } | 2853 } |
| 2854 | 2854 |
| 2855 - (void)openAll:(const BookmarkNode*)node | 2855 - (void)openAll:(const BookmarkNode*)node |
| 2856 disposition:(WindowOpenDisposition)disposition { | 2856 disposition:(WindowOpenDisposition)disposition { |
| 2857 [self closeFolderAndStopTrackingMenus]; | 2857 [self closeFolderAndStopTrackingMenus]; |
| 2858 chrome::OpenAll([[self view] window], browser_, node, disposition, | 2858 chrome::OpenAll([[self view] window], browser_, node, disposition, |
| 2859 browser_->profile()); | 2859 browser_->profile()); |
| 2860 } | 2860 } |
| 2861 | 2861 |
| 2862 - (void)addButtonForNode:(const BookmarkNode*)node | 2862 - (void)addButtonForNode:(const BookmarkNode*)node |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3005 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 3005 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 3006 (const BookmarkNode*)node { | 3006 (const BookmarkNode*)node { |
| 3007 // See if it's in the bar, then if it is in the hierarchy of visible | 3007 // See if it's in the bar, then if it is in the hierarchy of visible |
| 3008 // folder menus. | 3008 // folder menus. |
| 3009 if (bookmarkModel_->bookmark_bar_node() == node) | 3009 if (bookmarkModel_->bookmark_bar_node() == node) |
| 3010 return self; | 3010 return self; |
| 3011 return [folderController_ controllerForNode:node]; | 3011 return [folderController_ controllerForNode:node]; |
| 3012 } | 3012 } |
| 3013 | 3013 |
| 3014 @end | 3014 @end |
| OLD | NEW |