| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "ui/base/ime/composition_text.h" | 46 #include "ui/base/ime/composition_text.h" |
| 47 #include "ui/base/l10n/l10n_util_win.h" | 47 #include "ui/base/l10n/l10n_util_win.h" |
| 48 #include "ui/base/text/text_elider.h" | 48 #include "ui/base/text/text_elider.h" |
| 49 #include "ui/base/view_prop.h" | 49 #include "ui/base/view_prop.h" |
| 50 #include "ui/base/win/hwnd_util.h" | 50 #include "ui/base/win/hwnd_util.h" |
| 51 #include "ui/base/win/mouse_wheel_util.h" | 51 #include "ui/base/win/mouse_wheel_util.h" |
| 52 #include "ui/gfx/canvas.h" | 52 #include "ui/gfx/canvas.h" |
| 53 #include "ui/gfx/canvas_skia.h" | 53 #include "ui/gfx/canvas_skia.h" |
| 54 #include "ui/gfx/gdi_util.h" | 54 #include "ui/gfx/gdi_util.h" |
| 55 #include "ui/gfx/rect.h" | 55 #include "ui/gfx/rect.h" |
| 56 #include "ui/gfx/scoped_sk_region.h" |
| 56 #include "ui/gfx/screen.h" | 57 #include "ui/gfx/screen.h" |
| 57 #include "webkit/glue/webaccessibility.h" | 58 #include "webkit/glue/webaccessibility.h" |
| 58 #include "webkit/glue/webcursor.h" | 59 #include "webkit/glue/webcursor.h" |
| 59 #include "webkit/plugins/npapi/plugin_constants_win.h" | 60 #include "webkit/plugins/npapi/plugin_constants_win.h" |
| 60 #include "webkit/plugins/npapi/webplugin.h" | 61 #include "webkit/plugins/npapi/webplugin.h" |
| 61 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 62 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
| 62 | 63 |
| 63 using base::TimeDelta; | 64 using base::TimeDelta; |
| 64 using base::TimeTicks; | 65 using base::TimeTicks; |
| 65 using content::BrowserThread; | 66 using content::BrowserThread; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 is_loading_(false), | 323 is_loading_(false), |
| 323 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 324 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 324 is_fullscreen_(false), | 325 is_fullscreen_(false), |
| 325 ignore_mouse_movement_(true), | 326 ignore_mouse_movement_(true), |
| 326 composition_range_(ui::Range::InvalidRange()), | 327 composition_range_(ui::Range::InvalidRange()), |
| 327 ignore_next_lbutton_message_at_same_location(false), | 328 ignore_next_lbutton_message_at_same_location(false), |
| 328 last_pointer_down_location_(0), | 329 last_pointer_down_location_(0), |
| 329 touch_state_(this), | 330 touch_state_(this), |
| 330 pointer_down_context_(false), | 331 pointer_down_context_(false), |
| 331 focus_on_editable_field_(false), | 332 focus_on_editable_field_(false), |
| 332 received_focus_change_after_pointer_down_(false) { | 333 received_focus_change_after_pointer_down_(false), |
| 334 transparent_region_(0) { |
| 333 render_widget_host_->SetView(this); | 335 render_widget_host_->SetView(this); |
| 334 registrar_.Add(this, | 336 registrar_.Add(this, |
| 335 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 337 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 336 content::NotificationService::AllBrowserContextsAndSources()); | 338 content::NotificationService::AllBrowserContextsAndSources()); |
| 337 registrar_.Add(this, | 339 registrar_.Add(this, |
| 338 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 340 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
| 339 content::NotificationService::AllBrowserContextsAndSources()); | 341 content::NotificationService::AllBrowserContextsAndSources()); |
| 340 } | 342 } |
| 341 | 343 |
| 342 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { | 344 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); | 1106 HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); |
| 1105 dc->FillRect(&dirty_rect, white_brush); | 1107 dc->FillRect(&dirty_rect, white_brush); |
| 1106 } | 1108 } |
| 1107 } | 1109 } |
| 1108 | 1110 |
| 1109 void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) { | 1111 void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) { |
| 1110 // Do nothing. This suppresses the resize corner that Windows would | 1112 // Do nothing. This suppresses the resize corner that Windows would |
| 1111 // otherwise draw for us. | 1113 // otherwise draw for us. |
| 1112 } | 1114 } |
| 1113 | 1115 |
| 1116 void RenderWidgetHostViewWin::SetTransparentRegion(SkRegion* region) { |
| 1117 if (transparent_region_.Get()) { |
| 1118 transparent_region_.release(); |
| 1119 } |
| 1120 transparent_region_.Set(region); |
| 1121 } |
| 1122 |
| 1123 LRESULT RenderWidgetHostViewWin::OnNCHitTest(const CPoint& point) { |
| 1124 RECT rc; |
| 1125 GetWindowRect(&rc); |
| 1126 if (transparent_region_.Get() && |
| 1127 transparent_region_.Get()->contains(point.x - rc.left, |
| 1128 point.y - rc.top)) { |
| 1129 SetMsgHandled(true); |
| 1130 return HTTRANSPARENT; |
| 1131 } else { |
| 1132 SetMsgHandled(false); |
| 1133 return 0; |
| 1134 } |
| 1135 } |
| 1136 |
| 1114 LRESULT RenderWidgetHostViewWin::OnEraseBkgnd(HDC dc) { | 1137 LRESULT RenderWidgetHostViewWin::OnEraseBkgnd(HDC dc) { |
| 1115 return 1; | 1138 return 1; |
| 1116 } | 1139 } |
| 1117 | 1140 |
| 1118 LRESULT RenderWidgetHostViewWin::OnSetCursor(HWND window, UINT hittest_code, | 1141 LRESULT RenderWidgetHostViewWin::OnSetCursor(HWND window, UINT hittest_code, |
| 1119 UINT mouse_message_id) { | 1142 UINT mouse_message_id) { |
| 1120 UpdateCursorIfOverSelf(); | 1143 UpdateCursorIfOverSelf(); |
| 1121 return 0; | 1144 return 0; |
| 1122 } | 1145 } |
| 1123 | 1146 |
| (...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2569 void RenderWidgetHostViewWin::ResetPointerDownContext() { | 2592 void RenderWidgetHostViewWin::ResetPointerDownContext() { |
| 2570 // If the default focus on the page is on an edit field and we did not | 2593 // If the default focus on the page is on an edit field and we did not |
| 2571 // receive a focus change in the context of a pointer down message, it means | 2594 // receive a focus change in the context of a pointer down message, it means |
| 2572 // that the pointer down message occurred on the edit field and we should | 2595 // that the pointer down message occurred on the edit field and we should |
| 2573 // display the on screen keyboard | 2596 // display the on screen keyboard |
| 2574 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 2597 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
| 2575 DisplayOnScreenKeyboardIfNeeded(); | 2598 DisplayOnScreenKeyboardIfNeeded(); |
| 2576 received_focus_change_after_pointer_down_ = false; | 2599 received_focus_change_after_pointer_down_ = false; |
| 2577 pointer_down_context_ = false; | 2600 pointer_down_context_ = false; |
| 2578 } | 2601 } |
| OLD | NEW |