| 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/tab_contents/tab_contents_view_win.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #include "app/os_exchange_data.h" | 10 #include "app/os_exchange_data.h" |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 // Any unhandled keyboard/character messages should be defproced. | 387 // Any unhandled keyboard/character messages should be defproced. |
| 388 // This allows stuff like Alt+F4, etc to work correctly. | 388 // This allows stuff like Alt+F4, etc to work correctly. |
| 389 DefWindowProc(event.os_event.hwnd, | 389 DefWindowProc(event.os_event.hwnd, |
| 390 event.os_event.message, | 390 event.os_event.message, |
| 391 event.os_event.wParam, | 391 event.os_event.wParam, |
| 392 event.os_event.lParam); | 392 event.os_event.lParam); |
| 393 } | 393 } |
| 394 | 394 |
| 395 void TabContentsViewWin::ShowContextMenu(const ContextMenuParams& params) { | 395 void TabContentsViewWin::ShowContextMenu(const ContextMenuParams& params) { |
| 396 // Allow delegates to handle the context menu operation first. | 396 // Allow delegates to handle the context menu operation first. |
| 397 if (tab_contents()->delegate()->HandleContextMenu(params)) { | 397 if (tab_contents()->delegate()->HandleContextMenu(params)) |
| 398 return; | 398 return; |
| 399 } | |
| 400 | 399 |
| 401 RenderViewContextMenuWin menu(tab_contents(), | 400 context_menu_.reset(new RenderViewContextMenuWin(tab_contents(), params)); |
| 402 params, | |
| 403 GetNativeView()); | |
| 404 | |
| 405 menu.Init(); | |
| 406 | 401 |
| 407 POINT screen_pt = { params.x, params.y }; | 402 POINT screen_pt = { params.x, params.y }; |
| 408 MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_pt, 1); | 403 MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_pt, 1); |
| 409 | 404 |
| 410 // Enable recursive tasks on the message loop so we can get updates while | 405 // Enable recursive tasks on the message loop so we can get updates while |
| 411 // the context menu is being displayed. | 406 // the context menu is being displayed. |
| 412 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 407 bool old_state = MessageLoop::current()->NestableTasksAllowed(); |
| 413 MessageLoop::current()->SetNestableTasksAllowed(true); | 408 MessageLoop::current()->SetNestableTasksAllowed(true); |
| 414 menu.RunMenuAt(screen_pt.x, screen_pt.y); | 409 context_menu_->RunMenuAt(screen_pt.x, screen_pt.y); |
| 415 MessageLoop::current()->SetNestableTasksAllowed(old_state); | 410 MessageLoop::current()->SetNestableTasksAllowed(old_state); |
| 416 } | 411 } |
| 417 | 412 |
| 418 void TabContentsViewWin::OnHScroll(int scroll_type, short position, | 413 void TabContentsViewWin::OnHScroll(int scroll_type, short position, |
| 419 HWND scrollbar) { | 414 HWND scrollbar) { |
| 420 ScrollCommon(WM_HSCROLL, scroll_type, position, scrollbar); | 415 ScrollCommon(WM_HSCROLL, scroll_type, position, scrollbar); |
| 421 } | 416 } |
| 422 | 417 |
| 423 void TabContentsViewWin::OnMouseLeave() { | 418 void TabContentsViewWin::OnMouseLeave() { |
| 424 // Let our delegate know that the mouse moved (useful for resetting status | 419 // Let our delegate know that the mouse moved (useful for resetting status |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 } | 607 } |
| 613 return false; | 608 return false; |
| 614 } | 609 } |
| 615 | 610 |
| 616 void TabContentsViewWin::WheelZoom(int distance) { | 611 void TabContentsViewWin::WheelZoom(int distance) { |
| 617 if (tab_contents()->delegate()) { | 612 if (tab_contents()->delegate()) { |
| 618 bool zoom_in = distance > 0; | 613 bool zoom_in = distance > 0; |
| 619 tab_contents()->delegate()->ContentsZoomChange(zoom_in); | 614 tab_contents()->delegate()->ContentsZoomChange(zoom_in); |
| 620 } | 615 } |
| 621 } | 616 } |
| OLD | NEW |