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" |
11 #import "base/mac/scoped_nsobject.h" | 11 #import "base/mac/scoped_nsobject.h" |
12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" | 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" |
13 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" | 13 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
14 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 14 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
15 #import "chrome/browser/ui/cocoa/view_id_util.h" | 15 #import "chrome/browser/ui/cocoa/view_id_util.h" |
16 #include "components/bookmarks/browser/bookmark_model.h" | 16 #include "components/bookmarks/browser/bookmark_model.h" |
17 #include "content/public/browser/user_metrics.h" | 17 #include "content/public/browser/user_metrics.h" |
18 #import "ui/base/cocoa/nsview_additions.h" | 18 #import "ui/base/cocoa/nsview_additions.h" |
19 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 19 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
20 | 20 |
21 using base::UserMetricsAction; | 21 using base::UserMetricsAction; |
22 using bookmarks::BookmarkNode; | 22 using bookmarks::BookmarkNode; |
23 | 23 |
24 // The opacity of the bookmark button drag image. | 24 // The opacity of the bookmark button drag image. |
25 static const CGFloat kDragImageOpacity = 0.7; | 25 static const CGFloat kDragImageOpacity = 0.7; |
26 | 26 |
27 namespace bookmark_button { | |
28 | |
29 NSString* const kPulseBookmarkButtonNotification = | |
30 @"PulseBookmarkButtonNotification"; | |
31 NSString* const kBookmarkKey = @"BookmarkKey"; | |
32 NSString* const kBookmarkPulseFlagKey = @"BookmarkPulseFlagKey"; | |
33 | |
34 }; | |
35 | |
36 namespace { | 27 namespace { |
37 // We need a class variable to track the current dragged button to enable | 28 // We need a class variable to track the current dragged button to enable |
38 // proper live animated dragging behavior, and can't do it in the | 29 // proper live animated dragging behavior, and can't do it in the |
39 // delegate/controller since you can drag a button from one domain to the | 30 // delegate/controller since you can drag a button from one domain to the |
40 // other (from a "folder" menu, to the main bar, or vice versa). | 31 // other (from a "folder" menu, to the main bar, or vice versa). |
41 BookmarkButton* gDraggedButton = nil; // Weak | 32 BookmarkButton* gDraggedButton = nil; // Weak |
42 }; | 33 }; |
43 | 34 |
44 @interface BookmarkButton(Private) | 35 @interface BookmarkButton(Private) |
45 | 36 |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 [[cell clipPathForFrame:bounds inView:self] setClip]; | 467 [[cell clipPathForFrame:bounds inView:self] setClip]; |
477 [cell drawWithFrame:bounds inView:self]; | 468 [cell drawWithFrame:bounds inView:self]; |
478 | 469 |
479 CGContextEndTransparencyLayer(cgContext); | 470 CGContextEndTransparencyLayer(cgContext); |
480 [image unlockFocus]; | 471 [image unlockFocus]; |
481 | 472 |
482 return image.autorelease(); | 473 return image.autorelease(); |
483 } | 474 } |
484 | 475 |
485 @end // @implementation BookmarkButton(Private) | 476 @end // @implementation BookmarkButton(Private) |
OLD | NEW |