OLD | NEW |
1 // Copyright (c) 2009 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 #include "chrome/browser/cocoa/base_view.h" | 5 #import "chrome/browser/cocoa/base_view.h" |
| 6 #import "chrome/browser/cocoa/view_id_util.h" |
6 | 7 |
7 @implementation BaseView | 8 @implementation BaseView |
8 | 9 |
| 10 @synthesize viewID = viewID_; |
| 11 |
9 - (id)initWithFrame:(NSRect)frame { | 12 - (id)initWithFrame:(NSRect)frame { |
10 self = [super initWithFrame:frame]; | 13 self = [super initWithFrame:frame]; |
11 if (self) { | 14 if (self) { |
12 trackingArea_ = | 15 trackingArea_ = |
13 [[NSTrackingArea alloc] initWithRect:frame | 16 [[NSTrackingArea alloc] initWithRect:frame |
14 options:NSTrackingMouseMoved | | 17 options:NSTrackingMouseMoved | |
15 NSTrackingMouseEnteredAndExited | | 18 NSTrackingMouseEnteredAndExited | |
16 NSTrackingActiveInActiveApp | | 19 NSTrackingActiveInActiveApp | |
17 NSTrackingInVisibleRect | 20 NSTrackingInVisibleRect |
18 owner:self | 21 owner:self |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 return new_rect; | 136 return new_rect; |
134 } | 137 } |
135 | 138 |
136 - (NSRect)RectToNSRect:(gfx::Rect)rect { | 139 - (NSRect)RectToNSRect:(gfx::Rect)rect { |
137 NSRect new_rect(NSRectFromCGRect(rect.ToCGRect())); | 140 NSRect new_rect(NSRectFromCGRect(rect.ToCGRect())); |
138 new_rect.origin.y = | 141 new_rect.origin.y = |
139 [self bounds].size.height - new_rect.origin.y - new_rect.size.height; | 142 [self bounds].size.height - new_rect.origin.y - new_rect.size.height; |
140 return new_rect; | 143 return new_rect; |
141 } | 144 } |
142 | 145 |
| 146 // We use NSView's tag prooperty for ViewID support. Subclasses should not |
| 147 // override it for other purpose. |
| 148 - (NSInteger)tag { |
| 149 return view_id_util::ViewIDToTag(viewID_); |
| 150 } |
| 151 |
143 @end | 152 @end |
OLD | NEW |