OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/extensions/browser_action_button.h" | 5 #import "chrome/browser/cocoa/extensions/browser_action_button.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
12 #include "chrome/browser/cocoa/extensions/extension_action_context_menu.h" | 12 #include "chrome/browser/cocoa/extensions/extension_action_context_menu.h" |
13 #import "chrome/browser/cocoa/image_utils.h" | 13 #import "chrome/browser/cocoa/image_utils.h" |
14 #include "chrome/browser/extensions/image_loading_tracker.h" | 14 #include "chrome/browser/extensions/image_loading_tracker.h" |
15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
16 #include "chrome/common/extensions/extension_action.h" | 16 #include "chrome/common/extensions/extension_action.h" |
17 #include "chrome/common/extensions/extension_resource.h" | 17 #include "chrome/common/extensions/extension_resource.h" |
18 #include "chrome/common/notification_observer.h" | 18 #include "chrome/common/notification_observer.h" |
19 #include "chrome/common/notification_registrar.h" | 19 #include "chrome/common/notification_registrar.h" |
20 #include "chrome/common/notification_source.h" | 20 #include "chrome/common/notification_source.h" |
21 #include "chrome/common/notification_type.h" | 21 #include "chrome/common/notification_type.h" |
22 #include "gfx/canvas_paint.h" | 22 #include "gfx/canvas_paint.h" |
23 #include "gfx/rect.h" | 23 #include "gfx/rect.h" |
24 #include "gfx/size.h" | 24 #include "gfx/size.h" |
25 #include "skia/ext/skia_utils_mac.h" | 25 #include "skia/ext/skia_utils_mac.h" |
26 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" | 26 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" |
27 | 27 |
28 extern const NSString* kBrowserActionButtonUpdatedNotification = | 28 NSString* const kBrowserActionButtonUpdatedNotification = |
29 @"BrowserActionButtonUpdatedNotification"; | 29 @"BrowserActionButtonUpdatedNotification"; |
30 | 30 |
31 extern const NSString* kBrowserActionButtonDraggingNotification = | 31 NSString* const kBrowserActionButtonDraggingNotification = |
32 @"BrowserActionButtonDraggingNotification"; | 32 @"BrowserActionButtonDraggingNotification"; |
33 extern const NSString* kBrowserActionButtonDragEndNotification = | 33 NSString* const kBrowserActionButtonDragEndNotification = |
34 @"BrowserActionButtonDragEndNotification"; | 34 @"BrowserActionButtonDragEndNotification"; |
35 | 35 |
36 static const CGFloat kBrowserActionBadgeOriginYOffset = 5; | 36 static const CGFloat kBrowserActionBadgeOriginYOffset = 5; |
37 | 37 |
38 // Since the container is the maximum height of the toolbar, we have to move the | 38 // Since the container is the maximum height of the toolbar, we have to move the |
39 // buttons up by this amount in order to have them look vertically centered | 39 // buttons up by this amount in order to have them look vertically centered |
40 // within the toolbar. | 40 // within the toolbar. |
41 static const CGFloat kBrowserActionOriginYOffset = 5; | 41 static const CGFloat kBrowserActionOriginYOffset = 5; |
42 | 42 |
43 // The size of each button on the toolbar. | 43 // The size of each button on the toolbar. |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { | 335 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { |
336 [NSGraphicsContext saveGraphicsState]; | 336 [NSGraphicsContext saveGraphicsState]; |
337 [self setIconShadow]; | 337 [self setIconShadow]; |
338 [super drawInteriorWithFrame:cellFrame inView:controlView]; | 338 [super drawInteriorWithFrame:cellFrame inView:controlView]; |
339 cellFrame.origin.y += kBrowserActionBadgeOriginYOffset; | 339 cellFrame.origin.y += kBrowserActionBadgeOriginYOffset; |
340 [self drawBadgeWithinFrame:cellFrame]; | 340 [self drawBadgeWithinFrame:cellFrame]; |
341 [NSGraphicsContext restoreGraphicsState]; | 341 [NSGraphicsContext restoreGraphicsState]; |
342 } | 342 } |
343 | 343 |
344 @end | 344 @end |
OLD | NEW |