| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "base/logging.h" | 5 #include "base/logging.h" |
| 6 #import "base/scoped_nsobject.h" | 6 #import "base/scoped_nsobject.h" |
| 7 #import "chrome/browser/cocoa/bookmark_button.h" | 7 #import "chrome/browser/cocoa/bookmark_button.h" |
| 8 #import "chrome/browser/cocoa/bookmark_button_cell.h" | 8 #import "chrome/browser/cocoa/bookmark_button_cell.h" |
| 9 #import "third_party/GTM/AppKit/GTMTheme.h" | 9 #import "third_party/GTM/AppKit/GTMTheme.h" |
| 10 | 10 |
| 11 NSString* kBookmarkButtonDragType = @"ChromiumBookmarkButtonDragType"; | 11 NSString* kBookmarkButtonDragType = @"ChromiumBookmarkButtonDragType"; |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // Code taken from <http://codereview.chromium.org/180036/diff/3001/3004>. | 15 // Code taken from <http://codereview.chromium.org/180036/diff/3001/3004>. |
| 16 // TODO(viettrungluu): Do we want common, standard code for drag hysteresis? | 16 // TODO(viettrungluu): Do we want common, standard code for drag hysteresis? |
| 17 const CGFloat kWebDragStartHysteresisX = 5.0; | 17 const CGFloat kWebDragStartHysteresisX = 5.0; |
| 18 const CGFloat kWebDragStartHysteresisY = 5.0; | 18 const CGFloat kWebDragStartHysteresisY = 5.0; |
| 19 | 19 |
| 20 // The opacity of the bookmark button drag image. | 20 // The opacity of the bookmark button drag image. |
| 21 const CGFloat kDragImageOpacity = 0.8; | 21 const CGFloat kDragImageOpacity = 0.7; |
| 22 | 22 |
| 23 } | 23 } |
| 24 | 24 |
| 25 @interface BookmarkButton(Private) | 25 @interface BookmarkButton(Private) |
| 26 | 26 |
| 27 // Make a drag image for the button. | 27 // Make a drag image for the button. |
| 28 - (NSImage*)dragImage; | 28 - (NSImage*)dragImage; |
| 29 | 29 |
| 30 @end // @interface BookmarkButton(Private) | 30 @end // @interface BookmarkButton(Private) |
| 31 | 31 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 [image drawAtPoint:NSMakePoint(0, 0) | 162 [image drawAtPoint:NSMakePoint(0, 0) |
| 163 fromRect:NSMakeRect(0, 0, NSWidth(bounds), NSHeight(bounds)) | 163 fromRect:NSMakeRect(0, 0, NSWidth(bounds), NSHeight(bounds)) |
| 164 operation:NSCompositeSourceOver | 164 operation:NSCompositeSourceOver |
| 165 fraction:kDragImageOpacity]; | 165 fraction:kDragImageOpacity]; |
| 166 | 166 |
| 167 [dragImage unlockFocus]; | 167 [dragImage unlockFocus]; |
| 168 return dragImage; | 168 return dragImage; |
| 169 } | 169 } |
| 170 | 170 |
| 171 @end // @implementation BookmarkButton(Private) | 171 @end // @implementation BookmarkButton(Private) |
| OLD | NEW |