| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // the stack. | 187 // the stack. |
| 188 [self retain]; | 188 [self retain]; |
| 189 | 189 |
| 190 // Lock bar visibility, forcing the overlay to stay visible if we are in | 190 // Lock bar visibility, forcing the overlay to stay visible if we are in |
| 191 // fullscreen mode. | 191 // fullscreen mode. |
| 192 if ([[self delegate] dragShouldLockBarVisibility]) { | 192 if ([[self delegate] dragShouldLockBarVisibility]) { |
| 193 DCHECK(!visibilityDelegate_); | 193 DCHECK(!visibilityDelegate_); |
| 194 NSWindow* window = [[self delegate] browserWindow]; | 194 NSWindow* window = [[self delegate] browserWindow]; |
| 195 visibilityDelegate_ = | 195 visibilityDelegate_ = |
| 196 [BrowserWindowController browserWindowControllerForWindow:window]; | 196 [BrowserWindowController browserWindowControllerForWindow:window]; |
| 197 [visibilityDelegate_ lockBarVisibilityForOwner:self | 197 [visibilityDelegate_ lockBarVisibilityForOwner:self withAnimation:NO]; |
| 198 withAnimation:NO | |
| 199 delay:NO]; | |
| 200 } | 198 } |
| 201 const BookmarkNode* node = [self bookmarkNode]; | 199 const BookmarkNode* node = [self bookmarkNode]; |
| 202 const BookmarkNode* parent = node->parent(); | 200 const BookmarkNode* parent = node->parent(); |
| 203 if (parent && parent->type() == BookmarkNode::FOLDER) { | 201 if (parent && parent->type() == BookmarkNode::FOLDER) { |
| 204 content::RecordAction(UserMetricsAction("BookmarkBarFolder_DragStart")); | 202 content::RecordAction(UserMetricsAction("BookmarkBarFolder_DragStart")); |
| 205 } else { | 203 } else { |
| 206 content::RecordAction(UserMetricsAction("BookmarkBar_DragStart")); | 204 content::RecordAction(UserMetricsAction("BookmarkBar_DragStart")); |
| 207 } | 205 } |
| 208 | 206 |
| 209 dragMouseOffset_ = [self convertPoint:[event locationInWindow] fromView:nil]; | 207 dragMouseOffset_ = [self convertPoint:[event locationInWindow] fromView:nil]; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 operation |= NSDragOperationDelete; | 246 operation |= NSDragOperationDelete; |
| 249 | 247 |
| 250 return operation; | 248 return operation; |
| 251 } | 249 } |
| 252 | 250 |
| 253 // Overridden to release bar visibility. | 251 // Overridden to release bar visibility. |
| 254 - (DraggableButtonResult)endDrag { | 252 - (DraggableButtonResult)endDrag { |
| 255 gDraggedButton = nil; | 253 gDraggedButton = nil; |
| 256 | 254 |
| 257 // visibilityDelegate_ can be nil if we're detached, and that's fine. | 255 // visibilityDelegate_ can be nil if we're detached, and that's fine. |
| 258 [visibilityDelegate_ releaseBarVisibilityForOwner:self | 256 [visibilityDelegate_ releaseBarVisibilityForOwner:self withAnimation:YES]; |
| 259 withAnimation:YES | |
| 260 delay:YES]; | |
| 261 visibilityDelegate_ = nil; | 257 visibilityDelegate_ = nil; |
| 262 | 258 |
| 263 return kDraggableButtonImplUseBase; | 259 return kDraggableButtonImplUseBase; |
| 264 } | 260 } |
| 265 | 261 |
| 266 - (void)draggingSession:(NSDraggingSession*)session | 262 - (void)draggingSession:(NSDraggingSession*)session |
| 267 endedAtPoint:(NSPoint)aPoint | 263 endedAtPoint:(NSPoint)aPoint |
| 268 operation:(NSDragOperation)operation { | 264 operation:(NSDragOperation)operation { |
| 269 gDraggedButton = nil; | 265 gDraggedButton = nil; |
| 270 // Inform delegate of drag source that we're finished dragging, | 266 // Inform delegate of drag source that we're finished dragging, |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 [[cell clipPathForFrame:bounds inView:self] setClip]; | 514 [[cell clipPathForFrame:bounds inView:self] setClip]; |
| 519 [cell drawWithFrame:bounds inView:self]; | 515 [cell drawWithFrame:bounds inView:self]; |
| 520 | 516 |
| 521 CGContextEndTransparencyLayer(cgContext); | 517 CGContextEndTransparencyLayer(cgContext); |
| 522 [image unlockFocus]; | 518 [image unlockFocus]; |
| 523 | 519 |
| 524 return image.autorelease(); | 520 return image.autorelease(); |
| 525 } | 521 } |
| 526 | 522 |
| 527 @end | 523 @end |
| OLD | NEW |