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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 21227: Turn on Mac cursor support now that we're already linking in the world. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/renderer_host/render_widget_host_view_mac.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #include "base/histogram.h" 7 #include "base/histogram.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/browser_trial.h" 9 #include "chrome/browser/browser_trial.h"
10 #include "chrome/browser/renderer_host/backing_store.h" 10 #include "chrome/browser/renderer_host/backing_store.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 [cocoa_view_ setHidden:YES]; 117 [cocoa_view_ setHidden:YES];
118 118
119 WasHidden(); 119 WasHidden();
120 } 120 }
121 121
122 gfx::Rect RenderWidgetHostViewMac::GetViewBounds() const { 122 gfx::Rect RenderWidgetHostViewMac::GetViewBounds() const {
123 return gfx::Rect(NSRectToCGRect([cocoa_view_ frame])); 123 return gfx::Rect(NSRectToCGRect([cocoa_view_ frame]));
124 } 124 }
125 125
126 void RenderWidgetHostViewMac::UpdateCursor(const WebCursor& cursor) { 126 void RenderWidgetHostViewMac::UpdateCursor(const WebCursor& cursor) {
127 // current_cursor_ = cursor; // temporarily commented for link issues 127 current_cursor_ = cursor;
128 UpdateCursorIfOverSelf(); 128 UpdateCursorIfOverSelf();
129 } 129 }
130 130
131 void RenderWidgetHostViewMac::UpdateCursorIfOverSelf() { 131 void RenderWidgetHostViewMac::UpdateCursorIfOverSelf() {
132 // Do something special (as Windows does) for arrow cursor while loading a 132 // Do something special (as Win Chromium does) for arrow cursor while loading
133 // page? TODO(avi): decide 133 // a page? TODO(avi): decide
134 // TODO(avi): check to see if mouse pointer is within our bounds 134 // Can we synchronize to the event stream? Switch to -[NSWindow
135 // Disabled so we don't have to link in glue... yet 135 // mouseLocationOutsideOfEventStream] if we cannot. TODO(avi): test and see
136 // NSCursor* ns_cursor = current_cursor_.GetCursor(); 136 NSEvent* event = [[cocoa_view_ window] currentEvent];
137 // [ns_cursor set]; 137 if ([event window] != [cocoa_view_ window])
138 return;
139
140 NSPoint event_location = [event locationInWindow];
141 NSPoint local_point = [cocoa_view_ convertPoint:event_location fromView:nil];
142
143 if (!NSPointInRect(local_point, [cocoa_view_ bounds]))
144 return;
145
146 NSCursor* ns_cursor = current_cursor_.GetCursor();
147 [ns_cursor set];
138 } 148 }
139 149
140 void RenderWidgetHostViewMac::SetIsLoading(bool is_loading) { 150 void RenderWidgetHostViewMac::SetIsLoading(bool is_loading) {
141 is_loading_ = is_loading; 151 is_loading_ = is_loading;
142 UpdateCursorIfOverSelf(); 152 UpdateCursorIfOverSelf();
143 } 153 }
144 154
145 void RenderWidgetHostViewMac::IMEUpdateStatus(int control, 155 void RenderWidgetHostViewMac::IMEUpdateStatus(int control,
146 const gfx::Rect& caret_rect) { 156 const gfx::Rect& caret_rect) {
147 NOTIMPLEMENTED(); 157 NOTIMPLEMENTED();
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 return YES; 320 return YES;
311 } 321 }
312 322
313 - (BOOL)resignFirstResponder { 323 - (BOOL)resignFirstResponder {
314 renderWidgetHostView_->render_widget_host()->Blur(); 324 renderWidgetHostView_->render_widget_host()->Blur();
315 325
316 return YES; 326 return YES;
317 } 327 }
318 328
319 @end 329 @end
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698