| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_folder_target.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // hover-open or "open folder" due to a click. It doesn't matter | 58 // hover-open or "open folder" due to a click. It doesn't matter |
| 59 // (both do the same thing) unless a modifier is held, since | 59 // (both do the same thing) unless a modifier is held, since |
| 60 // command-click should "open all" but command-move should not. | 60 // command-click should "open all" but command-move should not. |
| 61 // WindowOpenDispositionFromNSEvent does not consider the event | 61 // WindowOpenDispositionFromNSEvent does not consider the event |
| 62 // type; only the modifiers. Thus the need for an extra | 62 // type; only the modifiers. Thus the need for an extra |
| 63 // event-type-check here. | 63 // event-type-check here. |
| 64 DCHECK([sender bookmarkNode]->is_folder()); | 64 DCHECK([sender bookmarkNode]->is_folder()); |
| 65 NSEvent* event = [NSApp currentEvent]; | 65 NSEvent* event = [NSApp currentEvent]; |
| 66 WindowOpenDisposition disposition = | 66 WindowOpenDisposition disposition = |
| 67 ui::WindowOpenDispositionFromNSEvent(event); | 67 ui::WindowOpenDispositionFromNSEvent(event); |
| 68 if (([event type] != NSMouseEntered) && | 68 if (([event type] != NSMouseEntered) && ([event type] != NSMouseMoved) && |
| 69 ([event type] != NSMouseMoved) && | |
| 70 ([event type] != NSScrollWheel) && | 69 ([event type] != NSScrollWheel) && |
| 71 (disposition == NEW_BACKGROUND_TAB)) { | 70 (disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB)) { |
| 72 [controller_ closeAllBookmarkFolders]; | 71 [controller_ closeAllBookmarkFolders]; |
| 73 [controller_ openAll:[sender bookmarkNode] disposition:disposition]; | 72 [controller_ openAll:[sender bookmarkNode] disposition:disposition]; |
| 74 return; | 73 return; |
| 75 } | 74 } |
| 76 | 75 |
| 77 // If click on same folder, close it and be done. | 76 // If click on same folder, close it and be done. |
| 78 // Else we clicked on a different folder so more work to do. | 77 // Else we clicked on a different folder so more work to do. |
| 79 if ([[controller_ folderController] parentButton] == sender) { | 78 if ([[controller_ folderController] parentButton] == sender) { |
| 80 [controller_ closeBookmarkFolder:controller_]; | 79 [controller_ closeBookmarkFolder:controller_]; |
| 81 return; | 80 return; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 100 item = PasteboardItemFromBookmarks(data.elements, profile_->GetPath()); | 99 item = PasteboardItemFromBookmarks(data.elements, profile_->GetPath()); |
| 101 } | 100 } |
| 102 | 101 |
| 103 [item | 102 [item |
| 104 setData:[NSData dataWithBytes:&button length:sizeof(button)] | 103 setData:[NSData dataWithBytes:&button length:sizeof(button)] |
| 105 forType:ui::ClipboardUtil::UTIForPasteboardType(kBookmarkButtonDragType)]; | 104 forType:ui::ClipboardUtil::UTIForPasteboardType(kBookmarkButtonDragType)]; |
| 106 return item; | 105 return item; |
| 107 } | 106 } |
| 108 | 107 |
| 109 @end | 108 @end |
| OLD | NEW |