| 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/web_contents/web_contents_view_win.h" | 5 #include "content/browser/web_contents/web_contents_view_win.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "content/browser/renderer_host/render_view_host_factory.h" | 9 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) { | 54 BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) { |
| 55 HwndToWcvMap::iterator it = hwnd_to_wcv_map.find(hwnd); | 55 HwndToWcvMap::iterator it = hwnd_to_wcv_map.find(hwnd); |
| 56 if (it == hwnd_to_wcv_map.end()) | 56 if (it == hwnd_to_wcv_map.end()) |
| 57 return TRUE; // must return TRUE to continue enumeration. | 57 return TRUE; // must return TRUE to continue enumeration. |
| 58 WebContentsViewWin* wcv = it->second; | 58 WebContentsViewWin* wcv = it->second; |
| 59 RenderWidgetHostViewWin* rwhv = static_cast<RenderWidgetHostViewWin*>( | 59 RenderWidgetHostViewWin* rwhv = static_cast<RenderWidgetHostViewWin*>( |
| 60 wcv->web_contents()->GetRenderWidgetHostView()); | 60 wcv->web_contents()->GetRenderWidgetHostView()); |
| 61 if (rwhv) | 61 if (rwhv) |
| 62 rwhv->UpdateScreenInfo(); | 62 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); |
| 63 | 63 |
| 64 return TRUE; // must return TRUE to continue enumeration. | 64 return TRUE; // must return TRUE to continue enumeration. |
| 65 } | 65 } |
| 66 | 66 |
| 67 class PositionChangedMessageFilter : public ui::HWNDMessageFilter { | 67 class PositionChangedMessageFilter : public ui::HWNDMessageFilter { |
| 68 public: | 68 public: |
| 69 PositionChangedMessageFilter() {} | 69 PositionChangedMessageFilter() {} |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 // Overridden from ui::HWNDMessageFilter: | 72 // Overridden from ui::HWNDMessageFilter: |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 339 } |
| 340 | 340 |
| 341 // The WebContents was shown by a means other than the user selecting a | 341 // The WebContents was shown by a means other than the user selecting a |
| 342 // Tab, e.g. the window was minimized then restored. | 342 // Tab, e.g. the window was minimized then restored. |
| 343 if (window_pos->flags & SWP_SHOWWINDOW) | 343 if (window_pos->flags & SWP_SHOWWINDOW) |
| 344 web_contents_->WasShown(); | 344 web_contents_->WasShown(); |
| 345 | 345 |
| 346 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); | 346 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
| 347 if (rwhv) { | 347 if (rwhv) { |
| 348 RenderWidgetHostViewWin* view = static_cast<RenderWidgetHostViewWin*>(rwhv); | 348 RenderWidgetHostViewWin* view = static_cast<RenderWidgetHostViewWin*>(rwhv); |
| 349 view->UpdateScreenInfo(); | 349 view->UpdateScreenInfo(view->GetNativeView()); |
| 350 } | 350 } |
| 351 | 351 |
| 352 // Unless we were specifically told not to size, cause the renderer to be | 352 // Unless we were specifically told not to size, cause the renderer to be |
| 353 // sized to the new bounds, which forces a repaint. Not required for the | 353 // sized to the new bounds, which forces a repaint. Not required for the |
| 354 // simple minimize-restore case described above, for example, since the | 354 // simple minimize-restore case described above, for example, since the |
| 355 // size hasn't changed. | 355 // size hasn't changed. |
| 356 if (window_pos->flags & SWP_NOSIZE) | 356 if (window_pos->flags & SWP_NOSIZE) |
| 357 return 0; | 357 return 0; |
| 358 | 358 |
| 359 gfx::Size size(window_pos->cx, window_pos->cy); | 359 gfx::Size size(window_pos->cx, window_pos->cy); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 375 web_contents_->GetDelegate()->ActivateContents(web_contents_); | 375 web_contents_->GetDelegate()->ActivateContents(web_contents_); |
| 376 return 0; | 376 return 0; |
| 377 } | 377 } |
| 378 | 378 |
| 379 LRESULT WebContentsViewWin::OnMouseMove( | 379 LRESULT WebContentsViewWin::OnMouseMove( |
| 380 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { | 380 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { |
| 381 // Let our delegate know that the mouse moved (useful for resetting status | 381 // Let our delegate know that the mouse moved (useful for resetting status |
| 382 // bubble state). | 382 // bubble state). |
| 383 if (web_contents_->GetDelegate()) { | 383 if (web_contents_->GetDelegate()) { |
| 384 web_contents_->GetDelegate()->ContentsMouseEvent( | 384 web_contents_->GetDelegate()->ContentsMouseEvent( |
| 385 web_contents_, gfx::Screen::GetCursorScreenPoint(), true); | 385 web_contents_, |
| 386 gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(), |
| 387 true); |
| 386 } | 388 } |
| 387 return 0; | 389 return 0; |
| 388 } | 390 } |
| 389 | 391 |
| 390 LRESULT WebContentsViewWin::OnReflectedMessage( | 392 LRESULT WebContentsViewWin::OnReflectedMessage( |
| 391 UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled) { | 393 UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled) { |
| 392 MSG* message = reinterpret_cast<MSG*>(lparam); | 394 MSG* message = reinterpret_cast<MSG*>(lparam); |
| 393 switch (message->message) { | 395 switch (message->message) { |
| 394 case WM_MOUSEWHEEL: | 396 case WM_MOUSEWHEEL: |
| 395 // This message is reflected from the view() to this window. | 397 // This message is reflected from the view() to this window. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 si.nMin = 1; | 476 si.nMin = 1; |
| 475 si.nMax = 100; | 477 si.nMax = 100; |
| 476 si.nPage = 10; | 478 si.nPage = 10; |
| 477 si.nPos = 50; | 479 si.nPos = 50; |
| 478 | 480 |
| 479 ::SetScrollInfo(hwnd(), SB_HORZ, &si, FALSE); | 481 ::SetScrollInfo(hwnd(), SB_HORZ, &si, FALSE); |
| 480 ::SetScrollInfo(hwnd(), SB_VERT, &si, FALSE); | 482 ::SetScrollInfo(hwnd(), SB_VERT, &si, FALSE); |
| 481 | 483 |
| 482 return 1; | 484 return 1; |
| 483 } | 485 } |
| OLD | NEW |