| 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 <peninputpanel_i.c> | 8 #include <peninputpanel_i.c> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "ui/base/ime/composition_text.h" | 47 #include "ui/base/ime/composition_text.h" |
| 48 #include "ui/base/l10n/l10n_util_win.h" | 48 #include "ui/base/l10n/l10n_util_win.h" |
| 49 #include "ui/base/text/text_elider.h" | 49 #include "ui/base/text/text_elider.h" |
| 50 #include "ui/base/view_prop.h" | 50 #include "ui/base/view_prop.h" |
| 51 #include "ui/base/win/hwnd_util.h" | 51 #include "ui/base/win/hwnd_util.h" |
| 52 #include "ui/base/win/mouse_wheel_util.h" | 52 #include "ui/base/win/mouse_wheel_util.h" |
| 53 #include "ui/gfx/canvas.h" | 53 #include "ui/gfx/canvas.h" |
| 54 #include "ui/gfx/canvas_skia.h" | 54 #include "ui/gfx/canvas_skia.h" |
| 55 #include "ui/gfx/gdi_util.h" | 55 #include "ui/gfx/gdi_util.h" |
| 56 #include "ui/gfx/rect.h" | 56 #include "ui/gfx/rect.h" |
| 57 #include "ui/gfx/scoped_sk_region.h" |
| 57 #include "ui/gfx/screen.h" | 58 #include "ui/gfx/screen.h" |
| 58 #include "webkit/glue/webaccessibility.h" | 59 #include "webkit/glue/webaccessibility.h" |
| 59 #include "webkit/glue/webcursor.h" | 60 #include "webkit/glue/webcursor.h" |
| 60 #include "webkit/plugins/npapi/plugin_constants_win.h" | 61 #include "webkit/plugins/npapi/plugin_constants_win.h" |
| 61 #include "webkit/plugins/npapi/webplugin.h" | 62 #include "webkit/plugins/npapi/webplugin.h" |
| 62 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 63 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
| 63 | 64 |
| 64 using base::TimeDelta; | 65 using base::TimeDelta; |
| 65 using base::TimeTicks; | 66 using base::TimeTicks; |
| 66 using content::BrowserThread; | 67 using content::BrowserThread; |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 is_loading_(false), | 322 is_loading_(false), |
| 322 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 323 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 323 is_fullscreen_(false), | 324 is_fullscreen_(false), |
| 324 ignore_mouse_movement_(true), | 325 ignore_mouse_movement_(true), |
| 325 composition_range_(ui::Range::InvalidRange()), | 326 composition_range_(ui::Range::InvalidRange()), |
| 326 ignore_next_lbutton_message_at_same_location(false), | 327 ignore_next_lbutton_message_at_same_location(false), |
| 327 last_pointer_down_location_(0), | 328 last_pointer_down_location_(0), |
| 328 touch_state_(this), | 329 touch_state_(this), |
| 329 pointer_down_context_(false), | 330 pointer_down_context_(false), |
| 330 focus_on_editable_field_(false), | 331 focus_on_editable_field_(false), |
| 331 received_focus_change_after_pointer_down_(false) { | 332 received_focus_change_after_pointer_down_(false), |
| 333 transparent_region_(0) { |
| 332 render_widget_host_->SetView(this); | 334 render_widget_host_->SetView(this); |
| 333 registrar_.Add(this, | 335 registrar_.Add(this, |
| 334 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 336 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 335 content::NotificationService::AllBrowserContextsAndSources()); | 337 content::NotificationService::AllBrowserContextsAndSources()); |
| 336 registrar_.Add(this, | 338 registrar_.Add(this, |
| 337 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 339 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
| 338 content::NotificationService::AllBrowserContextsAndSources()); | 340 content::NotificationService::AllBrowserContextsAndSources()); |
| 339 } | 341 } |
| 340 | 342 |
| 341 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { | 343 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); | 1134 HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); |
| 1133 dc->FillRect(&dirty_rect, white_brush); | 1135 dc->FillRect(&dirty_rect, white_brush); |
| 1134 } | 1136 } |
| 1135 } | 1137 } |
| 1136 | 1138 |
| 1137 void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) { | 1139 void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) { |
| 1138 // Do nothing. This suppresses the resize corner that Windows would | 1140 // Do nothing. This suppresses the resize corner that Windows would |
| 1139 // otherwise draw for us. | 1141 // otherwise draw for us. |
| 1140 } | 1142 } |
| 1141 | 1143 |
| 1144 void RenderWidgetHostViewWin::SetTransparentRegion(SkRegion* region) { |
| 1145 if (transparent_region_.Get()) { |
| 1146 transparent_region_.release(); |
| 1147 } |
| 1148 transparent_region_.Set(region); |
| 1149 } |
| 1150 |
| 1151 LRESULT RenderWidgetHostViewWin::OnNCHitTest(const CPoint& point) { |
| 1152 RECT rc; |
| 1153 GetWindowRect(&rc); |
| 1154 if (transparent_region_.Get() && |
| 1155 transparent_region_.Get()->contains(point.x - rc.left, |
| 1156 point.y - rc.top)) { |
| 1157 SetMsgHandled(true); |
| 1158 return HTTRANSPARENT; |
| 1159 } else { |
| 1160 SetMsgHandled(false); |
| 1161 return 0; |
| 1162 } |
| 1163 } |
| 1164 |
| 1142 LRESULT RenderWidgetHostViewWin::OnEraseBkgnd(HDC dc) { | 1165 LRESULT RenderWidgetHostViewWin::OnEraseBkgnd(HDC dc) { |
| 1143 return 1; | 1166 return 1; |
| 1144 } | 1167 } |
| 1145 | 1168 |
| 1146 LRESULT RenderWidgetHostViewWin::OnSetCursor(HWND window, UINT hittest_code, | 1169 LRESULT RenderWidgetHostViewWin::OnSetCursor(HWND window, UINT hittest_code, |
| 1147 UINT mouse_message_id) { | 1170 UINT mouse_message_id) { |
| 1148 UpdateCursorIfOverSelf(); | 1171 UpdateCursorIfOverSelf(); |
| 1149 return 0; | 1172 return 0; |
| 1150 } | 1173 } |
| 1151 | 1174 |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2592 void RenderWidgetHostViewWin::ResetPointerDownContext() { | 2615 void RenderWidgetHostViewWin::ResetPointerDownContext() { |
| 2593 // If the default focus on the page is on an edit field and we did not | 2616 // If the default focus on the page is on an edit field and we did not |
| 2594 // receive a focus change in the context of a pointer down message, it means | 2617 // receive a focus change in the context of a pointer down message, it means |
| 2595 // that the pointer down message occurred on the edit field and we should | 2618 // that the pointer down message occurred on the edit field and we should |
| 2596 // display the on screen keyboard | 2619 // display the on screen keyboard |
| 2597 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 2620 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
| 2598 DisplayOnScreenKeyboardIfNeeded(); | 2621 DisplayOnScreenKeyboardIfNeeded(); |
| 2599 received_focus_change_after_pointer_down_ = false; | 2622 received_focus_change_after_pointer_down_ = false; |
| 2600 pointer_down_context_ = false; | 2623 pointer_down_context_ = false; |
| 2601 } | 2624 } |
| OLD | NEW |