| OLD | NEW |
| 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/views/tab_contents/tab_contents_view_win.h" | 5 #include "chrome/browser/views/tab_contents/tab_contents_view_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "app/gfx/canvas_paint.h" | 9 #include "app/gfx/canvas_paint.h" |
| 10 #include "app/os_exchange_data.h" | 10 #include "app/os_exchange_data.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/tab_contents/interstitial_page.h" | 24 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 25 #include "chrome/browser/tab_contents/tab_contents.h" | 25 #include "chrome/browser/tab_contents/tab_contents.h" |
| 26 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 26 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 27 #include "chrome/browser/tab_contents/web_drag_source.h" | 27 #include "chrome/browser/tab_contents/web_drag_source.h" |
| 28 #include "chrome/browser/tab_contents/web_drop_target.h" | 28 #include "chrome/browser/tab_contents/web_drop_target.h" |
| 29 #include "chrome/browser/views/sad_tab_view.h" | 29 #include "chrome/browser/views/sad_tab_view.h" |
| 30 #include "chrome/browser/views/tab_contents/render_view_context_menu_win.h" | 30 #include "chrome/browser/views/tab_contents/render_view_context_menu_win.h" |
| 31 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
| 32 #include "net/base/net_util.h" | 32 #include "net/base/net_util.h" |
| 33 #include "views/focus/view_storage.h" | 33 #include "views/focus/view_storage.h" |
| 34 #include "views/screen.h" |
| 34 #include "views/widget/root_view.h" | 35 #include "views/widget/root_view.h" |
| 35 #include "webkit/glue/webdropdata.h" | 36 #include "webkit/glue/webdropdata.h" |
| 36 | 37 |
| 37 using WebKit::WebDragOperation; | 38 using WebKit::WebDragOperation; |
| 38 using WebKit::WebDragOperationNone; | 39 using WebKit::WebDragOperationNone; |
| 39 using WebKit::WebDragOperationsMask; | 40 using WebKit::WebDragOperationsMask; |
| 40 using WebKit::WebInputEvent; | 41 using WebKit::WebInputEvent; |
| 41 | 42 |
| 42 // static | 43 // static |
| 43 TabContentsView* TabContentsView::Create(TabContents* tab_contents) { | 44 TabContentsView* TabContentsView::Create(TabContents* tab_contents) { |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 468 |
| 468 void TabContentsViewWin::OnHScroll(int scroll_type, short position, | 469 void TabContentsViewWin::OnHScroll(int scroll_type, short position, |
| 469 HWND scrollbar) { | 470 HWND scrollbar) { |
| 470 ScrollCommon(WM_HSCROLL, scroll_type, position, scrollbar); | 471 ScrollCommon(WM_HSCROLL, scroll_type, position, scrollbar); |
| 471 } | 472 } |
| 472 | 473 |
| 473 void TabContentsViewWin::OnMouseLeave() { | 474 void TabContentsViewWin::OnMouseLeave() { |
| 474 // Let our delegate know that the mouse moved (useful for resetting status | 475 // Let our delegate know that the mouse moved (useful for resetting status |
| 475 // bubble state). | 476 // bubble state). |
| 476 if (tab_contents()->delegate()) | 477 if (tab_contents()->delegate()) |
| 477 tab_contents()->delegate()->ContentsMouseEvent(tab_contents(), false); | 478 tab_contents()->delegate()->ContentsMouseEvent( |
| 479 tab_contents(), views::Screen::GetCursorScreenPoint(), false); |
| 478 SetMsgHandled(FALSE); | 480 SetMsgHandled(FALSE); |
| 479 } | 481 } |
| 480 | 482 |
| 481 LRESULT TabContentsViewWin::OnMouseRange(UINT msg, | 483 LRESULT TabContentsViewWin::OnMouseRange(UINT msg, |
| 482 WPARAM w_param, LPARAM l_param) { | 484 WPARAM w_param, LPARAM l_param) { |
| 483 if (tab_contents()->is_crashed() && sad_tab_ != NULL) { | 485 if (tab_contents()->is_crashed() && sad_tab_ != NULL) { |
| 484 return WidgetWin::OnMouseRange(msg, w_param, l_param); | 486 return WidgetWin::OnMouseRange(msg, w_param, l_param); |
| 485 } | 487 } |
| 486 | 488 |
| 487 switch (msg) { | 489 switch (msg) { |
| 488 case WM_LBUTTONDOWN: | 490 case WM_LBUTTONDOWN: |
| 489 case WM_MBUTTONDOWN: | 491 case WM_MBUTTONDOWN: |
| 490 case WM_RBUTTONDOWN: { | 492 case WM_RBUTTONDOWN: { |
| 491 // Make sure this TabContents is activated when it is clicked on. | 493 // Make sure this TabContents is activated when it is clicked on. |
| 492 if (tab_contents()->delegate()) | 494 if (tab_contents()->delegate()) |
| 493 tab_contents()->delegate()->ActivateContents(tab_contents()); | 495 tab_contents()->delegate()->ActivateContents(tab_contents()); |
| 494 break; | 496 break; |
| 495 } | 497 } |
| 496 case WM_MOUSEMOVE: | 498 case WM_MOUSEMOVE: |
| 497 // Let our delegate know that the mouse moved (useful for resetting status | 499 // Let our delegate know that the mouse moved (useful for resetting status |
| 498 // bubble state). | 500 // bubble state). |
| 499 if (tab_contents()->delegate()) { | 501 if (tab_contents()->delegate()) |
| 500 tab_contents()->delegate()->ContentsMouseEvent(tab_contents(), true); | 502 tab_contents()->delegate()->ContentsMouseEvent( |
| 501 } | 503 tab_contents(), views::Screen::GetCursorScreenPoint(), true); |
| 502 break; | 504 break; |
| 503 default: | 505 default: |
| 504 break; | 506 break; |
| 505 } | 507 } |
| 506 | 508 |
| 507 return 0; | 509 return 0; |
| 508 } | 510 } |
| 509 | 511 |
| 510 void TabContentsViewWin::OnPaint(HDC junk_dc) { | 512 void TabContentsViewWin::OnPaint(HDC junk_dc) { |
| 511 if (tab_contents()->render_view_host() && | 513 if (tab_contents()->render_view_host() && |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 } | 672 } |
| 671 return false; | 673 return false; |
| 672 } | 674 } |
| 673 | 675 |
| 674 void TabContentsViewWin::WheelZoom(int distance) { | 676 void TabContentsViewWin::WheelZoom(int distance) { |
| 675 if (tab_contents()->delegate()) { | 677 if (tab_contents()->delegate()) { |
| 676 bool zoom_in = distance > 0; | 678 bool zoom_in = distance > 0; |
| 677 tab_contents()->delegate()->ContentsZoomChange(zoom_in); | 679 tab_contents()->delegate()->ContentsZoomChange(zoom_in); |
| 678 } | 680 } |
| 679 } | 681 } |
| OLD | NEW |