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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 #include "ui/base/l10n/l10n_util_win.h" | 50 #include "ui/base/l10n/l10n_util_win.h" |
51 #include "ui/base/text/text_elider.h" | 51 #include "ui/base/text/text_elider.h" |
52 #include "ui/base/ui_base_switches.h" | 52 #include "ui/base/ui_base_switches.h" |
53 #include "ui/base/view_prop.h" | 53 #include "ui/base/view_prop.h" |
54 #include "ui/base/win/hwnd_util.h" | 54 #include "ui/base/win/hwnd_util.h" |
55 #include "ui/base/win/mouse_wheel_util.h" | 55 #include "ui/base/win/mouse_wheel_util.h" |
56 #include "ui/gfx/canvas.h" | 56 #include "ui/gfx/canvas.h" |
57 #include "ui/gfx/gdi_util.h" | 57 #include "ui/gfx/gdi_util.h" |
58 #include "ui/gfx/rect.h" | 58 #include "ui/gfx/rect.h" |
59 #include "ui/gfx/screen.h" | 59 #include "ui/gfx/screen.h" |
60 #include "ui/views/events/event.h" | |
60 #include "webkit/glue/webaccessibility.h" | 61 #include "webkit/glue/webaccessibility.h" |
61 #include "webkit/glue/webcursor.h" | 62 #include "webkit/glue/webcursor.h" |
62 #include "webkit/plugins/npapi/plugin_constants_win.h" | 63 #include "webkit/plugins/npapi/plugin_constants_win.h" |
63 #include "webkit/plugins/npapi/webplugin.h" | 64 #include "webkit/plugins/npapi/webplugin.h" |
64 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 65 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
65 | 66 |
66 using base::TimeDelta; | 67 using base::TimeDelta; |
67 using base::TimeTicks; | 68 using base::TimeTicks; |
68 using content::BrowserThread; | 69 using content::BrowserThread; |
69 using content::RenderWidgetHost; | 70 using content::RenderWidgetHost; |
(...skipping 256 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 touch_state_(this), | 332 touch_state_(this), |
332 pointer_down_context_(false), | 333 pointer_down_context_(false), |
333 focus_on_editable_field_(false), | 334 focus_on_editable_field_(false), |
334 received_focus_change_after_pointer_down_(false), | 335 received_focus_change_after_pointer_down_(false), |
335 touch_events_enabled_(false), | 336 touch_events_enabled_(false), |
337 ALLOW_THIS_IN_INITIALIZER_LIST( | |
338 gesture_recognizer_(ui::GestureRecognizer::Create(this))), | |
sky
2012/05/03 22:39:19
If gesture_recognizer_ is going to created in the
| |
336 ALLOW_THIS_IN_INITIALIZER_LIST(sys_color_change_listener_(this)) { | 339 ALLOW_THIS_IN_INITIALIZER_LIST(sys_color_change_listener_(this)) { |
337 render_widget_host_->SetView(this); | 340 render_widget_host_->SetView(this); |
338 registrar_.Add(this, | 341 registrar_.Add(this, |
339 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 342 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
340 content::NotificationService::AllBrowserContextsAndSources()); | 343 content::NotificationService::AllBrowserContextsAndSources()); |
341 registrar_.Add(this, | 344 registrar_.Add(this, |
342 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 345 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
343 content::NotificationService::AllBrowserContextsAndSources()); | 346 content::NotificationService::AllBrowserContextsAndSources()); |
344 } | 347 } |
345 | 348 |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
993 } | 996 } |
994 | 997 |
995 void RenderWidgetHostViewWin::SetHasHorizontalScrollbar( | 998 void RenderWidgetHostViewWin::SetHasHorizontalScrollbar( |
996 bool has_horizontal_scrollbar) { | 999 bool has_horizontal_scrollbar) { |
997 } | 1000 } |
998 | 1001 |
999 void RenderWidgetHostViewWin::SetScrollOffsetPinning( | 1002 void RenderWidgetHostViewWin::SetScrollOffsetPinning( |
1000 bool is_pinned_to_left, bool is_pinned_to_right) { | 1003 bool is_pinned_to_left, bool is_pinned_to_right) { |
1001 } | 1004 } |
1002 | 1005 |
1006 bool RenderWidgetHostViewWin::DispatchLongPressGestureEvent( | |
1007 ui::GestureEvent* event) { | |
1008 // TODO: Implement. | |
1009 return false; | |
1010 } | |
1011 | |
1012 bool RenderWidgetHostViewWin::DispatchCancelTouchEvent( | |
1013 ui::TouchEvent* event) { | |
1014 // TODO: Implement. | |
1015 return false; | |
1016 } | |
1017 | |
1018 ui::TouchEvent* RenderWidgetHostViewWin::CreateTouchEvent( | |
1019 ui::EventType type, | |
1020 const gfx::Point& location, | |
1021 int touch_id, | |
1022 base::TimeDelta time_stamp) { | |
1023 return new views::TouchEvent( | |
1024 type, location.x(), location.y(), 0, touch_id, 0, 0, 0, 0); | |
1025 } | |
1026 | |
1027 ui::GestureEvent* RenderWidgetHostViewWin::CreateGestureEvent( | |
1028 ui::EventType type, | |
1029 const gfx::Point& location, | |
1030 int flags, | |
1031 const base::Time time, | |
1032 float param_first, | |
1033 float param_second, | |
1034 unsigned int touch_id_bitfield) { | |
1035 return new views::GestureEvent(type, location.x(), location.y(), flags, time, | |
1036 param_first, param_second, touch_id_bitfield); | |
1037 } | |
1038 | |
1003 /////////////////////////////////////////////////////////////////////////////// | 1039 /////////////////////////////////////////////////////////////////////////////// |
1004 // RenderWidgetHostViewWin, private: | 1040 // RenderWidgetHostViewWin, private: |
1005 | 1041 |
1006 LRESULT RenderWidgetHostViewWin::OnCreate(CREATESTRUCT* create_struct) { | 1042 LRESULT RenderWidgetHostViewWin::OnCreate(CREATESTRUCT* create_struct) { |
1007 // Call the WM_INPUTLANGCHANGE message handler to initialize the input locale | 1043 // Call the WM_INPUTLANGCHANGE message handler to initialize the input locale |
1008 // of a browser process. | 1044 // of a browser process. |
1009 OnInputLangChange(0, 0); | 1045 OnInputLangChange(0, 0); |
1010 // Marks that window as supporting mouse-wheel messages rerouting so it is | 1046 // Marks that window as supporting mouse-wheel messages rerouting so it is |
1011 // scrolled when under the mouse pointer even if inactive. | 1047 // scrolled when under the mouse pointer even if inactive. |
1012 props_.push_back(ui::SetWindowSupportsRerouteMouseWheel(m_hWnd)); | 1048 props_.push_back(ui::SetWindowSupportsRerouteMouseWheel(m_hWnd)); |
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2692 void RenderWidgetHostViewWin::ResetPointerDownContext() { | 2728 void RenderWidgetHostViewWin::ResetPointerDownContext() { |
2693 // If the default focus on the page is on an edit field and we did not | 2729 // If the default focus on the page is on an edit field and we did not |
2694 // receive a focus change in the context of a pointer down message, it means | 2730 // receive a focus change in the context of a pointer down message, it means |
2695 // that the pointer down message occurred on the edit field and we should | 2731 // that the pointer down message occurred on the edit field and we should |
2696 // display the on screen keyboard | 2732 // display the on screen keyboard |
2697 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 2733 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
2698 DisplayOnScreenKeyboardIfNeeded(); | 2734 DisplayOnScreenKeyboardIfNeeded(); |
2699 received_focus_change_after_pointer_down_ = false; | 2735 received_focus_change_after_pointer_down_ = false; |
2700 pointer_down_context_ = false; | 2736 pointer_down_context_ = false; |
2701 } | 2737 } |
OLD | NEW |