Chromium Code Reviews| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 is_loading_(false), | 327 is_loading_(false), |
| 327 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 328 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 328 is_fullscreen_(false), | 329 is_fullscreen_(false), |
| 329 ignore_mouse_movement_(true), | 330 ignore_mouse_movement_(true), |
| 330 composition_range_(ui::Range::InvalidRange()), | 331 composition_range_(ui::Range::InvalidRange()), |
| 331 ignore_next_lbutton_message_at_same_location(false), | 332 ignore_next_lbutton_message_at_same_location(false), |
| 332 last_pointer_down_location_(0), | 333 last_pointer_down_location_(0), |
| 333 touch_state_(this), | 334 touch_state_(this), |
| 334 pointer_down_context_(false), | 335 pointer_down_context_(false), |
| 335 focus_on_editable_field_(false), | 336 focus_on_editable_field_(false), |
| 336 received_focus_change_after_pointer_down_(false) { | 337 received_focus_change_after_pointer_down_(false), |
| 338 transparent_region_(0) { | |
| 337 render_widget_host_->SetView(this); | 339 render_widget_host_->SetView(this); |
| 338 registrar_.Add(this, | 340 registrar_.Add(this, |
| 339 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 341 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 340 content::NotificationService::AllBrowserContextsAndSources()); | 342 content::NotificationService::AllBrowserContextsAndSources()); |
| 341 registrar_.Add(this, | 343 registrar_.Add(this, |
| 342 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 344 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
| 343 content::NotificationService::AllBrowserContextsAndSources()); | 345 content::NotificationService::AllBrowserContextsAndSources()); |
| 344 } | 346 } |
| 345 | 347 |
| 346 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { | 348 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1141 HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); | 1143 HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); |
| 1142 dc->FillRect(&dirty_rect, white_brush); | 1144 dc->FillRect(&dirty_rect, white_brush); |
| 1143 } | 1145 } |
| 1144 } | 1146 } |
| 1145 | 1147 |
| 1146 void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) { | 1148 void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) { |
| 1147 // Do nothing. This suppresses the resize corner that Windows would | 1149 // Do nothing. This suppresses the resize corner that Windows would |
| 1148 // otherwise draw for us. | 1150 // otherwise draw for us. |
| 1149 } | 1151 } |
| 1150 | 1152 |
| 1153 void RenderWidgetHostViewWin::SetTransparentRegion(SkRegion* region) { | |
| 1154 if (transparent_region_.Get()) { | |
|
Ben Goodger (Google)
2012/02/07 20:18:57
nit: no braces on single line if
jeremya
2012/02/08 00:35:16
Done.
| |
| 1155 transparent_region_.release(); | |
| 1156 } | |
| 1157 transparent_region_.Set(region); | |
| 1158 } | |
| 1159 | |
| 1160 LRESULT RenderWidgetHostViewWin::OnNCHitTest(const CPoint& point) { | |
| 1161 RECT rc; | |
| 1162 GetWindowRect(&rc); | |
| 1163 if (transparent_region_.Get() && | |
| 1164 transparent_region_.Get()->contains(point.x - rc.left, | |
| 1165 point.y - rc.top)) { | |
| 1166 SetMsgHandled(true); | |
| 1167 return HTTRANSPARENT; | |
| 1168 } else { | |
|
Ben Goodger (Google)
2012/02/07 20:18:57
no else after return
jeremya
2012/02/08 00:35:16
Done.
| |
| 1169 SetMsgHandled(false); | |
| 1170 return 0; | |
| 1171 } | |
| 1172 } | |
| 1173 | |
| 1151 LRESULT RenderWidgetHostViewWin::OnEraseBkgnd(HDC dc) { | 1174 LRESULT RenderWidgetHostViewWin::OnEraseBkgnd(HDC dc) { |
| 1152 return 1; | 1175 return 1; |
| 1153 } | 1176 } |
| 1154 | 1177 |
| 1155 LRESULT RenderWidgetHostViewWin::OnSetCursor(HWND window, UINT hittest_code, | 1178 LRESULT RenderWidgetHostViewWin::OnSetCursor(HWND window, UINT hittest_code, |
| 1156 UINT mouse_message_id) { | 1179 UINT mouse_message_id) { |
| 1157 UpdateCursorIfOverSelf(); | 1180 UpdateCursorIfOverSelf(); |
| 1158 return 0; | 1181 return 0; |
| 1159 } | 1182 } |
| 1160 | 1183 |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2601 void RenderWidgetHostViewWin::ResetPointerDownContext() { | 2624 void RenderWidgetHostViewWin::ResetPointerDownContext() { |
| 2602 // If the default focus on the page is on an edit field and we did not | 2625 // If the default focus on the page is on an edit field and we did not |
| 2603 // receive a focus change in the context of a pointer down message, it means | 2626 // receive a focus change in the context of a pointer down message, it means |
| 2604 // that the pointer down message occurred on the edit field and we should | 2627 // that the pointer down message occurred on the edit field and we should |
| 2605 // display the on screen keyboard | 2628 // display the on screen keyboard |
| 2606 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 2629 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
| 2607 DisplayOnScreenKeyboardIfNeeded(); | 2630 DisplayOnScreenKeyboardIfNeeded(); |
| 2608 received_focus_change_after_pointer_down_ = false; | 2631 received_focus_change_after_pointer_down_ = false; |
| 2609 pointer_down_context_ = false; | 2632 pointer_down_context_ = false; |
| 2610 } | 2633 } |
| OLD | NEW |