| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "components/bookmarks/browser/bookmark_utils.h" | 56 #include "components/bookmarks/browser/bookmark_utils.h" |
| 57 #include "components/bookmarks/common/bookmark_pref_names.h" | 57 #include "components/bookmarks/common/bookmark_pref_names.h" |
| 58 #include "components/bookmarks/managed/managed_bookmark_service.h" | 58 #include "components/bookmarks/managed/managed_bookmark_service.h" |
| 59 #include "components/prefs/pref_service.h" | 59 #include "components/prefs/pref_service.h" |
| 60 #include "content/public/browser/user_metrics.h" | 60 #include "content/public/browser/user_metrics.h" |
| 61 #include "content/public/browser/web_contents.h" | 61 #include "content/public/browser/web_contents.h" |
| 62 #include "extensions/browser/extension_registry.h" | 62 #include "extensions/browser/extension_registry.h" |
| 63 #include "extensions/common/extension.h" | 63 #include "extensions/common/extension.h" |
| 64 #include "extensions/common/extension_set.h" | 64 #include "extensions/common/extension_set.h" |
| 65 #include "grit/theme_resources.h" | 65 #include "grit/theme_resources.h" |
| 66 #include "ui/base/clipboard/clipboard_util_mac.h" |
| 66 #import "ui/base/cocoa/cocoa_base_utils.h" | 67 #import "ui/base/cocoa/cocoa_base_utils.h" |
| 67 #import "ui/base/cocoa/nsview_additions.h" | 68 #import "ui/base/cocoa/nsview_additions.h" |
| 68 #include "ui/base/l10n/l10n_util_mac.h" | 69 #include "ui/base/l10n/l10n_util_mac.h" |
| 69 #include "ui/base/resource/resource_bundle.h" | 70 #include "ui/base/resource/resource_bundle.h" |
| 70 #include "ui/gfx/image/image.h" | 71 #include "ui/gfx/image/image.h" |
| 71 #include "ui/resources/grit/ui_resources.h" | 72 #include "ui/resources/grit/ui_resources.h" |
| 72 | 73 |
| 73 using base::UserMetricsAction; | 74 using base::UserMetricsAction; |
| 74 using bookmarks::BookmarkModel; | 75 using bookmarks::BookmarkModel; |
| 75 using bookmarks::BookmarkNode; | 76 using bookmarks::BookmarkNode; |
| (...skipping 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2558 // TODO(jrg): much of this logic is duped with | 2559 // TODO(jrg): much of this logic is duped with |
| 2559 // [BookmarkBarFolderController draggingEntered:] except when noted. | 2560 // [BookmarkBarFolderController draggingEntered:] except when noted. |
| 2560 // http://crbug.com/35966 | 2561 // http://crbug.com/35966 |
| 2561 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info { | 2562 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info { |
| 2562 NSPoint point = [info draggingLocation]; | 2563 NSPoint point = [info draggingLocation]; |
| 2563 BookmarkButton* button = [self buttonForDroppingOnAtPoint:point]; | 2564 BookmarkButton* button = [self buttonForDroppingOnAtPoint:point]; |
| 2564 | 2565 |
| 2565 // Don't allow drops that would result in cycles. | 2566 // Don't allow drops that would result in cycles. |
| 2566 if (button) { | 2567 if (button) { |
| 2567 NSData* data = [[info draggingPasteboard] | 2568 NSData* data = [[info draggingPasteboard] |
| 2568 dataForType:kBookmarkButtonDragType]; | 2569 dataForType:ui::ClipboardUtil::UTIForPasteboardType( |
| 2570 kBookmarkButtonDragType)]; |
| 2569 if (data && [info draggingSource]) { | 2571 if (data && [info draggingSource]) { |
| 2570 BookmarkButton* sourceButton = nil; | 2572 BookmarkButton* sourceButton = nil; |
| 2571 [data getBytes:&sourceButton length:sizeof(sourceButton)]; | 2573 [data getBytes:&sourceButton length:sizeof(sourceButton)]; |
| 2572 const BookmarkNode* sourceNode = [sourceButton bookmarkNode]; | 2574 const BookmarkNode* sourceNode = [sourceButton bookmarkNode]; |
| 2573 const BookmarkNode* destNode = [button bookmarkNode]; | 2575 const BookmarkNode* destNode = [button bookmarkNode]; |
| 2574 if (destNode->HasAncestor(sourceNode)) | 2576 if (destNode->HasAncestor(sourceNode)) |
| 2575 button = nil; | 2577 button = nil; |
| 2576 } | 2578 } |
| 2577 } | 2579 } |
| 2578 | 2580 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2939 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2941 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 2940 (const BookmarkNode*)node { | 2942 (const BookmarkNode*)node { |
| 2941 // See if it's in the bar, then if it is in the hierarchy of visible | 2943 // See if it's in the bar, then if it is in the hierarchy of visible |
| 2942 // folder menus. | 2944 // folder menus. |
| 2943 if (bookmarkModel_->bookmark_bar_node() == node) | 2945 if (bookmarkModel_->bookmark_bar_node() == node) |
| 2944 return self; | 2946 return self; |
| 2945 return [folderController_ controllerForNode:node]; | 2947 return [folderController_ controllerForNode:node]; |
| 2946 } | 2948 } |
| 2947 | 2949 |
| 2948 @end | 2950 @end |
| OLD | NEW |