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 24 matching lines...) Expand all Loading... |
35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
36 #include "content/public/browser/child_process_data.h" | 36 #include "content/public/browser/child_process_data.h" |
37 #include "content/public/browser/content_browser_client.h" | 37 #include "content/public/browser/content_browser_client.h" |
38 #include "content/public/browser/native_web_keyboard_event.h" | 38 #include "content/public/browser/native_web_keyboard_event.h" |
39 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
40 #include "content/public/browser/notification_types.h" | 40 #include "content/public/browser/notification_types.h" |
41 #include "content/public/common/content_switches.h" | 41 #include "content/public/common/content_switches.h" |
42 #include "content/public/common/page_zoom.h" | 42 #include "content/public/common/page_zoom.h" |
43 #include "content/public/common/process_type.h" | 43 #include "content/public/common/process_type.h" |
44 #include "skia/ext/skia_utils_win.h" | 44 #include "skia/ext/skia_utils_win.h" |
| 45 #include "third_party/skia/include/core/SkRegion.h" |
45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
47 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFact
ory.h" | 48 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFact
ory.h" |
48 #include "ui/base/ime/composition_text.h" | 49 #include "ui/base/ime/composition_text.h" |
49 #include "ui/base/l10n/l10n_util_win.h" | 50 #include "ui/base/l10n/l10n_util_win.h" |
50 #include "ui/base/text/text_elider.h" | 51 #include "ui/base/text/text_elider.h" |
51 #include "ui/base/view_prop.h" | 52 #include "ui/base/view_prop.h" |
52 #include "ui/base/win/hwnd_util.h" | 53 #include "ui/base/win/hwnd_util.h" |
53 #include "ui/base/win/mouse_wheel_util.h" | 54 #include "ui/base/win/mouse_wheel_util.h" |
54 #include "ui/gfx/canvas.h" | 55 #include "ui/gfx/canvas.h" |
55 #include "ui/gfx/canvas_skia.h" | 56 #include "ui/gfx/canvas_skia.h" |
56 #include "ui/gfx/gdi_util.h" | 57 #include "ui/gfx/gdi_util.h" |
57 #include "ui/gfx/rect.h" | 58 #include "ui/gfx/rect.h" |
58 #include "ui/gfx/scoped_sk_region.h" | |
59 #include "ui/gfx/screen.h" | 59 #include "ui/gfx/screen.h" |
60 #include "webkit/glue/webaccessibility.h" | 60 #include "webkit/glue/webaccessibility.h" |
61 #include "webkit/glue/webcursor.h" | 61 #include "webkit/glue/webcursor.h" |
62 #include "webkit/plugins/npapi/plugin_constants_win.h" | 62 #include "webkit/plugins/npapi/plugin_constants_win.h" |
63 #include "webkit/plugins/npapi/webplugin.h" | 63 #include "webkit/plugins/npapi/webplugin.h" |
64 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 64 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
65 | 65 |
66 using base::TimeDelta; | 66 using base::TimeDelta; |
67 using base::TimeTicks; | 67 using base::TimeTicks; |
68 using content::BrowserThread; | 68 using content::BrowserThread; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 parent_hwnd_(NULL), | 322 parent_hwnd_(NULL), |
323 is_loading_(false), | 323 is_loading_(false), |
324 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 324 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
325 is_fullscreen_(false), | 325 is_fullscreen_(false), |
326 ignore_mouse_movement_(true), | 326 ignore_mouse_movement_(true), |
327 composition_range_(ui::Range::InvalidRange()), | 327 composition_range_(ui::Range::InvalidRange()), |
328 touch_state_(this), | 328 touch_state_(this), |
329 pointer_down_context_(false), | 329 pointer_down_context_(false), |
330 focus_on_editable_field_(false), | 330 focus_on_editable_field_(false), |
331 received_focus_change_after_pointer_down_(false), | 331 received_focus_change_after_pointer_down_(false), |
332 transparent_region_(0), | |
333 touch_events_enabled_(false) { | 332 touch_events_enabled_(false) { |
334 render_widget_host_ = static_cast<RenderWidgetHostImpl*>(widget); | 333 render_widget_host_ = static_cast<RenderWidgetHostImpl*>(widget); |
335 render_widget_host_->SetView(this); | 334 render_widget_host_->SetView(this); |
336 registrar_.Add(this, | 335 registrar_.Add(this, |
337 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 336 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
338 content::NotificationService::AllBrowserContextsAndSources()); | 337 content::NotificationService::AllBrowserContextsAndSources()); |
339 registrar_.Add(this, | 338 registrar_.Add(this, |
340 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 339 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
341 content::NotificationService::AllBrowserContextsAndSources()); | 340 content::NotificationService::AllBrowserContextsAndSources()); |
342 } | 341 } |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 dc->FillRect(&dirty_rect, white_brush); | 1186 dc->FillRect(&dirty_rect, white_brush); |
1188 } | 1187 } |
1189 } | 1188 } |
1190 | 1189 |
1191 void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) { | 1190 void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) { |
1192 // Do nothing. This suppresses the resize corner that Windows would | 1191 // Do nothing. This suppresses the resize corner that Windows would |
1193 // otherwise draw for us. | 1192 // otherwise draw for us. |
1194 } | 1193 } |
1195 | 1194 |
1196 void RenderWidgetHostViewWin::SetClickthroughRegion(SkRegion* region) { | 1195 void RenderWidgetHostViewWin::SetClickthroughRegion(SkRegion* region) { |
1197 transparent_region_.Set(region); | 1196 transparent_region_.reset(region); |
1198 } | 1197 } |
1199 | 1198 |
1200 LRESULT RenderWidgetHostViewWin::OnNCHitTest(const CPoint& point) { | 1199 LRESULT RenderWidgetHostViewWin::OnNCHitTest(const CPoint& point) { |
1201 RECT rc; | 1200 RECT rc; |
1202 GetWindowRect(&rc); | 1201 GetWindowRect(&rc); |
1203 if (transparent_region_.Get() && | 1202 if (transparent_region_.get() && |
1204 transparent_region_.Get()->contains(point.x - rc.left, | 1203 transparent_region_->contains(point.x - rc.left, point.y - rc.top)) { |
1205 point.y - rc.top)) { | |
1206 SetMsgHandled(TRUE); | 1204 SetMsgHandled(TRUE); |
1207 return HTTRANSPARENT; | 1205 return HTTRANSPARENT; |
1208 } | 1206 } |
1209 SetMsgHandled(FALSE); | 1207 SetMsgHandled(FALSE); |
1210 return 0; | 1208 return 0; |
1211 } | 1209 } |
1212 | 1210 |
1213 LRESULT RenderWidgetHostViewWin::OnEraseBkgnd(HDC dc) { | 1211 LRESULT RenderWidgetHostViewWin::OnEraseBkgnd(HDC dc) { |
1214 return 1; | 1212 return 1; |
1215 } | 1213 } |
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2652 void RenderWidgetHostViewWin::ResetPointerDownContext() { | 2650 void RenderWidgetHostViewWin::ResetPointerDownContext() { |
2653 // If the default focus on the page is on an edit field and we did not | 2651 // If the default focus on the page is on an edit field and we did not |
2654 // receive a focus change in the context of a pointer down message, it means | 2652 // receive a focus change in the context of a pointer down message, it means |
2655 // that the pointer down message occurred on the edit field and we should | 2653 // that the pointer down message occurred on the edit field and we should |
2656 // display the on screen keyboard | 2654 // display the on screen keyboard |
2657 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 2655 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
2658 DisplayOnScreenKeyboardIfNeeded(); | 2656 DisplayOnScreenKeyboardIfNeeded(); |
2659 received_focus_change_after_pointer_down_ = false; | 2657 received_focus_change_after_pointer_down_ = false; |
2660 pointer_down_context_ = false; | 2658 pointer_down_context_ = false; |
2661 } | 2659 } |
OLD | NEW |