| 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 2868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2879 return x; | 2879 return x; |
| 2880 } | 2880 } |
| 2881 | 2881 |
| 2882 - (void)childFolderWillShow:(id<BookmarkButtonControllerProtocol>)child { | 2882 - (void)childFolderWillShow:(id<BookmarkButtonControllerProtocol>)child { |
| 2883 // If the bookmarkbar is not in detached mode, lock bar visibility, forcing | 2883 // If the bookmarkbar is not in detached mode, lock bar visibility, forcing |
| 2884 // the overlay to stay open when in fullscreen mode. | 2884 // the overlay to stay open when in fullscreen mode. |
| 2885 if (![self isInState:BookmarkBar::DETACHED] && | 2885 if (![self isInState:BookmarkBar::DETACHED] && |
| 2886 ![self isAnimatingToState:BookmarkBar::DETACHED]) { | 2886 ![self isAnimatingToState:BookmarkBar::DETACHED]) { |
| 2887 BrowserWindowController* browserController = | 2887 BrowserWindowController* browserController = |
| 2888 [BrowserWindowController browserWindowControllerForView:[self view]]; | 2888 [BrowserWindowController browserWindowControllerForView:[self view]]; |
| 2889 [browserController lockBarVisibilityForOwner:child | 2889 [browserController lockBarVisibilityForOwner:child withAnimation:NO]; |
| 2890 withAnimation:NO | |
| 2891 delay:NO]; | |
| 2892 } | 2890 } |
| 2893 } | 2891 } |
| 2894 | 2892 |
| 2895 - (void)childFolderWillClose:(id<BookmarkButtonControllerProtocol>)child { | 2893 - (void)childFolderWillClose:(id<BookmarkButtonControllerProtocol>)child { |
| 2896 // Release bar visibility, allowing the overlay to close if in fullscreen | 2894 // Release bar visibility, allowing the overlay to close if in fullscreen |
| 2897 // mode. | 2895 // mode. |
| 2898 BrowserWindowController* browserController = | 2896 BrowserWindowController* browserController = |
| 2899 [BrowserWindowController browserWindowControllerForView:[self view]]; | 2897 [BrowserWindowController browserWindowControllerForView:[self view]]; |
| 2900 [browserController releaseBarVisibilityForOwner:child | 2898 [browserController releaseBarVisibilityForOwner:child withAnimation:NO]; |
| 2901 withAnimation:NO | |
| 2902 delay:NO]; | |
| 2903 } | 2899 } |
| 2904 | 2900 |
| 2905 // Add a new folder controller as triggered by the given folder button. | 2901 // Add a new folder controller as triggered by the given folder button. |
| 2906 - (void)addNewFolderControllerWithParentButton:(BookmarkButton*)parentButton { | 2902 - (void)addNewFolderControllerWithParentButton:(BookmarkButton*)parentButton { |
| 2907 | 2903 |
| 2908 // If doing a close/open, make sure the fullscreen chrome doesn't | 2904 // If doing a close/open, make sure the fullscreen chrome doesn't |
| 2909 // have a chance to begin animating away in the middle of things. | 2905 // have a chance to begin animating away in the middle of things. |
| 2910 BrowserWindowController* browserController = | 2906 BrowserWindowController* browserController = |
| 2911 [BrowserWindowController browserWindowControllerForView:[self view]]; | 2907 [BrowserWindowController browserWindowControllerForView:[self view]]; |
| 2912 // Confirm we're not re-locking with ourself as an owner before locking. | 2908 // Confirm we're not re-locking with ourself as an owner before locking. |
| 2913 DCHECK([browserController isBarVisibilityLockedForOwner:self] == NO); | 2909 DCHECK([browserController isBarVisibilityLockedForOwner:self] == NO); |
| 2914 [browserController lockBarVisibilityForOwner:self | 2910 [browserController lockBarVisibilityForOwner:self withAnimation:NO]; |
| 2915 withAnimation:NO | |
| 2916 delay:NO]; | |
| 2917 | 2911 |
| 2918 if (folderController_) | 2912 if (folderController_) |
| 2919 [self closeAllBookmarkFolders]; | 2913 [self closeAllBookmarkFolders]; |
| 2920 | 2914 |
| 2921 // Folder controller, like many window controllers, owns itself. | 2915 // Folder controller, like many window controllers, owns itself. |
| 2922 folderController_ = | 2916 folderController_ = |
| 2923 [[BookmarkBarFolderController alloc] | 2917 [[BookmarkBarFolderController alloc] |
| 2924 initWithParentButton:parentButton | 2918 initWithParentButton:parentButton |
| 2925 parentController:nil | 2919 parentController:nil |
| 2926 barController:self | 2920 barController:self |
| 2927 profile:browser_->profile()]; | 2921 profile:browser_->profile()]; |
| 2928 [folderController_ showWindow:self]; | 2922 [folderController_ showWindow:self]; |
| 2929 | 2923 |
| 2930 // Only BookmarkBarController has this; the | 2924 // Only BookmarkBarController has this; the |
| 2931 // BookmarkBarFolderController does not. | 2925 // BookmarkBarFolderController does not. |
| 2932 [self watchForExitEvent:YES]; | 2926 [self watchForExitEvent:YES]; |
| 2933 | 2927 |
| 2934 // No longer need to hold the lock; the folderController_ now owns it. | 2928 // No longer need to hold the lock; the folderController_ now owns it. |
| 2935 [browserController releaseBarVisibilityForOwner:self | 2929 [browserController releaseBarVisibilityForOwner:self withAnimation:NO]; |
| 2936 withAnimation:NO | |
| 2937 delay:NO]; | |
| 2938 } | 2930 } |
| 2939 | 2931 |
| 2940 - (void)openAll:(const BookmarkNode*)node | 2932 - (void)openAll:(const BookmarkNode*)node |
| 2941 disposition:(WindowOpenDisposition)disposition { | 2933 disposition:(WindowOpenDisposition)disposition { |
| 2942 [self closeFolderAndStopTrackingMenus]; | 2934 [self closeFolderAndStopTrackingMenus]; |
| 2943 chrome::OpenAll([[self view] window], browser_, node, disposition, | 2935 chrome::OpenAll([[self view] window], browser_, node, disposition, |
| 2944 browser_->profile()); | 2936 browser_->profile()); |
| 2945 } | 2937 } |
| 2946 | 2938 |
| 2947 - (void)addButtonForNode:(const BookmarkNode*)node | 2939 - (void)addButtonForNode:(const BookmarkNode*)node |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3090 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 3082 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 3091 (const BookmarkNode*)node { | 3083 (const BookmarkNode*)node { |
| 3092 // See if it's in the bar, then if it is in the hierarchy of visible | 3084 // See if it's in the bar, then if it is in the hierarchy of visible |
| 3093 // folder menus. | 3085 // folder menus. |
| 3094 if (bookmarkModel_->bookmark_bar_node() == node) | 3086 if (bookmarkModel_->bookmark_bar_node() == node) |
| 3095 return self; | 3087 return self; |
| 3096 return [folderController_ controllerForNode:node]; | 3088 return [folderController_ controllerForNode:node]; |
| 3097 } | 3089 } |
| 3098 | 3090 |
| 3099 @end | 3091 @end |
| OLD | NEW |