| 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 <set> | 7 #include <set> | 
| 8 | 8 | 
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" | 
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 30 #include "content/browser/renderer_host/compositor_resize_lock_aura.h" | 30 #include "content/browser/renderer_host/compositor_resize_lock_aura.h" | 
| 31 #include "content/browser/renderer_host/dip_util.h" | 31 #include "content/browser/renderer_host/dip_util.h" | 
| 32 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" | 32 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" | 
| 33 #include "content/browser/renderer_host/input/touch_selection_controller_client_
      aura.h" | 33 #include "content/browser/renderer_host/input/touch_selection_controller_client_
      aura.h" | 
| 34 #include "content/browser/renderer_host/input/ui_touch_selection_helper.h" | 34 #include "content/browser/renderer_host/input/ui_touch_selection_helper.h" | 
| 35 #include "content/browser/renderer_host/input/web_input_event_util.h" | 35 #include "content/browser/renderer_host/input/web_input_event_util.h" | 
| 36 #include "content/browser/renderer_host/overscroll_controller.h" | 36 #include "content/browser/renderer_host/overscroll_controller.h" | 
| 37 #include "content/browser/renderer_host/render_view_host_delegate.h" | 37 #include "content/browser/renderer_host/render_view_host_delegate.h" | 
| 38 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 38 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 
| 39 #include "content/browser/renderer_host/render_view_host_impl.h" | 39 #include "content/browser/renderer_host/render_view_host_impl.h" | 
|  | 40 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 
| 40 #include "content/browser/renderer_host/render_widget_host_impl.h" | 41 #include "content/browser/renderer_host/render_widget_host_impl.h" | 
|  | 42 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 
| 41 #include "content/browser/renderer_host/ui_events_helper.h" | 43 #include "content/browser/renderer_host/ui_events_helper.h" | 
| 42 #include "content/browser/renderer_host/web_input_event_aura.h" | 44 #include "content/browser/renderer_host/web_input_event_aura.h" | 
| 43 #include "content/common/gpu/client/gl_helper.h" | 45 #include "content/common/gpu/client/gl_helper.h" | 
| 44 #include "content/common/gpu/gpu_messages.h" | 46 #include "content/common/gpu/gpu_messages.h" | 
| 45 #include "content/common/view_messages.h" | 47 #include "content/common/view_messages.h" | 
| 46 #include "content/public/browser/content_browser_client.h" | 48 #include "content/public/browser/content_browser_client.h" | 
| 47 #include "content/public/browser/overscroll_configuration.h" | 49 #include "content/public/browser/overscroll_configuration.h" | 
| 48 #include "content/public/browser/render_view_host.h" | 50 #include "content/public/browser/render_view_host.h" | 
| 49 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 51 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 
| 50 #include "content/public/browser/user_metrics.h" | 52 #include "content/public/browser/user_metrics.h" | 
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 478     host_->SetView(this); | 480     host_->SetView(this); | 
| 479 | 481 | 
| 480   window_observer_.reset(new WindowObserver(this)); | 482   window_observer_.reset(new WindowObserver(this)); | 
| 481 | 483 | 
| 482   aura::client::SetTooltipText(window_, &tooltip_); | 484   aura::client::SetTooltipText(window_, &tooltip_); | 
| 483   aura::client::SetActivationDelegate(window_, this); | 485   aura::client::SetActivationDelegate(window_, this); | 
| 484   aura::client::SetFocusChangeObserver(window_, this); | 486   aura::client::SetFocusChangeObserver(window_, this); | 
| 485   window_->set_layer_owner_delegate(delegated_frame_host_.get()); | 487   window_->set_layer_owner_delegate(delegated_frame_host_.get()); | 
| 486   gfx::Screen::GetScreenFor(window_)->AddObserver(this); | 488   gfx::Screen::GetScreenFor(window_)->AddObserver(this); | 
| 487 | 489 | 
|  | 490   // Let the page-level input event router know about our surface ID | 
|  | 491   // namespace for surface-based hit testing. | 
|  | 492   if (UseSurfacesEnabled() && host_->delegate()->GetInputEventRouter()) { | 
|  | 493     host_->delegate()->GetInputEventRouter()->AddSurfaceIdNamespaceOwner( | 
|  | 494         GetSurfaceIdNamespace(), this); | 
|  | 495   } | 
|  | 496 | 
| 488   bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> | 497   bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> | 
| 489       GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; | 498       GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; | 
| 490   SetOverscrollControllerEnabled(overscroll_enabled); | 499   SetOverscrollControllerEnabled(overscroll_enabled); | 
| 491 | 500 | 
| 492   selection_controller_client_.reset( | 501   selection_controller_client_.reset( | 
| 493       new TouchSelectionControllerClientAura(this)); | 502       new TouchSelectionControllerClientAura(this)); | 
| 494   CreateSelectionController(); | 503   CreateSelectionController(); | 
| 495 } | 504 } | 
| 496 | 505 | 
| 497 //////////////////////////////////////////////////////////////////////////////// | 506 //////////////////////////////////////////////////////////////////////////////// | 
| (...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2083                         DismissOwnedPopups, | 2092                         DismissOwnedPopups, | 
| 2084                         reinterpret_cast<LPARAM>(toplevel_hwnd)); | 2093                         reinterpret_cast<LPARAM>(toplevel_hwnd)); | 
| 2085     } | 2094     } | 
| 2086 #endif | 2095 #endif | 
| 2087     // The Disambiguation popup does not parent itself from this window, so we | 2096     // The Disambiguation popup does not parent itself from this window, so we | 
| 2088     // manually dismiss it. | 2097     // manually dismiss it. | 
| 2089     HideDisambiguationPopup(); | 2098     HideDisambiguationPopup(); | 
| 2090 | 2099 | 
| 2091     blink::WebMouseWheelEvent mouse_wheel_event = | 2100     blink::WebMouseWheelEvent mouse_wheel_event = | 
| 2092         MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); | 2101         MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event)); | 
| 2093     if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) | 2102     if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) { | 
| 2094       host_->ForwardWheelEvent(mouse_wheel_event); | 2103       if (host_->delegate()->GetInputEventRouter()) { | 
|  | 2104         host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( | 
|  | 2105             this, &mouse_wheel_event); | 
|  | 2106       } else { | 
|  | 2107         ProcessMouseWheelEvent(mouse_wheel_event); | 
|  | 2108       } | 
|  | 2109     } | 
| 2095   } else { | 2110   } else { | 
| 2096       bool is_selection_popup = popup_child_host_view_ && | 2111     bool is_selection_popup = | 
| 2097           popup_child_host_view_->NeedsInputGrab(); | 2112         popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab(); | 
| 2098       if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) && | 2113     if (CanRendererHandleEvent(event, mouse_locked_, is_selection_popup) && | 
| 2099           !(event->flags() & ui::EF_FROM_TOUCH)) { | 2114         !(event->flags() & ui::EF_FROM_TOUCH)) { | 
| 2100       // Confirm existing composition text on mouse press, to make sure | 2115       // Confirm existing composition text on mouse press, to make sure | 
| 2101       // the input caret won't be moved with an ongoing composition text. | 2116       // the input caret won't be moved with an ongoing composition text. | 
| 2102       if (event->type() == ui::ET_MOUSE_PRESSED) | 2117       if (event->type() == ui::ET_MOUSE_PRESSED) | 
| 2103         FinishImeCompositionSession(); | 2118         FinishImeCompositionSession(); | 
| 2104 | 2119 | 
| 2105       blink::WebMouseEvent mouse_event = MakeWebMouseEvent(*event); | 2120       blink::WebMouseEvent mouse_event = MakeWebMouseEvent(*event); | 
| 2106       ModifyEventMovementAndCoords(&mouse_event); | 2121       if (host_->delegate()->GetInputEventRouter()) { | 
| 2107       host_->ForwardMouseEvent(mouse_event); | 2122         host_->delegate()->GetInputEventRouter()->RouteMouseEvent(this, | 
|  | 2123                                                                   &mouse_event); | 
|  | 2124       } else { | 
|  | 2125         ProcessMouseEvent(mouse_event); | 
|  | 2126       } | 
|  | 2127 | 
| 2108       // Ensure that we get keyboard focus on mouse down as a plugin window may | 2128       // Ensure that we get keyboard focus on mouse down as a plugin window may | 
| 2109       // have grabbed keyboard focus. | 2129       // have grabbed keyboard focus. | 
| 2110       if (event->type() == ui::ET_MOUSE_PRESSED) | 2130       if (event->type() == ui::ET_MOUSE_PRESSED) | 
| 2111         SetKeyboardFocus(); | 2131         SetKeyboardFocus(); | 
| 2112     } | 2132     } | 
| 2113   } | 2133   } | 
| 2114 | 2134 | 
| 2115   switch (event->type()) { | 2135   switch (event->type()) { | 
| 2116     case ui::ET_MOUSE_PRESSED: | 2136     case ui::ET_MOUSE_PRESSED: | 
| 2117       window_->SetCapture(); | 2137       window_->SetCapture(); | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 2136     window_->parent()->delegate()->OnMouseEvent(event); | 2156     window_->parent()->delegate()->OnMouseEvent(event); | 
| 2137   } | 2157   } | 
| 2138 | 2158 | 
| 2139   if (!IsXButtonUpEvent(event)) | 2159   if (!IsXButtonUpEvent(event)) | 
| 2140     event->SetHandled(); | 2160     event->SetHandled(); | 
| 2141 } | 2161 } | 
| 2142 | 2162 | 
| 2143 uint32_t RenderWidgetHostViewAura::SurfaceIdNamespaceAtPoint( | 2163 uint32_t RenderWidgetHostViewAura::SurfaceIdNamespaceAtPoint( | 
| 2144     const gfx::Point& point, | 2164     const gfx::Point& point, | 
| 2145     gfx::Point* transformed_point) { | 2165     gfx::Point* transformed_point) { | 
| 2146   return cc::SurfaceIdAllocator::NamespaceForId( | 2166   cc::SurfaceId id = | 
| 2147       delegated_frame_host_->SurfaceIdAtPoint(point, transformed_point)); | 2167       delegated_frame_host_->SurfaceIdAtPoint(point, transformed_point); | 
|  | 2168   // It is possible that the renderer has not yet produced a surface, in which | 
|  | 2169   // case we return our current namespace. | 
|  | 2170   if (id.is_null()) | 
|  | 2171     return GetSurfaceIdNamespace(); | 
|  | 2172   return cc::SurfaceIdAllocator::NamespaceForId(id); | 
|  | 2173 } | 
|  | 2174 | 
|  | 2175 void RenderWidgetHostViewAura::ProcessMouseEvent( | 
|  | 2176     const blink::WebMouseEvent& event) { | 
|  | 2177   host_->ForwardMouseEvent(event); | 
|  | 2178 } | 
|  | 2179 | 
|  | 2180 void RenderWidgetHostViewAura::ProcessMouseWheelEvent( | 
|  | 2181     const blink::WebMouseWheelEvent& event) { | 
|  | 2182   host_->ForwardWheelEvent(event); | 
| 2148 } | 2183 } | 
| 2149 | 2184 | 
| 2150 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 2185 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 
| 2151   TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); | 2186   TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); | 
| 2152 | 2187 | 
| 2153   if (event->type() == ui::ET_SCROLL) { | 2188   if (event->type() == ui::ET_SCROLL) { | 
| 2154 #if !defined(OS_WIN) | 2189 #if !defined(OS_WIN) | 
| 2155     // TODO(ananta) | 2190     // TODO(ananta) | 
| 2156     // Investigate if this is true for Windows 8 Metro ASH as well. | 2191     // Investigate if this is true for Windows 8 Metro ASH as well. | 
| 2157     if (event->finger_count() != 2) | 2192     if (event->finger_count() != 2) | 
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2372 | 2407 | 
| 2373   UpdateScreenInfo(window_); | 2408   UpdateScreenInfo(window_); | 
| 2374 } | 2409 } | 
| 2375 | 2410 | 
| 2376 //////////////////////////////////////////////////////////////////////////////// | 2411 //////////////////////////////////////////////////////////////////////////////// | 
| 2377 // RenderWidgetHostViewAura, private: | 2412 // RenderWidgetHostViewAura, private: | 
| 2378 | 2413 | 
| 2379 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 2414 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 
| 2380   selection_controller_.reset(); | 2415   selection_controller_.reset(); | 
| 2381   selection_controller_client_.reset(); | 2416   selection_controller_client_.reset(); | 
|  | 2417 | 
|  | 2418   if (UseSurfacesEnabled() && host_->delegate()->GetInputEventRouter()) { | 
|  | 2419     host_->delegate()->GetInputEventRouter()->RemoveSurfaceIdNamespaceOwner( | 
|  | 2420         GetSurfaceIdNamespace()); | 
|  | 2421   } | 
| 2382   delegated_frame_host_.reset(); | 2422   delegated_frame_host_.reset(); | 
| 2383   window_observer_.reset(); | 2423   window_observer_.reset(); | 
| 2384   if (window_->GetHost()) | 2424   if (window_->GetHost()) | 
| 2385     window_->GetHost()->RemoveObserver(this); | 2425     window_->GetHost()->RemoveObserver(this); | 
| 2386   UnlockMouse(); | 2426   UnlockMouse(); | 
| 2387   if (popup_parent_host_view_) { | 2427   if (popup_parent_host_view_) { | 
| 2388     DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || | 2428     DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || | 
| 2389            popup_parent_host_view_->popup_child_host_view_ == this); | 2429            popup_parent_host_view_->popup_child_host_view_ == this); | 
| 2390     popup_parent_host_view_->popup_child_host_view_ = NULL; | 2430     popup_parent_host_view_->popup_child_host_view_ = NULL; | 
| 2391   } | 2431   } | 
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2837 | 2877 | 
| 2838 //////////////////////////////////////////////////////////////////////////////// | 2878 //////////////////////////////////////////////////////////////////////////////// | 
| 2839 // RenderWidgetHostViewBase, public: | 2879 // RenderWidgetHostViewBase, public: | 
| 2840 | 2880 | 
| 2841 // static | 2881 // static | 
| 2842 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2882 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 
| 2843   GetScreenInfoForWindow(results, NULL); | 2883   GetScreenInfoForWindow(results, NULL); | 
| 2844 } | 2884 } | 
| 2845 | 2885 | 
| 2846 }  // namespace content | 2886 }  // namespace content | 
| OLD | NEW | 
|---|