Chromium Code Reviews| 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_folder_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
| 8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #import "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #import "chrome/browser/bookmarks/bookmark_model_factory.h" |
| (...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1927 [buttons_ removeObjectAtIndex:buttonIndex]; | 1927 [buttons_ removeObjectAtIndex:buttonIndex]; |
| 1928 for (NSInteger i = 0; i < buttonIndex; ++i) { | 1928 for (NSInteger i = 0; i < buttonIndex; ++i) { |
| 1929 BookmarkButton* button = [buttons_ objectAtIndex:i]; | 1929 BookmarkButton* button = [buttons_ objectAtIndex:i]; |
| 1930 NSRect buttonFrame = [button frame]; | 1930 NSRect buttonFrame = [button frame]; |
| 1931 buttonFrame.origin.y -= bookmarks::kBookmarkFolderButtonHeight; | 1931 buttonFrame.origin.y -= bookmarks::kBookmarkFolderButtonHeight; |
| 1932 [button setFrame:buttonFrame]; | 1932 [button setFrame:buttonFrame]; |
| 1933 } | 1933 } |
| 1934 // Search for and adjust submenus, if necessary. | 1934 // Search for and adjust submenus, if necessary. |
| 1935 NSInteger buttonCount = [buttons_ count]; | 1935 NSInteger buttonCount = [buttons_ count]; |
| 1936 if (buttonCount) { | 1936 if (buttonCount) { |
| 1937 BookmarkButton* subButton = [folderController_ parentButton]; | 1937 // In case of Drag & Drop within a folder, if the target folder is showing |
|
Alexei Svitkine (slow)
2014/10/02 20:55:59
I'm not sure this behavior (as described by the co
Gaja
2014/10/05 05:41:27
Done.
| |
| 1938 for (NSButton* aButton in buttons_.get()) { | 1938 // its menu during drop and is below the dragged item, the folder moves |
| 1939 // If this button is showing its menu then we need to move the menu, too. | 1939 // upwards by kBookmarkFolderButtonHeight, then we need to move the menu, |
| 1940 if (aButton == subButton) | 1940 // too. |
| 1941 [folderController_ | 1941 if (folderController_) { |
| 1942 offsetFolderMenuWindow:NSMakeSize(0.0, chrome::kBookmarkBarHeight)]; | 1942 BookmarkButton* targetButton = [folderController_ parentButton]; |
| 1943 NSInteger dropIndex = [buttons_ indexOfObject:targetButton]; | |
| 1944 if ((dropIndex + 1) > buttonIndex) | |
|
Alexei Svitkine (slow)
2014/10/02 20:55:59
Nit: {}'s
Gaja
2014/10/05 05:41:27
Done.
| |
| 1945 [folderController_ offsetFolderMenuWindow:NSMakeSize( | |
| 1946 0.0, bookmarks::kBookmarkFolderButtonHeight)]; | |
| 1943 } | 1947 } |
| 1944 } else if (parentButton_ != [barController_ otherBookmarksButton]) { | 1948 } else if (parentButton_ != [barController_ otherBookmarksButton]) { |
| 1945 // If all nodes have been removed from this folder then add in the | 1949 // If all nodes have been removed from this folder then add in the |
| 1946 // 'empty' placeholder button except for "Other bookmarks" folder | 1950 // 'empty' placeholder button except for "Other bookmarks" folder |
| 1947 // as we are going to hide it. | 1951 // as we are going to hide it. |
| 1948 NSRect buttonFrame = | 1952 NSRect buttonFrame = |
| 1949 GetFirstButtonFrameForHeight([self menuHeightForButtonCount:1]); | 1953 GetFirstButtonFrameForHeight([self menuHeightForButtonCount:1]); |
| 1950 BookmarkButton* button = [self makeButtonForNode:nil | 1954 BookmarkButton* button = [self makeButtonForNode:nil |
| 1951 frame:buttonFrame]; | 1955 frame:buttonFrame]; |
| 1952 [buttons_ addObject:button]; | 1956 [buttons_ addObject:button]; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2003 | 2007 |
| 2004 - (void)setIgnoreAnimations:(BOOL)ignore { | 2008 - (void)setIgnoreAnimations:(BOOL)ignore { |
| 2005 ignoreAnimations_ = ignore; | 2009 ignoreAnimations_ = ignore; |
| 2006 } | 2010 } |
| 2007 | 2011 |
| 2008 - (BookmarkButton*)buttonThatMouseIsIn { | 2012 - (BookmarkButton*)buttonThatMouseIsIn { |
| 2009 return buttonThatMouseIsIn_; | 2013 return buttonThatMouseIsIn_; |
| 2010 } | 2014 } |
| 2011 | 2015 |
| 2012 @end // BookmarkBarFolderController | 2016 @end // BookmarkBarFolderController |
| OLD | NEW |