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/child/npapi/webplugin_delegate_impl.h" | 5 #include "content/child/npapi/webplugin_delegate_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 if (window_rect_changed) { | 1022 if (window_rect_changed) { |
1023 WINDOWPOS win_pos = {0}; | 1023 WINDOWPOS win_pos = {0}; |
1024 win_pos.x = window_rect_.x(); | 1024 win_pos.x = window_rect_.x(); |
1025 win_pos.y = window_rect_.y(); | 1025 win_pos.y = window_rect_.y(); |
1026 win_pos.cx = window_rect_.width(); | 1026 win_pos.cx = window_rect_.width(); |
1027 win_pos.cy = window_rect_.height(); | 1027 win_pos.cy = window_rect_.height(); |
1028 | 1028 |
1029 NPEvent pos_changed_event; | 1029 NPEvent pos_changed_event; |
1030 pos_changed_event.event = WM_WINDOWPOSCHANGED; | 1030 pos_changed_event.event = WM_WINDOWPOSCHANGED; |
1031 pos_changed_event.wParam = 0; | 1031 pos_changed_event.wParam = 0; |
1032 pos_changed_event.lParam = PtrToUlong(&win_pos); | 1032 pos_changed_event.lParam = reinterpret_cast<uintptr_t>(&win_pos); |
1033 | 1033 |
1034 instance()->NPP_HandleEvent(&pos_changed_event); | 1034 instance()->NPP_HandleEvent(&pos_changed_event); |
1035 } | 1035 } |
1036 } | 1036 } |
1037 | 1037 |
1038 void WebPluginDelegateImpl::WindowlessPaint(HDC hdc, | 1038 void WebPluginDelegateImpl::WindowlessPaint(HDC hdc, |
1039 const gfx::Rect& damage_rect) { | 1039 const gfx::Rect& damage_rect) { |
1040 DCHECK(hdc); | 1040 DCHECK(hdc); |
1041 | 1041 |
1042 RECT damage_rect_win; | 1042 RECT damage_rect_win; |
1043 damage_rect_win.left = damage_rect.x(); // + window_rect_.x(); | 1043 damage_rect_win.left = damage_rect.x(); // + window_rect_.x(); |
1044 damage_rect_win.top = damage_rect.y(); // + window_rect_.y(); | 1044 damage_rect_win.top = damage_rect.y(); // + window_rect_.y(); |
1045 damage_rect_win.right = damage_rect_win.left + damage_rect.width(); | 1045 damage_rect_win.right = damage_rect_win.left + damage_rect.width(); |
1046 damage_rect_win.bottom = damage_rect_win.top + damage_rect.height(); | 1046 damage_rect_win.bottom = damage_rect_win.top + damage_rect.height(); |
1047 | 1047 |
1048 // Save away the old HDC as this could be a nested invocation. | 1048 // Save away the old HDC as this could be a nested invocation. |
1049 void* old_dc = window_.window; | 1049 void* old_dc = window_.window; |
1050 window_.window = hdc; | 1050 window_.window = hdc; |
1051 | 1051 |
1052 NPEvent paint_event; | 1052 NPEvent paint_event; |
1053 paint_event.event = WM_PAINT; | 1053 paint_event.event = WM_PAINT; |
1054 // NOTE: NPAPI is not 64bit safe. It puts pointers into 32bit values. | |
1055 paint_event.wParam = PtrToUlong(hdc); | 1054 paint_event.wParam = PtrToUlong(hdc); |
1056 paint_event.lParam = PtrToUlong(&damage_rect_win); | 1055 paint_event.lParam = reinterpret_cast<uintptr_t>(&damage_rect_win); |
1057 base::StatsRate plugin_paint("Plugin.Paint"); | 1056 base::StatsRate plugin_paint("Plugin.Paint"); |
1058 base::StatsScope<base::StatsRate> scope(plugin_paint); | 1057 base::StatsScope<base::StatsRate> scope(plugin_paint); |
1059 instance()->NPP_HandleEvent(&paint_event); | 1058 instance()->NPP_HandleEvent(&paint_event); |
1060 window_.window = old_dc; | 1059 window_.window = old_dc; |
1061 } | 1060 } |
1062 | 1061 |
1063 void WebPluginDelegateImpl::WindowlessSetWindow() { | 1062 void WebPluginDelegateImpl::WindowlessSetWindow() { |
1064 if (!instance()) | 1063 if (!instance()) |
1065 return; | 1064 return; |
1066 | 1065 |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 case WM_RBUTTONUP: | 1484 case WM_RBUTTONUP: |
1486 ::ReleaseCapture(); | 1485 ::ReleaseCapture(); |
1487 break; | 1486 break; |
1488 | 1487 |
1489 default: | 1488 default: |
1490 break; | 1489 break; |
1491 } | 1490 } |
1492 } | 1491 } |
1493 | 1492 |
1494 } // namespace content | 1493 } // namespace content |
OLD | NEW |