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