| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <peninputpanel_i.c> | 9 #include <peninputpanel_i.c> |
| 10 #include <stack> | 10 #include <stack> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include "webkit/glue/webcursor.h" | 64 #include "webkit/glue/webcursor.h" |
| 65 #include "webkit/plugins/npapi/plugin_constants_win.h" | 65 #include "webkit/plugins/npapi/plugin_constants_win.h" |
| 66 #include "webkit/plugins/npapi/webplugin.h" | 66 #include "webkit/plugins/npapi/webplugin.h" |
| 67 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 67 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
| 68 | 68 |
| 69 // From MSDN. | 69 // From MSDN. |
| 70 #define MOUSEEVENTF_FROMTOUCH 0xFF515700 | 70 #define MOUSEEVENTF_FROMTOUCH 0xFF515700 |
| 71 | 71 |
| 72 using base::TimeDelta; | 72 using base::TimeDelta; |
| 73 using base::TimeTicks; | 73 using base::TimeTicks; |
| 74 using content::BrowserThread; | |
| 75 using content::NativeWebKeyboardEvent; | |
| 76 using content::RenderWidgetHost; | |
| 77 using content::RenderWidgetHostImpl; | |
| 78 using content::RenderWidgetHostView; | |
| 79 using ui::ViewProp; | 74 using ui::ViewProp; |
| 80 using WebKit::WebInputEvent; | 75 using WebKit::WebInputEvent; |
| 81 using WebKit::WebInputEventFactory; | 76 using WebKit::WebInputEventFactory; |
| 82 using WebKit::WebMouseEvent; | 77 using WebKit::WebMouseEvent; |
| 83 using WebKit::WebTextDirection; | 78 using WebKit::WebTextDirection; |
| 84 using webkit::npapi::WebPluginGeometry; | 79 using webkit::npapi::WebPluginGeometry; |
| 85 | 80 |
| 86 const wchar_t kRenderWidgetHostHWNDClass[] = L"Chrome_RenderWidgetHostHWND"; | 81 namespace content { |
| 82 namespace { |
| 87 | 83 |
| 88 namespace { | |
| 89 // Tooltips will wrap after this width. Yes, wrap. Imagine that! | 84 // Tooltips will wrap after this width. Yes, wrap. Imagine that! |
| 90 const int kTooltipMaxWidthPixels = 300; | 85 const int kTooltipMaxWidthPixels = 300; |
| 91 | 86 |
| 92 // Maximum number of characters we allow in a tooltip. | 87 // Maximum number of characters we allow in a tooltip. |
| 93 const int kMaxTooltipLength = 1024; | 88 const int kMaxTooltipLength = 1024; |
| 94 | 89 |
| 95 // A custom MSAA object id used to determine if a screen reader is actively | 90 // A custom MSAA object id used to determine if a screen reader is actively |
| 96 // listening for MSAA events. | 91 // listening for MSAA events. |
| 97 const int kIdCustom = 1; | 92 const int kIdCustom = 1; |
| 98 | 93 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 201 |
| 207 gpu_process_host->Send(message.release()); | 202 gpu_process_host->Send(message.release()); |
| 208 } | 203 } |
| 209 | 204 |
| 210 void PostTaskOnIOThread(const tracked_objects::Location& from_here, | 205 void PostTaskOnIOThread(const tracked_objects::Location& from_here, |
| 211 base::Closure task) { | 206 base::Closure task) { |
| 212 BrowserThread::PostTask(BrowserThread::IO, from_here, task); | 207 BrowserThread::PostTask(BrowserThread::IO, from_here, task); |
| 213 } | 208 } |
| 214 | 209 |
| 215 bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi, | 210 bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi, |
| 216 content::PageZoom* zoom, | 211 PageZoom* zoom, POINT* zoom_center) { |
| 217 POINT* zoom_center) { | |
| 218 static long start = 0; | 212 static long start = 0; |
| 219 static POINT zoom_first; | 213 static POINT zoom_first; |
| 220 | 214 |
| 221 if (gi.dwFlags == GF_BEGIN) { | 215 if (gi.dwFlags == GF_BEGIN) { |
| 222 start = gi.ullArguments; | 216 start = gi.ullArguments; |
| 223 zoom_first.x = gi.ptsLocation.x; | 217 zoom_first.x = gi.ptsLocation.x; |
| 224 zoom_first.y = gi.ptsLocation.y; | 218 zoom_first.y = gi.ptsLocation.y; |
| 225 ScreenToClient(hwnd, &zoom_first); | 219 ScreenToClient(hwnd, &zoom_first); |
| 226 return false; | 220 return false; |
| 227 } | 221 } |
| 228 | 222 |
| 229 if (gi.dwFlags == GF_END) | 223 if (gi.dwFlags == GF_END) |
| 230 return false; | 224 return false; |
| 231 | 225 |
| 232 POINT zoom_second = {0}; | 226 POINT zoom_second = {0}; |
| 233 zoom_second.x = gi.ptsLocation.x; | 227 zoom_second.x = gi.ptsLocation.x; |
| 234 zoom_second.y = gi.ptsLocation.y; | 228 zoom_second.y = gi.ptsLocation.y; |
| 235 ScreenToClient(hwnd, &zoom_second); | 229 ScreenToClient(hwnd, &zoom_second); |
| 236 | 230 |
| 237 if (zoom_first.x == zoom_second.x && zoom_first.y == zoom_second.y) | 231 if (zoom_first.x == zoom_second.x && zoom_first.y == zoom_second.y) |
| 238 return false; | 232 return false; |
| 239 | 233 |
| 240 zoom_center->x = (zoom_first.x + zoom_second.x) / 2; | 234 zoom_center->x = (zoom_first.x + zoom_second.x) / 2; |
| 241 zoom_center->y = (zoom_first.y + zoom_second.y) / 2; | 235 zoom_center->y = (zoom_first.y + zoom_second.y) / 2; |
| 242 | 236 |
| 243 double zoom_factor = | 237 double zoom_factor = |
| 244 static_cast<double>(gi.ullArguments)/static_cast<double>(start); | 238 static_cast<double>(gi.ullArguments)/static_cast<double>(start); |
| 245 | 239 |
| 246 *zoom = zoom_factor >= 1 ? content::PAGE_ZOOM_IN : | 240 *zoom = zoom_factor >= 1 ? PAGE_ZOOM_IN : PAGE_ZOOM_OUT; |
| 247 content::PAGE_ZOOM_OUT; | |
| 248 | 241 |
| 249 start = gi.ullArguments; | 242 start = gi.ullArguments; |
| 250 zoom_first = zoom_second; | 243 zoom_first = zoom_second; |
| 251 return true; | 244 return true; |
| 252 } | 245 } |
| 253 | 246 |
| 254 bool DecodeScrollGesture(const GESTUREINFO& gi, | 247 bool DecodeScrollGesture(const GESTUREINFO& gi, |
| 255 POINT* start, | 248 POINT* start, |
| 256 POINT* delta){ | 249 POINT* delta){ |
| 257 // Windows gestures are streams of messages with begin/end messages that | 250 // Windows gestures are streams of messages with begin/end messages that |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 } | 504 } |
| 512 | 505 |
| 513 private: | 506 private: |
| 514 size_t index_; | 507 size_t index_; |
| 515 | 508 |
| 516 DISALLOW_COPY_AND_ASSIGN(LocalTouchEvent); | 509 DISALLOW_COPY_AND_ASSIGN(LocalTouchEvent); |
| 517 }; | 510 }; |
| 518 | 511 |
| 519 } // namespace | 512 } // namespace |
| 520 | 513 |
| 514 const wchar_t kRenderWidgetHostHWNDClass[] = L"Chrome_RenderWidgetHostHWND"; |
| 515 |
| 521 // Wrapper for maintaining touchstate associated with a WebTouchEvent. | 516 // Wrapper for maintaining touchstate associated with a WebTouchEvent. |
| 522 class WebTouchState { | 517 class WebTouchState { |
| 523 public: | 518 public: |
| 524 explicit WebTouchState(const RenderWidgetHostViewWin* window); | 519 explicit WebTouchState(const RenderWidgetHostViewWin* window); |
| 525 | 520 |
| 526 // Updates the current touchpoint state with the supplied touches. | 521 // Updates the current touchpoint state with the supplied touches. |
| 527 // Touches will be consumed only if they are of the same type (e.g. down, | 522 // Touches will be consumed only if they are of the same type (e.g. down, |
| 528 // up, move). Returns the number of consumed touches. | 523 // up, move). Returns the number of consumed touches. |
| 529 size_t UpdateTouchPoints(TOUCHINPUT* points, size_t count); | 524 size_t UpdateTouchPoints(TOUCHINPUT* points, size_t count); |
| 530 | 525 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 ALLOW_THIS_IN_INITIALIZER_LIST( | 606 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 612 touch_state_(new WebTouchState(this))), | 607 touch_state_(new WebTouchState(this))), |
| 613 pointer_down_context_(false), | 608 pointer_down_context_(false), |
| 614 focus_on_editable_field_(false), | 609 focus_on_editable_field_(false), |
| 615 received_focus_change_after_pointer_down_(false), | 610 received_focus_change_after_pointer_down_(false), |
| 616 touch_events_enabled_(false), | 611 touch_events_enabled_(false), |
| 617 ALLOW_THIS_IN_INITIALIZER_LIST( | 612 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 618 gesture_recognizer_(ui::GestureRecognizer::Create(this))) { | 613 gesture_recognizer_(ui::GestureRecognizer::Create(this))) { |
| 619 render_widget_host_->SetView(this); | 614 render_widget_host_->SetView(this); |
| 620 registrar_.Add(this, | 615 registrar_.Add(this, |
| 621 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 616 NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 622 content::NotificationService::AllBrowserContextsAndSources()); | 617 NotificationService::AllBrowserContextsAndSources()); |
| 623 registrar_.Add(this, | 618 registrar_.Add(this, |
| 624 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 619 NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
| 625 content::NotificationService::AllBrowserContextsAndSources()); | 620 NotificationService::AllBrowserContextsAndSources()); |
| 626 } | 621 } |
| 627 | 622 |
| 628 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { | 623 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { |
| 629 UnlockMouse(); | 624 UnlockMouse(); |
| 630 ResetTooltip(); | 625 ResetTooltip(); |
| 631 } | 626 } |
| 632 | 627 |
| 633 void RenderWidgetHostViewWin::CreateWnd(HWND parent) { | 628 void RenderWidgetHostViewWin::CreateWnd(HWND parent) { |
| 634 // ATL function to create the window. | 629 // ATL function to create the window. |
| 635 Create(parent); | 630 Create(parent); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 gfx::NativeViewAccessible | 739 gfx::NativeViewAccessible |
| 745 RenderWidgetHostViewWin::GetNativeViewAccessible() { | 740 RenderWidgetHostViewWin::GetNativeViewAccessible() { |
| 746 if (render_widget_host_ && | 741 if (render_widget_host_ && |
| 747 !BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser()) { | 742 !BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser()) { |
| 748 // Attempt to detect screen readers by sending an event with our custom id. | 743 // Attempt to detect screen readers by sending an event with our custom id. |
| 749 NotifyWinEvent(EVENT_SYSTEM_ALERT, m_hWnd, kIdCustom, CHILDID_SELF); | 744 NotifyWinEvent(EVENT_SYSTEM_ALERT, m_hWnd, kIdCustom, CHILDID_SELF); |
| 750 } | 745 } |
| 751 | 746 |
| 752 if (!GetBrowserAccessibilityManager()) { | 747 if (!GetBrowserAccessibilityManager()) { |
| 753 // Return busy document tree while renderer accessibility tree loads. | 748 // Return busy document tree while renderer accessibility tree loads. |
| 754 content::AccessibilityNodeData::State busy_state = | 749 AccessibilityNodeData::State busy_state = |
| 755 static_cast<content::AccessibilityNodeData::State>( | 750 static_cast<AccessibilityNodeData::State>( |
| 756 1 << content::AccessibilityNodeData::STATE_BUSY); | 751 1 << AccessibilityNodeData::STATE_BUSY); |
| 757 SetBrowserAccessibilityManager( | 752 SetBrowserAccessibilityManager( |
| 758 BrowserAccessibilityManager::CreateEmptyDocument( | 753 BrowserAccessibilityManager::CreateEmptyDocument( |
| 759 m_hWnd, busy_state, this)); | 754 m_hWnd, busy_state, this)); |
| 760 } | 755 } |
| 761 | 756 |
| 762 return GetBrowserAccessibilityManager()->GetRoot()-> | 757 return GetBrowserAccessibilityManager()->GetRoot()-> |
| 763 ToBrowserAccessibilityWin(); | 758 ToBrowserAccessibilityWin(); |
| 764 } | 759 } |
| 765 | 760 |
| 766 void RenderWidgetHostViewWin::MovePluginWindows( | 761 void RenderWidgetHostViewWin::MovePluginWindows( |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 | 977 |
| 983 void RenderWidgetHostViewWin::UpdateCursor(const WebCursor& cursor) { | 978 void RenderWidgetHostViewWin::UpdateCursor(const WebCursor& cursor) { |
| 984 current_cursor_ = cursor; | 979 current_cursor_ = cursor; |
| 985 UpdateCursorIfOverSelf(); | 980 UpdateCursorIfOverSelf(); |
| 986 } | 981 } |
| 987 | 982 |
| 988 void RenderWidgetHostViewWin::UpdateCursorIfOverSelf() { | 983 void RenderWidgetHostViewWin::UpdateCursorIfOverSelf() { |
| 989 static HCURSOR kCursorArrow = LoadCursor(NULL, IDC_ARROW); | 984 static HCURSOR kCursorArrow = LoadCursor(NULL, IDC_ARROW); |
| 990 static HCURSOR kCursorAppStarting = LoadCursor(NULL, IDC_APPSTARTING); | 985 static HCURSOR kCursorAppStarting = LoadCursor(NULL, IDC_APPSTARTING); |
| 991 static HINSTANCE module_handle = GetModuleHandle( | 986 static HINSTANCE module_handle = GetModuleHandle( |
| 992 content::GetContentClient()->browser()->GetResourceDllName()); | 987 GetContentClient()->browser()->GetResourceDllName()); |
| 993 | 988 |
| 994 // If the mouse is over our HWND, then update the cursor state immediately. | 989 // If the mouse is over our HWND, then update the cursor state immediately. |
| 995 CPoint pt; | 990 CPoint pt; |
| 996 GetCursorPos(&pt); | 991 GetCursorPos(&pt); |
| 997 if (WindowFromPoint(pt) == m_hWnd) { | 992 if (WindowFromPoint(pt) == m_hWnd) { |
| 998 // We cannot pass in NULL as the module handle as this would only work for | 993 // We cannot pass in NULL as the module handle as this would only work for |
| 999 // standard win32 cursors. We can also receive cursor types which are | 994 // standard win32 cursors. We can also receive cursor types which are |
| 1000 // defined as webkit resources. We need to specify the module handle of | 995 // defined as webkit resources. We need to specify the module handle of |
| 1001 // chrome.dll while loading these cursors. | 996 // chrome.dll while loading these cursors. |
| 1002 HCURSOR display_cursor = current_cursor_.GetCursor(module_handle); | 997 HCURSOR display_cursor = current_cursor_.GetCursor(module_handle); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 if (!output->initialize(size.width(), size.height(), true)) | 1192 if (!output->initialize(size.width(), size.height(), true)) |
| 1198 return; | 1193 return; |
| 1199 | 1194 |
| 1200 const bool result = accelerated_surface_->CopyTo( | 1195 const bool result = accelerated_surface_->CopyTo( |
| 1201 size, output->getTopDevice()->accessBitmap(true).getPixels()); | 1196 size, output->getTopDevice()->accessBitmap(true).getPixels()); |
| 1202 scoped_callback_runner.Release(); | 1197 scoped_callback_runner.Release(); |
| 1203 callback.Run(result); | 1198 callback.Run(result); |
| 1204 } | 1199 } |
| 1205 | 1200 |
| 1206 void RenderWidgetHostViewWin::SetBackground(const SkBitmap& background) { | 1201 void RenderWidgetHostViewWin::SetBackground(const SkBitmap& background) { |
| 1207 content::RenderWidgetHostViewBase::SetBackground(background); | 1202 RenderWidgetHostViewBase::SetBackground(background); |
| 1208 render_widget_host_->SetBackground(background); | 1203 render_widget_host_->SetBackground(background); |
| 1209 } | 1204 } |
| 1210 | 1205 |
| 1211 void RenderWidgetHostViewWin::ProcessTouchAck( | 1206 void RenderWidgetHostViewWin::ProcessTouchAck( |
| 1212 WebKit::WebInputEvent::Type type, bool processed) { | 1207 WebKit::WebInputEvent::Type type, bool processed) { |
| 1213 | 1208 |
| 1214 DCHECK(render_widget_host_->has_touch_handler() && | 1209 DCHECK(render_widget_host_->has_touch_handler() && |
| 1215 touch_events_enabled_); | 1210 touch_events_enabled_); |
| 1216 | 1211 |
| 1217 int touch_count = touch_state_->GetNextTouchCount(); | 1212 int touch_count = touch_state_->GetNextTouchCount(); |
| (...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2375 | 2370 |
| 2376 GESTUREINFO gi = {sizeof(GESTUREINFO)}; | 2371 GESTUREINFO gi = {sizeof(GESTUREINFO)}; |
| 2377 HGESTUREINFO gi_handle = reinterpret_cast<HGESTUREINFO>(lparam); | 2372 HGESTUREINFO gi_handle = reinterpret_cast<HGESTUREINFO>(lparam); |
| 2378 if (!::GetGestureInfo(gi_handle, &gi)) { | 2373 if (!::GetGestureInfo(gi_handle, &gi)) { |
| 2379 DWORD error = GetLastError(); | 2374 DWORD error = GetLastError(); |
| 2380 NOTREACHED() << "Unable to get gesture info. Error : " << error; | 2375 NOTREACHED() << "Unable to get gesture info. Error : " << error; |
| 2381 return 0; | 2376 return 0; |
| 2382 } | 2377 } |
| 2383 | 2378 |
| 2384 if (gi.dwID == GID_ZOOM) { | 2379 if (gi.dwID == GID_ZOOM) { |
| 2385 content::PageZoom zoom = content::PAGE_ZOOM_RESET; | 2380 PageZoom zoom = PAGE_ZOOM_RESET; |
| 2386 POINT zoom_center = {0}; | 2381 POINT zoom_center = {0}; |
| 2387 if (DecodeZoomGesture(m_hWnd, gi, &zoom, &zoom_center)) { | 2382 if (DecodeZoomGesture(m_hWnd, gi, &zoom, &zoom_center)) { |
| 2388 handled = TRUE; | 2383 handled = TRUE; |
| 2389 Send(new ViewMsg_ZoomFactor(render_widget_host_->GetRoutingID(), | 2384 Send(new ViewMsg_ZoomFactor(render_widget_host_->GetRoutingID(), |
| 2390 zoom, zoom_center.x, zoom_center.y)); | 2385 zoom, zoom_center.x, zoom_center.y)); |
| 2391 } | 2386 } |
| 2392 } else if (gi.dwID == GID_PAN) { | 2387 } else if (gi.dwID == GID_PAN) { |
| 2393 // Right now we only decode scroll gestures and we forward to the page | 2388 // Right now we only decode scroll gestures and we forward to the page |
| 2394 // as scroll events. | 2389 // as scroll events. |
| 2395 POINT start; | 2390 POINT start; |
| 2396 POINT delta; | 2391 POINT delta; |
| 2397 if (DecodeScrollGesture(gi, &start, &delta)) { | 2392 if (DecodeScrollGesture(gi, &start, &delta)) { |
| 2398 handled = TRUE; | 2393 handled = TRUE; |
| 2399 render_widget_host_->ForwardWheelEvent( | 2394 render_widget_host_->ForwardWheelEvent( |
| 2400 MakeFakeScrollWheelEvent(m_hWnd, start, delta)); | 2395 MakeFakeScrollWheelEvent(m_hWnd, start, delta)); |
| 2401 } | 2396 } |
| 2402 } | 2397 } |
| 2403 ::CloseGestureInfoHandle(gi_handle); | 2398 ::CloseGestureInfoHandle(gi_handle); |
| 2404 return 0; | 2399 return 0; |
| 2405 } | 2400 } |
| 2406 | 2401 |
| 2407 void RenderWidgetHostViewWin::OnAccessibilityNotifications( | 2402 void RenderWidgetHostViewWin::OnAccessibilityNotifications( |
| 2408 const std::vector<AccessibilityHostMsg_NotificationParams>& params) { | 2403 const std::vector<AccessibilityHostMsg_NotificationParams>& params) { |
| 2409 if (!GetBrowserAccessibilityManager()) { | 2404 if (!GetBrowserAccessibilityManager()) { |
| 2410 SetBrowserAccessibilityManager( | 2405 SetBrowserAccessibilityManager( |
| 2411 BrowserAccessibilityManager::CreateEmptyDocument( | 2406 BrowserAccessibilityManager::CreateEmptyDocument( |
| 2412 m_hWnd, | 2407 m_hWnd, |
| 2413 static_cast<content::AccessibilityNodeData::State>(0), | 2408 static_cast<AccessibilityNodeData::State>(0), |
| 2414 this)); | 2409 this)); |
| 2415 } | 2410 } |
| 2416 GetBrowserAccessibilityManager()->OnAccessibilityNotifications(params); | 2411 GetBrowserAccessibilityManager()->OnAccessibilityNotifications(params); |
| 2417 } | 2412 } |
| 2418 | 2413 |
| 2419 bool RenderWidgetHostViewWin::LockMouse() { | 2414 bool RenderWidgetHostViewWin::LockMouse() { |
| 2420 if (mouse_locked_) | 2415 if (mouse_locked_) |
| 2421 return true; | 2416 return true; |
| 2422 | 2417 |
| 2423 mouse_locked_ = true; | 2418 mouse_locked_ = true; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2458 ::SetCursorPos(last_mouse_position_.unlocked_global.x(), | 2453 ::SetCursorPos(last_mouse_position_.unlocked_global.x(), |
| 2459 last_mouse_position_.unlocked_global.y()); | 2454 last_mouse_position_.unlocked_global.y()); |
| 2460 ::ShowCursor(TRUE); | 2455 ::ShowCursor(TRUE); |
| 2461 | 2456 |
| 2462 if (render_widget_host_) | 2457 if (render_widget_host_) |
| 2463 render_widget_host_->LostMouseLock(); | 2458 render_widget_host_->LostMouseLock(); |
| 2464 } | 2459 } |
| 2465 | 2460 |
| 2466 void RenderWidgetHostViewWin::Observe( | 2461 void RenderWidgetHostViewWin::Observe( |
| 2467 int type, | 2462 int type, |
| 2468 const content::NotificationSource& source, | 2463 const NotificationSource& source, |
| 2469 const content::NotificationDetails& details) { | 2464 const NotificationDetails& details) { |
| 2470 DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED || | 2465 DCHECK(type == NOTIFICATION_RENDERER_PROCESS_TERMINATED || |
| 2471 type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE); | 2466 type == NOTIFICATION_FOCUS_CHANGED_IN_PAGE); |
| 2472 | 2467 |
| 2473 if (type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE) { | 2468 if (type == NOTIFICATION_FOCUS_CHANGED_IN_PAGE) { |
| 2474 if (pointer_down_context_) | 2469 if (pointer_down_context_) |
| 2475 received_focus_change_after_pointer_down_ = true; | 2470 received_focus_change_after_pointer_down_ = true; |
| 2476 focus_on_editable_field_ = *content::Details<bool>(details).ptr(); | 2471 focus_on_editable_field_ = *Details<bool>(details).ptr(); |
| 2477 if (virtual_keyboard_) | 2472 if (virtual_keyboard_) |
| 2478 DisplayOnScreenKeyboardIfNeeded(); | 2473 DisplayOnScreenKeyboardIfNeeded(); |
| 2479 } else { | 2474 } else { |
| 2480 // Get the RenderProcessHost that posted this notification, and exit | 2475 // Get the RenderProcessHost that posted this notification, and exit |
| 2481 // if it's not the one associated with this host view. | 2476 // if it's not the one associated with this host view. |
| 2482 content::RenderProcessHost* render_process_host = | 2477 RenderProcessHost* render_process_host = |
| 2483 content::Source<content::RenderProcessHost>(source).ptr(); | 2478 Source<RenderProcessHost>(source).ptr(); |
| 2484 DCHECK(render_process_host); | 2479 DCHECK(render_process_host); |
| 2485 if (!render_widget_host_ || | 2480 if (!render_widget_host_ || |
| 2486 render_process_host != render_widget_host_->GetProcess()) | 2481 render_process_host != render_widget_host_->GetProcess()) |
| 2487 return; | 2482 return; |
| 2488 | 2483 |
| 2489 // If it was our RenderProcessHost that posted the notification, | 2484 // If it was our RenderProcessHost that posted the notification, |
| 2490 // clear the BrowserAccessibilityManager, because the renderer is | 2485 // clear the BrowserAccessibilityManager, because the renderer is |
| 2491 // dead and any accessibility information we have is now stale. | 2486 // dead and any accessibility information we have is now stale. |
| 2492 SetBrowserAccessibilityManager(NULL); | 2487 SetBrowserAccessibilityManager(NULL); |
| 2493 } | 2488 } |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3150 void RenderWidgetHostViewWin::ResetPointerDownContext() { | 3145 void RenderWidgetHostViewWin::ResetPointerDownContext() { |
| 3151 // If the default focus on the page is on an edit field and we did not | 3146 // If the default focus on the page is on an edit field and we did not |
| 3152 // receive a focus change in the context of a pointer down message, it means | 3147 // receive a focus change in the context of a pointer down message, it means |
| 3153 // that the pointer down message occurred on the edit field and we should | 3148 // that the pointer down message occurred on the edit field and we should |
| 3154 // display the on screen keyboard | 3149 // display the on screen keyboard |
| 3155 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 3150 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
| 3156 DisplayOnScreenKeyboardIfNeeded(); | 3151 DisplayOnScreenKeyboardIfNeeded(); |
| 3157 received_focus_change_after_pointer_down_ = false; | 3152 received_focus_change_after_pointer_down_ = false; |
| 3158 pointer_down_context_ = false; | 3153 pointer_down_context_ = false; |
| 3159 } | 3154 } |
| 3155 |
| 3156 } // namespace content |
| OLD | NEW |