Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: chrome/browser/cocoa/base_view.mm

Issue 2973004: [Mac]Implement ViewID support. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Turns out that, it's not a good solution. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/cocoa/base_view.h ('k') | chrome/browser/cocoa/base_view_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/base_view.h ('k') | chrome/browser/cocoa/base_view_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698