| 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_button.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // the stack. | 190 // the stack. |
| 191 [self retain]; | 191 [self retain]; |
| 192 | 192 |
| 193 // Lock bar visibility, forcing the overlay to stay visible if we are in | 193 // Lock bar visibility, forcing the overlay to stay visible if we are in |
| 194 // fullscreen mode. | 194 // fullscreen mode. |
| 195 if ([[self delegate] dragShouldLockBarVisibility]) { | 195 if ([[self delegate] dragShouldLockBarVisibility]) { |
| 196 DCHECK(!visibilityDelegate_); | 196 DCHECK(!visibilityDelegate_); |
| 197 NSWindow* window = [[self delegate] browserWindow]; | 197 NSWindow* window = [[self delegate] browserWindow]; |
| 198 visibilityDelegate_ = | 198 visibilityDelegate_ = |
| 199 [BrowserWindowController browserWindowControllerForWindow:window]; | 199 [BrowserWindowController browserWindowControllerForWindow:window]; |
| 200 [visibilityDelegate_ lockBarVisibilityForOwner:self withAnimation:NO]; | 200 [visibilityDelegate_ lockToolbarVisibilityForOwner:self withAnimation:NO]; |
| 201 } | 201 } |
| 202 const BookmarkNode* node = [self bookmarkNode]; | 202 const BookmarkNode* node = [self bookmarkNode]; |
| 203 const BookmarkNode* parent = node->parent(); | 203 const BookmarkNode* parent = node->parent(); |
| 204 if (parent && parent->type() == BookmarkNode::FOLDER) { | 204 if (parent && parent->type() == BookmarkNode::FOLDER) { |
| 205 content::RecordAction(UserMetricsAction("BookmarkBarFolder_DragStart")); | 205 content::RecordAction(UserMetricsAction("BookmarkBarFolder_DragStart")); |
| 206 } else { | 206 } else { |
| 207 content::RecordAction(UserMetricsAction("BookmarkBar_DragStart")); | 207 content::RecordAction(UserMetricsAction("BookmarkBar_DragStart")); |
| 208 } | 208 } |
| 209 | 209 |
| 210 dragMouseOffset_ = [self convertPoint:[event locationInWindow] fromView:nil]; | 210 dragMouseOffset_ = [self convertPoint:[event locationInWindow] fromView:nil]; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 operation |= NSDragOperationDelete; | 249 operation |= NSDragOperationDelete; |
| 250 | 250 |
| 251 return operation; | 251 return operation; |
| 252 } | 252 } |
| 253 | 253 |
| 254 // Overridden to release bar visibility. | 254 // Overridden to release bar visibility. |
| 255 - (DraggableButtonResult)endDrag { | 255 - (DraggableButtonResult)endDrag { |
| 256 gDraggedButton = nil; | 256 gDraggedButton = nil; |
| 257 | 257 |
| 258 // visibilityDelegate_ can be nil if we're detached, and that's fine. | 258 // visibilityDelegate_ can be nil if we're detached, and that's fine. |
| 259 [visibilityDelegate_ releaseBarVisibilityForOwner:self withAnimation:YES]; | 259 [visibilityDelegate_ releaseToolbarVisibilityForOwner:self withAnimation:YES]; |
| 260 visibilityDelegate_ = nil; | 260 visibilityDelegate_ = nil; |
| 261 | 261 |
| 262 return kDraggableButtonImplUseBase; | 262 return kDraggableButtonImplUseBase; |
| 263 } | 263 } |
| 264 | 264 |
| 265 - (void)draggingSession:(NSDraggingSession*)session | 265 - (void)draggingSession:(NSDraggingSession*)session |
| 266 endedAtPoint:(NSPoint)aPoint | 266 endedAtPoint:(NSPoint)aPoint |
| 267 operation:(NSDragOperation)operation { | 267 operation:(NSDragOperation)operation { |
| 268 gDraggedButton = nil; | 268 gDraggedButton = nil; |
| 269 // Inform delegate of drag source that we're finished dragging, | 269 // Inform delegate of drag source that we're finished dragging, |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 [[cell clipPathForFrame:bounds inView:self] setClip]; | 524 [[cell clipPathForFrame:bounds inView:self] setClip]; |
| 525 [cell drawWithFrame:bounds inView:self]; | 525 [cell drawWithFrame:bounds inView:self]; |
| 526 | 526 |
| 527 CGContextEndTransparencyLayer(cgContext); | 527 CGContextEndTransparencyLayer(cgContext); |
| 528 [image unlockFocus]; | 528 [image unlockFocus]; |
| 529 | 529 |
| 530 return image.autorelease(); | 530 return image.autorelease(); |
| 531 } | 531 } |
| 532 | 532 |
| 533 @end | 533 @end |
| OLD | NEW |