Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm

Issue 1855783002: mac: More pasteboard fixes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp23_dnd
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/sdk_forward_declarations.h" 10 #include "base/mac/sdk_forward_declarations.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #import "chrome/browser/bookmarks/bookmark_model_factory.h" 12 #import "chrome/browser/bookmarks/bookmark_model_factory.h"
13 #import "chrome/browser/bookmarks/managed_bookmark_service_factory.h" 13 #import "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
14 #import "chrome/browser/profiles/profile.h" 14 #import "chrome/browser/profiles/profile.h"
15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" 15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h"
16 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 16 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell.h" 17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell.h"
18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state.h" 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state.h"
19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.h" 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.h"
20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" 20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h"
21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" 21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h"
22 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h" 22 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h"
23 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 23 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
24 #include "components/bookmarks/browser/bookmark_model.h" 24 #include "components/bookmarks/browser/bookmark_model.h"
25 #include "components/bookmarks/browser/bookmark_node_data.h" 25 #include "components/bookmarks/browser/bookmark_node_data.h"
26 #import "components/bookmarks/managed/managed_bookmark_service.h" 26 #import "components/bookmarks/managed/managed_bookmark_service.h"
27 #include "ui/base/clipboard/clipboard_util_mac.h"
27 #include "ui/base/cocoa/cocoa_base_utils.h" 28 #include "ui/base/cocoa/cocoa_base_utils.h"
28 #include "ui/base/theme_provider.h" 29 #include "ui/base/theme_provider.h"
29 30
30 using bookmarks::BookmarkModel; 31 using bookmarks::BookmarkModel;
31 using bookmarks::BookmarkNode; 32 using bookmarks::BookmarkNode;
32 using bookmarks::BookmarkNodeData; 33 using bookmarks::BookmarkNodeData;
33 using bookmarks::kBookmarkBarMenuCornerRadius; 34 using bookmarks::kBookmarkBarMenuCornerRadius;
34 35
35 namespace { 36 namespace {
36 37
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1447 // folder_view. Here we handle hover open issues for subfolders. 1448 // folder_view. Here we handle hover open issues for subfolders.
1448 // Caution: there are subtle differences between this one and 1449 // Caution: there are subtle differences between this one and
1449 // bookmark_bar_controller.mm's version. 1450 // bookmark_bar_controller.mm's version.
1450 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info { 1451 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info {
1451 NSPoint currentLocation = [info draggingLocation]; 1452 NSPoint currentLocation = [info draggingLocation];
1452 BookmarkButton* button = [self buttonForDroppingOnAtPoint:currentLocation]; 1453 BookmarkButton* button = [self buttonForDroppingOnAtPoint:currentLocation];
1453 1454
1454 // Don't allow drops that would result in cycles. 1455 // Don't allow drops that would result in cycles.
1455 if (button) { 1456 if (button) {
1456 NSData* data = [[info draggingPasteboard] 1457 NSData* data = [[info draggingPasteboard]
1457 dataForType:kBookmarkButtonDragType]; 1458 dataForType:ui::ClipboardUtil::UTIForPasteboardType(
1459 kBookmarkButtonDragType)];
1458 if (data && [info draggingSource]) { 1460 if (data && [info draggingSource]) {
1459 BookmarkButton* sourceButton = nil; 1461 BookmarkButton* sourceButton = nil;
1460 [data getBytes:&sourceButton length:sizeof(sourceButton)]; 1462 [data getBytes:&sourceButton length:sizeof(sourceButton)];
1461 const BookmarkNode* sourceNode = [sourceButton bookmarkNode]; 1463 const BookmarkNode* sourceNode = [sourceButton bookmarkNode];
1462 const BookmarkNode* destNode = [button bookmarkNode]; 1464 const BookmarkNode* destNode = [button bookmarkNode];
1463 if (destNode->HasAncestor(sourceNode)) 1465 if (destNode->HasAncestor(sourceNode))
1464 button = nil; 1466 button = nil;
1465 } 1467 }
1466 } 1468 }
1467 // Delegate handling of dragging over a button to the |hoverState_| member. 1469 // Delegate handling of dragging over a button to the |hoverState_| member.
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 2047
2046 - (void)setIgnoreAnimations:(BOOL)ignore { 2048 - (void)setIgnoreAnimations:(BOOL)ignore {
2047 ignoreAnimations_ = ignore; 2049 ignoreAnimations_ = ignore;
2048 } 2050 }
2049 2051
2050 - (BookmarkButton*)buttonThatMouseIsIn { 2052 - (BookmarkButton*)buttonThatMouseIsIn {
2051 return buttonThatMouseIsIn_; 2053 return buttonThatMouseIsIn_;
2052 } 2054 }
2053 2055
2054 @end // BookmarkBarFolderController 2056 @end // BookmarkBarFolderController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698