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_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 625 popup_child_host_view_(NULL), | 625 popup_child_host_view_(NULL), |
| 626 is_loading_(false), | 626 is_loading_(false), |
| 627 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 627 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 628 can_compose_inline_(true), | 628 can_compose_inline_(true), |
| 629 has_composition_text_(false), | 629 has_composition_text_(false), |
| 630 paint_canvas_(NULL), | 630 paint_canvas_(NULL), |
| 631 synthetic_move_sent_(false), | 631 synthetic_move_sent_(false), |
| 632 accelerated_compositing_state_changed_(false), | 632 accelerated_compositing_state_changed_(false), |
| 633 can_lock_compositor_(YES), | 633 can_lock_compositor_(YES), |
| 634 paint_observer_(NULL), | 634 paint_observer_(NULL), |
| 635 accessible_parent_(NULL) { | 635 accessible_parent_(NULL), |
| 636 touch_editing_client_(NULL) { | |
| 636 host_->SetView(this); | 637 host_->SetView(this); |
| 637 window_observer_.reset(new WindowObserver(this)); | 638 window_observer_.reset(new WindowObserver(this)); |
| 638 aura::client::SetTooltipText(window_, &tooltip_); | 639 aura::client::SetTooltipText(window_, &tooltip_); |
| 639 aura::client::SetActivationDelegate(window_, this); | 640 aura::client::SetActivationDelegate(window_, this); |
| 640 aura::client::SetActivationChangeObserver(window_, this); | 641 aura::client::SetActivationChangeObserver(window_, this); |
| 641 aura::client::SetFocusChangeObserver(window_, this); | 642 aura::client::SetFocusChangeObserver(window_, this); |
| 642 gfx::Screen::GetScreenFor(window_)->AddObserver(this); | 643 gfx::Screen::GetScreenFor(window_)->AddObserver(this); |
| 643 #if defined(OS_WIN) | 644 #if defined(OS_WIN) |
| 644 transient_observer_.reset(new TransientWindowObserver(this)); | 645 transient_observer_.reset(new TransientWindowObserver(this)); |
| 645 #endif | 646 #endif |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 914 // Make sure we have a FocusClient before attempting to Focus(). In some | 915 // Make sure we have a FocusClient before attempting to Focus(). In some |
| 915 // situations we may not yet be in a valid Window hierarchy (such as reloading | 916 // situations we may not yet be in a valid Window hierarchy (such as reloading |
| 916 // after out of memory discarded the tab). | 917 // after out of memory discarded the tab). |
| 917 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); | 918 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); |
| 918 if (client) | 919 if (client) |
| 919 window_->Focus(); | 920 window_->Focus(); |
| 920 } | 921 } |
| 921 | 922 |
| 922 void RenderWidgetHostViewAura::Blur() { | 923 void RenderWidgetHostViewAura::Blur() { |
| 923 window_->Blur(); | 924 window_->Blur(); |
| 925 if (touch_editing_client_) | |
|
sky
2013/04/12 16:09:52
Isn't this handled on 2518?
varunjain
2013/04/12 17:35:19
Done.
| |
| 926 touch_editing_client_->EndTouchEditing(); | |
| 924 } | 927 } |
| 925 | 928 |
| 926 bool RenderWidgetHostViewAura::HasFocus() const { | 929 bool RenderWidgetHostViewAura::HasFocus() const { |
| 927 return window_->HasFocus(); | 930 return window_->HasFocus(); |
| 928 } | 931 } |
| 929 | 932 |
| 930 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 933 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
| 931 return current_surface_ || current_dib_ || !!host_->GetBackingStore(false); | 934 return current_surface_ || current_dib_ || !!host_->GetBackingStore(false); |
| 932 } | 935 } |
| 933 | 936 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 982 } | 985 } |
| 983 | 986 |
| 984 void RenderWidgetHostViewAura::TextInputStateChanged( | 987 void RenderWidgetHostViewAura::TextInputStateChanged( |
| 985 const ViewHostMsg_TextInputState_Params& params) { | 988 const ViewHostMsg_TextInputState_Params& params) { |
| 986 if (text_input_type_ != params.type || | 989 if (text_input_type_ != params.type || |
| 987 can_compose_inline_ != params.can_compose_inline) { | 990 can_compose_inline_ != params.can_compose_inline) { |
| 988 text_input_type_ = params.type; | 991 text_input_type_ = params.type; |
| 989 can_compose_inline_ = params.can_compose_inline; | 992 can_compose_inline_ = params.can_compose_inline; |
| 990 if (GetInputMethod()) | 993 if (GetInputMethod()) |
| 991 GetInputMethod()->OnTextInputTypeChanged(this); | 994 GetInputMethod()->OnTextInputTypeChanged(this); |
| 995 if (touch_editing_client_) | |
| 996 touch_editing_client_->OnTextInputTypeChanged(text_input_type_); | |
| 992 } | 997 } |
| 993 } | 998 } |
| 994 | 999 |
| 995 void RenderWidgetHostViewAura::ImeCancelComposition() { | 1000 void RenderWidgetHostViewAura::ImeCancelComposition() { |
| 996 if (GetInputMethod()) | 1001 if (GetInputMethod()) |
| 997 GetInputMethod()->CancelComposition(this); | 1002 GetInputMethod()->CancelComposition(this); |
| 998 has_composition_text_ = false; | 1003 has_composition_text_ = false; |
| 999 } | 1004 } |
| 1000 | 1005 |
| 1001 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( | 1006 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1097 const ViewHostMsg_SelectionBounds_Params& params) { | 1102 const ViewHostMsg_SelectionBounds_Params& params) { |
| 1098 if (selection_anchor_rect_ == params.anchor_rect && | 1103 if (selection_anchor_rect_ == params.anchor_rect && |
| 1099 selection_focus_rect_ == params.focus_rect) | 1104 selection_focus_rect_ == params.focus_rect) |
| 1100 return; | 1105 return; |
| 1101 | 1106 |
| 1102 selection_anchor_rect_ = params.anchor_rect; | 1107 selection_anchor_rect_ = params.anchor_rect; |
| 1103 selection_focus_rect_ = params.focus_rect; | 1108 selection_focus_rect_ = params.focus_rect; |
| 1104 | 1109 |
| 1105 if (GetInputMethod()) | 1110 if (GetInputMethod()) |
| 1106 GetInputMethod()->OnCaretBoundsChanged(this); | 1111 GetInputMethod()->OnCaretBoundsChanged(this); |
| 1112 | |
| 1113 if (touch_editing_client_) { | |
| 1114 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, | |
|
sky
2013/04/12 16:09:52
TouchEditingClient seems to have a mix of function
varunjain
2013/04/12 17:35:19
The input event and ack are used to determine if t
| |
| 1115 selection_focus_rect_); | |
| 1116 } | |
| 1107 } | 1117 } |
| 1108 | 1118 |
| 1109 void RenderWidgetHostViewAura::ScrollOffsetChanged() { | 1119 void RenderWidgetHostViewAura::ScrollOffsetChanged() { |
| 1110 aura::RootWindow* root = window_->GetRootWindow(); | 1120 aura::RootWindow* root = window_->GetRootWindow(); |
| 1111 if (!root) | 1121 if (!root) |
| 1112 return; | 1122 return; |
| 1113 aura::client::CursorClient* cursor_client = | 1123 aura::client::CursorClient* cursor_client = |
| 1114 aura::client::GetCursorClient(root); | 1124 aura::client::GetCursorClient(root); |
| 1115 if (cursor_client && !cursor_client->IsCursorVisible()) | 1125 if (cursor_client && !cursor_client->IsCursorVisible()) |
| 1116 cursor_client->DisableMouseEvents(); | 1126 cursor_client->DisableMouseEvents(); |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1701 } | 1711 } |
| 1702 | 1712 |
| 1703 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { | 1713 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { |
| 1704 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL); | 1714 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL); |
| 1705 } | 1715 } |
| 1706 | 1716 |
| 1707 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { | 1717 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { |
| 1708 return window_->GetToplevelWindow()->GetBoundsInScreen(); | 1718 return window_->GetToplevelWindow()->GetBoundsInScreen(); |
| 1709 } | 1719 } |
| 1710 | 1720 |
| 1721 void RenderWidgetHostViewAura::GestureEventAck(int gesture_event_type) { | |
| 1722 if (touch_editing_client_) | |
| 1723 touch_editing_client_->GestureEventAck(gesture_event_type); | |
| 1724 } | |
| 1725 | |
| 1711 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( | 1726 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( |
| 1712 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { | 1727 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { |
| 1713 ScopedVector<ui::TouchEvent> events; | 1728 ScopedVector<ui::TouchEvent> events; |
| 1714 if (!MakeUITouchEventsFromWebTouchEvents(touch_event, &events, | 1729 if (!MakeUITouchEventsFromWebTouchEvents(touch_event, &events, |
| 1715 SCREEN_COORDINATES)) | 1730 SCREEN_COORDINATES)) |
| 1716 return; | 1731 return; |
| 1717 | 1732 |
| 1718 aura::RootWindow* root = window_->GetRootWindow(); | 1733 aura::RootWindow* root = window_->GetRootWindow(); |
| 1719 // |root| is NULL during tests. | 1734 // |root| is NULL during tests. |
| 1720 if (!root) | 1735 if (!root) |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2042 const gfx::Point& location) { | 2057 const gfx::Point& location) { |
| 2043 return true; | 2058 return true; |
| 2044 } | 2059 } |
| 2045 | 2060 |
| 2046 bool RenderWidgetHostViewAura::CanFocus() { | 2061 bool RenderWidgetHostViewAura::CanFocus() { |
| 2047 return popup_type_ == WebKit::WebPopupTypeNone; | 2062 return popup_type_ == WebKit::WebPopupTypeNone; |
| 2048 } | 2063 } |
| 2049 | 2064 |
| 2050 void RenderWidgetHostViewAura::OnCaptureLost() { | 2065 void RenderWidgetHostViewAura::OnCaptureLost() { |
| 2051 host_->LostCapture(); | 2066 host_->LostCapture(); |
| 2067 if (touch_editing_client_) | |
| 2068 touch_editing_client_->EndTouchEditing(); | |
|
sky
2013/04/12 16:09:52
Does the client need to differentiate between a ca
varunjain
2013/04/12 17:35:19
The effect of cancel or end is the same, ie, hide
| |
| 2052 } | 2069 } |
| 2053 | 2070 |
| 2054 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { | 2071 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { |
| 2055 bool is_compositing_active = host_->is_accelerated_compositing_active(); | 2072 bool is_compositing_active = host_->is_accelerated_compositing_active(); |
| 2056 bool has_backing_store = !!host_->GetBackingStore(false); | 2073 bool has_backing_store = !!host_->GetBackingStore(false); |
| 2057 if (is_compositing_active && current_dib_) { | 2074 if (is_compositing_active && current_dib_) { |
| 2058 const gfx::Size window_size = window_->bounds().size(); | 2075 const gfx::Size window_size = window_->bounds().size(); |
| 2059 const gfx::Size& frame_size = last_swapped_surface_size_; | 2076 const gfx::Size& frame_size = last_swapped_surface_size_; |
| 2060 | 2077 |
| 2061 SkBitmap bitmap; | 2078 SkBitmap bitmap; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2161 return scoped_refptr<ui::Texture>( | 2178 return scoped_refptr<ui::Texture>( |
| 2162 factory->CreateOwnedTexture( | 2179 factory->CreateOwnedTexture( |
| 2163 current_surface_->size(), current_device_scale_factor_, texture_id)); | 2180 current_surface_->size(), current_device_scale_factor_, texture_id)); |
| 2164 } | 2181 } |
| 2165 | 2182 |
| 2166 //////////////////////////////////////////////////////////////////////////////// | 2183 //////////////////////////////////////////////////////////////////////////////// |
| 2167 // RenderWidgetHostViewAura, ui::EventHandler implementation: | 2184 // RenderWidgetHostViewAura, ui::EventHandler implementation: |
| 2168 | 2185 |
| 2169 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { | 2186 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { |
| 2170 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent"); | 2187 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent"); |
| 2188 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 2189 return; | |
| 2190 | |
| 2171 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { | 2191 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { |
| 2172 popup_child_host_view_->OnKeyEvent(event); | 2192 popup_child_host_view_->OnKeyEvent(event); |
| 2173 if (event->handled()) | 2193 if (event->handled()) |
| 2174 return; | 2194 return; |
| 2175 } | 2195 } |
| 2176 | 2196 |
| 2177 // We need to handle the Escape key for Pepper Flash. | 2197 // We need to handle the Escape key for Pepper Flash. |
| 2178 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { | 2198 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { |
| 2179 // Focus the window we were created from. | 2199 // Focus the window we were created from. |
| 2180 if (host_tracker_.get() && !host_tracker_->windows().empty()) { | 2200 if (host_tracker_.get() && !host_tracker_->windows().empty()) { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 2210 NativeWebKeyboardEvent webkit_event(event); | 2230 NativeWebKeyboardEvent webkit_event(event); |
| 2211 host_->ForwardKeyboardEvent(webkit_event); | 2231 host_->ForwardKeyboardEvent(webkit_event); |
| 2212 } | 2232 } |
| 2213 } | 2233 } |
| 2214 event->SetHandled(); | 2234 event->SetHandled(); |
| 2215 } | 2235 } |
| 2216 | 2236 |
| 2217 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { | 2237 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
| 2218 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent"); | 2238 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent"); |
| 2219 | 2239 |
| 2240 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 2241 return; | |
| 2242 | |
| 2220 if (mouse_locked_) { | 2243 if (mouse_locked_) { |
| 2221 // Hide the cursor if someone else has shown it. | 2244 // Hide the cursor if someone else has shown it. |
| 2222 aura::client::CursorClient* cursor_client = | 2245 aura::client::CursorClient* cursor_client = |
| 2223 aura::client::GetCursorClient(window_->GetRootWindow()); | 2246 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 2224 if (cursor_client && cursor_client->IsCursorVisible()) | 2247 if (cursor_client && cursor_client->IsCursorVisible()) |
| 2225 cursor_client->DisableMouseEvents(); | 2248 cursor_client->DisableMouseEvents(); |
| 2226 | 2249 |
| 2227 WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event); | 2250 WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event); |
| 2228 gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint()); | 2251 gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint()); |
| 2229 | 2252 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2310 // TODO(pkotwicz): Find a better way of doing this. | 2333 // TODO(pkotwicz): Find a better way of doing this. |
| 2311 if (window_->parent()->delegate() && !(event->flags() & ui::EF_FROM_TOUCH)) | 2334 if (window_->parent()->delegate() && !(event->flags() & ui::EF_FROM_TOUCH)) |
| 2312 window_->parent()->delegate()->OnMouseEvent(event); | 2335 window_->parent()->delegate()->OnMouseEvent(event); |
| 2313 | 2336 |
| 2314 if (!IsXButtonUpEvent(event)) | 2337 if (!IsXButtonUpEvent(event)) |
| 2315 event->SetHandled(); | 2338 event->SetHandled(); |
| 2316 } | 2339 } |
| 2317 | 2340 |
| 2318 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 2341 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { |
| 2319 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnScrollEvent"); | 2342 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnScrollEvent"); |
| 2343 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 2344 return; | |
| 2345 | |
| 2320 if (event->type() == ui::ET_SCROLL) { | 2346 if (event->type() == ui::ET_SCROLL) { |
| 2321 if (event->finger_count() != 2) | 2347 if (event->finger_count() != 2) |
| 2322 return; | 2348 return; |
| 2323 WebKit::WebGestureEvent gesture_event = | 2349 WebKit::WebGestureEvent gesture_event = |
| 2324 MakeWebGestureEventFlingCancel(); | 2350 MakeWebGestureEventFlingCancel(); |
| 2325 host_->ForwardGestureEvent(gesture_event); | 2351 host_->ForwardGestureEvent(gesture_event); |
| 2326 WebKit::WebMouseWheelEvent mouse_wheel_event = | 2352 WebKit::WebMouseWheelEvent mouse_wheel_event = |
| 2327 MakeWebMouseWheelEvent(static_cast<ui::ScrollEvent*>(event)); | 2353 MakeWebMouseWheelEvent(static_cast<ui::ScrollEvent*>(event)); |
| 2328 host_->ForwardWheelEvent(mouse_wheel_event); | 2354 host_->ForwardWheelEvent(mouse_wheel_event); |
| 2329 RecordAction(UserMetricsAction("TrackpadScroll")); | 2355 RecordAction(UserMetricsAction("TrackpadScroll")); |
| 2330 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 2356 } else if (event->type() == ui::ET_SCROLL_FLING_START || |
| 2331 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 2357 event->type() == ui::ET_SCROLL_FLING_CANCEL) { |
| 2332 WebKit::WebGestureEvent gesture_event = | 2358 WebKit::WebGestureEvent gesture_event = |
| 2333 MakeWebGestureEvent(static_cast<ui::ScrollEvent*>(event)); | 2359 MakeWebGestureEvent(static_cast<ui::ScrollEvent*>(event)); |
| 2334 host_->ForwardGestureEvent(gesture_event); | 2360 host_->ForwardGestureEvent(gesture_event); |
| 2335 if (event->type() == ui::ET_SCROLL_FLING_START) | 2361 if (event->type() == ui::ET_SCROLL_FLING_START) |
| 2336 RecordAction(UserMetricsAction("TrackpadScrollFling")); | 2362 RecordAction(UserMetricsAction("TrackpadScrollFling")); |
| 2337 } | 2363 } |
| 2338 | 2364 |
| 2339 event->SetHandled(); | 2365 event->SetHandled(); |
| 2340 } | 2366 } |
| 2341 | 2367 |
| 2342 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { | 2368 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { |
| 2343 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnTouchEvent"); | 2369 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnTouchEvent"); |
| 2370 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 2371 return; | |
| 2372 | |
| 2344 // Update the touch event first. | 2373 // Update the touch event first. |
| 2345 WebKit::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event, | 2374 WebKit::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event, |
| 2346 &touch_event_); | 2375 &touch_event_); |
| 2347 | 2376 |
| 2348 // Forward the touch event only if a touch point was updated, and there's a | 2377 // Forward the touch event only if a touch point was updated, and there's a |
| 2349 // touch-event handler in the page, and no other touch-event is in the queue. | 2378 // touch-event handler in the page, and no other touch-event is in the queue. |
| 2350 // It is important to always consume the event if there is a touch-event | 2379 // It is important to always consume the event if there is a touch-event |
| 2351 // handler in the page, or some touch-event is already in the queue, even if | 2380 // handler in the page, or some touch-event is already in the queue, even if |
| 2352 // no point has been updated, to make sure that this event does not get | 2381 // no point has been updated, to make sure that this event does not get |
| 2353 // processed by the gesture recognizer before the events in the queue. | 2382 // processed by the gesture recognizer before the events in the queue. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 2364 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { | 2393 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |
| 2365 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnGestureEvent"); | 2394 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnGestureEvent"); |
| 2366 // Pinch gestures are currently disabled by default. See crbug.com/128477. | 2395 // Pinch gestures are currently disabled by default. See crbug.com/128477. |
| 2367 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 2396 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
| 2368 event->type() == ui::ET_GESTURE_PINCH_UPDATE || | 2397 event->type() == ui::ET_GESTURE_PINCH_UPDATE || |
| 2369 event->type() == ui::ET_GESTURE_PINCH_END) && !ShouldSendPinchGesture()) { | 2398 event->type() == ui::ET_GESTURE_PINCH_END) && !ShouldSendPinchGesture()) { |
| 2370 event->SetHandled(); | 2399 event->SetHandled(); |
| 2371 return; | 2400 return; |
| 2372 } | 2401 } |
| 2373 | 2402 |
| 2403 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | |
| 2404 return; | |
| 2405 | |
| 2374 RenderViewHostDelegate* delegate = NULL; | 2406 RenderViewHostDelegate* delegate = NULL; |
| 2375 if (popup_type_ == WebKit::WebPopupTypeNone && !is_fullscreen_) | 2407 if (popup_type_ == WebKit::WebPopupTypeNone && !is_fullscreen_) |
| 2376 delegate = RenderViewHost::From(host_)->GetDelegate(); | 2408 delegate = RenderViewHost::From(host_)->GetDelegate(); |
| 2377 | 2409 |
| 2378 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && | 2410 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && |
| 2379 event->details().touch_points() == 1) { | 2411 event->details().touch_points() == 1) { |
| 2380 delegate->HandleGestureBegin(); | 2412 delegate->HandleGestureBegin(); |
| 2381 } | 2413 } |
| 2382 | 2414 |
| 2383 WebKit::WebGestureEvent gesture = MakeWebGestureEvent(event); | 2415 WebKit::WebGestureEvent gesture = MakeWebGestureEvent(event); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2475 | 2507 |
| 2476 DetachFromInputMethod(); | 2508 DetachFromInputMethod(); |
| 2477 host_->SetInputMethodActive(false); | 2509 host_->SetInputMethodActive(false); |
| 2478 | 2510 |
| 2479 // If we lose the focus while fullscreen, close the window; Pepper Flash | 2511 // If we lose the focus while fullscreen, close the window; Pepper Flash |
| 2480 // won't do it for us (unlike NPAPI Flash). | 2512 // won't do it for us (unlike NPAPI Flash). |
| 2481 if (is_fullscreen_ && !in_shutdown_) { | 2513 if (is_fullscreen_ && !in_shutdown_) { |
| 2482 in_shutdown_ = true; | 2514 in_shutdown_ = true; |
| 2483 host_->Shutdown(); | 2515 host_->Shutdown(); |
| 2484 } | 2516 } |
| 2517 if (touch_editing_client_) | |
| 2518 touch_editing_client_->EndTouchEditing(); | |
| 2485 } | 2519 } |
| 2486 } | 2520 } |
| 2487 | 2521 |
| 2488 //////////////////////////////////////////////////////////////////////////////// | 2522 //////////////////////////////////////////////////////////////////////////////// |
| 2489 // RenderWidgetHostViewAura, aura::RootWindowObserver implementation: | 2523 // RenderWidgetHostViewAura, aura::RootWindowObserver implementation: |
| 2490 | 2524 |
| 2491 void RenderWidgetHostViewAura::OnRootWindowMoved(const aura::RootWindow* root, | 2525 void RenderWidgetHostViewAura::OnRootWindowMoved(const aura::RootWindow* root, |
| 2492 const gfx::Point& new_origin) { | 2526 const gfx::Point& new_origin) { |
| 2493 UpdateScreenInfo(window_); | 2527 UpdateScreenInfo(window_); |
| 2494 } | 2528 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2613 host_->CompositingSurfaceUpdated(); | 2647 host_->CompositingSurfaceUpdated(); |
| 2614 host_->ScheduleComposite(); | 2648 host_->ScheduleComposite(); |
| 2615 } | 2649 } |
| 2616 | 2650 |
| 2617 //////////////////////////////////////////////////////////////////////////////// | 2651 //////////////////////////////////////////////////////////////////////////////// |
| 2618 // RenderWidgetHostViewAura, private: | 2652 // RenderWidgetHostViewAura, private: |
| 2619 | 2653 |
| 2620 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 2654 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
| 2621 if (paint_observer_) | 2655 if (paint_observer_) |
| 2622 paint_observer_->OnViewDestroyed(); | 2656 paint_observer_->OnViewDestroyed(); |
| 2657 if (touch_editing_client_) | |
| 2658 touch_editing_client_->OnViewDestroyed(); | |
| 2623 if (!shared_surface_handle_.is_null()) { | 2659 if (!shared_surface_handle_.is_null()) { |
| 2624 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 2660 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 2625 factory->DestroySharedSurfaceHandle(shared_surface_handle_); | 2661 factory->DestroySharedSurfaceHandle(shared_surface_handle_); |
| 2626 factory->RemoveObserver(this); | 2662 factory->RemoveObserver(this); |
| 2627 } | 2663 } |
| 2628 window_observer_.reset(); | 2664 window_observer_.reset(); |
| 2629 #if defined(OS_WIN) | 2665 #if defined(OS_WIN) |
| 2630 transient_observer_.reset(); | 2666 transient_observer_.reset(); |
| 2631 #endif | 2667 #endif |
| 2632 if (window_->GetRootWindow()) | 2668 if (window_->GetRootWindow()) |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2825 RenderWidgetHost* widget) { | 2861 RenderWidgetHost* widget) { |
| 2826 return new RenderWidgetHostViewAura(widget); | 2862 return new RenderWidgetHostViewAura(widget); |
| 2827 } | 2863 } |
| 2828 | 2864 |
| 2829 // static | 2865 // static |
| 2830 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 2866 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2831 GetScreenInfoForWindow(results, NULL); | 2867 GetScreenInfoForWindow(results, NULL); |
| 2832 } | 2868 } |
| 2833 | 2869 |
| 2834 } // namespace content | 2870 } // namespace content |
| OLD | NEW |