diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-06 00:36:52 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-06 00:36:52 +0000 |
commit | 4c870b4013b3cf658c40e2c7b98e0a419ae7236f (patch) | |
tree | e701a8ab7b093e04367a0956e7ff94a702806e6c /chrome/browser/render_widget_host_view_win.cc | |
parent | 983f7bd3fa88bbdac942dbfaf0269b1684a5c1ee (diff) | |
download | chromium_src-4c870b4013b3cf658c40e2c7b98e0a419ae7236f.zip chromium_src-4c870b4013b3cf658c40e2c7b98e0a419ae7236f.tar.gz chromium_src-4c870b4013b3cf658c40e2c7b98e0a419ae7236f.tar.bz2 |
Eliminate CursorChromium's dependency on webkit/glue.
Also modified WidgetChromium to use ChromiumBridge instead of talking to ChromeClientChromium. I want to eliminate that fake interface in favor of just having our code talk directly to ChromeClientImpl, but that means a dependency on webkit/glue, so I needed to use ChromiumBridge. Long-term, I'd like to propose changes upstream to HostWindow and ChromeClient to avoid this usage of ChromiumBridge.
The most impactful part of this CL is the change to move the enumeration of cursor types from WebCursor to PlatformCursor. This means that WebCursor consumers no longer have access to the type enumeration. I replaced that with helper functions on WebCursor. I think the result not only achieves the goal of breaking CursorChromium's dependency on webkit/glue but is also much cleaner.
R=iyengar,eseidel
Review URL: http://codereview.chromium.org/9072
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4846 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/render_widget_host_view_win.cc')
-rw-r--r-- | chrome/browser/render_widget_host_view_win.cc | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/chrome/browser/render_widget_host_view_win.cc b/chrome/browser/render_widget_host_view_win.cc index ab9275a..3b2e961 100644 --- a/chrome/browser/render_widget_host_view_win.cc +++ b/chrome/browser/render_widget_host_view_win.cc @@ -67,8 +67,8 @@ RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) : render_widget_host_(widget), - real_cursor_(LoadCursor(NULL, IDC_ARROW)), - real_cursor_type_(WebCursor::ARROW), + cursor_(LoadCursor(NULL, IDC_ARROW)), + cursor_is_custom_(false), track_mouse_leave_(false), ime_notification_(false), is_hidden_(false), @@ -85,8 +85,8 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) } RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { - if (real_cursor_type_ == WebCursor::CUSTOM) - DestroyIcon(real_cursor_); + if (cursor_is_custom_) + DestroyIcon(cursor_); ResetTooltip(); } @@ -222,35 +222,33 @@ void RenderWidgetHostViewWin::UpdateCursor(const WebCursor& cursor) { // If the last active cursor was a custom cursor, we need to destroy // it before setting the new one. - if (real_cursor_type_ == WebCursor::CUSTOM) - DestroyIcon(real_cursor_); + if (cursor_is_custom_) + DestroyIcon(cursor_); - real_cursor_type_ = cursor.type(); - if (real_cursor_type_ == cursor.WebCursor::CUSTOM) { - real_cursor_ = cursor.GetCustomCursor(); + cursor_is_custom_ = cursor.IsCustom(); + if (cursor_is_custom_) { + cursor_ = cursor.GetCustomCursor(); } else { // We cannot pass in NULL as the module handle as this would only // work for standard win32 cursors. We can also receive cursor // types which are defined as webkit resources. We need to specify // the module handle of chrome.dll while loading these cursors. - real_cursor_ = cursor.GetCursor(module_handle); + cursor_ = cursor.GetCursor(module_handle); } UpdateCursorIfOverSelf(); } void RenderWidgetHostViewWin::UpdateCursorIfOverSelf() { - static HINSTANCE module_handle = - GetModuleHandle(chrome::kBrowserResourcesDll); + static HCURSOR kCursorArrow = LoadCursor(NULL, IDC_ARROW); + static HCURSOR kCursorAppStarting = LoadCursor(NULL, IDC_APPSTARTING); - HCURSOR display_cursor = real_cursor_; + HCURSOR display_cursor = cursor_; // If a page is in the loading state, we want to show the Arrow+Hourglass // cursor only when the current cursor is the ARROW cursor. In all other // cases we should continue to display the current cursor. - if (is_loading_ && (real_cursor_type_ == WebCursor::ARROW)) { - WebCursor page_loading_cursor(WebCursor::APPSTARTING); - display_cursor = page_loading_cursor.GetCursor(module_handle); - } + if (is_loading_ && display_cursor == kCursorArrow) + display_cursor = kCursorAppStarting; // If the mouse is over our HWND, then update the cursor state immediately. CPoint pt; |