| 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2554 return gfx::Size(); | 2554 return gfx::Size(); |
| 2555 } | 2555 } |
| 2556 | 2556 |
| 2557 gfx::Size RenderWidgetHostViewAura::GetMaximumSize() const { | 2557 gfx::Size RenderWidgetHostViewAura::GetMaximumSize() const { |
| 2558 return gfx::Size(); | 2558 return gfx::Size(); |
| 2559 } | 2559 } |
| 2560 | 2560 |
| 2561 void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, | 2561 void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, |
| 2562 const gfx::Rect& new_bounds) { | 2562 const gfx::Rect& new_bounds) { |
| 2563 base::AutoReset<bool> in_bounds_changed(&in_bounds_changed_, true); | 2563 base::AutoReset<bool> in_bounds_changed(&in_bounds_changed_, true); |
| 2564 // We care about this only in fullscreen mode, where there is no | 2564 // We care about this whenever RenderWidgetHostViewAura is not owned by a |
| 2565 // WebContentsViewAura. We are sized via SetSize() or SetBounds() by | 2565 // WebContentsViewAura since changes to the Window's bounds need to be |
| 2566 // WebContentsViewAura in other cases. | 2566 // messaged to the renderer. WebContentsViewAura invokes SetSize() or |
| 2567 if (is_fullscreen_) | 2567 // SetBounds() itself. No matter how we got here, any redundant calls are |
| 2568 SetSize(new_bounds.size()); | 2568 // harmless. |
| 2569 SetSize(new_bounds.size()); |
| 2569 } | 2570 } |
| 2570 | 2571 |
| 2571 gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) { | 2572 gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) { |
| 2572 if (mouse_locked_) | 2573 if (mouse_locked_) |
| 2573 return ui::kCursorNone; | 2574 return ui::kCursorNone; |
| 2574 return current_cursor_.GetNativeCursor(); | 2575 return current_cursor_.GetNativeCursor(); |
| 2575 } | 2576 } |
| 2576 | 2577 |
| 2577 int RenderWidgetHostViewAura::GetNonClientComponent( | 2578 int RenderWidgetHostViewAura::GetNonClientComponent( |
| 2578 const gfx::Point& point) const { | 2579 const gfx::Point& point) const { |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2905 // the input caret won't be moved with an ongoing composition text. | 2906 // the input caret won't be moved with an ongoing composition text. |
| 2906 FinishImeCompositionSession(); | 2907 FinishImeCompositionSession(); |
| 2907 break; | 2908 break; |
| 2908 case ui::ET_MOUSE_RELEASED: | 2909 case ui::ET_MOUSE_RELEASED: |
| 2909 window_->ReleaseCapture(); | 2910 window_->ReleaseCapture(); |
| 2910 break; | 2911 break; |
| 2911 default: | 2912 default: |
| 2912 break; | 2913 break; |
| 2913 } | 2914 } |
| 2914 | 2915 |
| 2915 // Needed to propagate mouse event to native_tab_contents_view_aura. | 2916 // Needed to propagate mouse event to |window_->parent()->delegate()|, but |
| 2917 // note that it might be something other than a WebContentsViewAura instance. |
| 2916 // TODO(pkotwicz): Find a better way of doing this. | 2918 // TODO(pkotwicz): Find a better way of doing this. |
| 2917 // In fullscreen mode which is typically used by flash, don't forward | 2919 // In fullscreen mode which is typically used by flash, don't forward |
| 2918 // the mouse events to the parent. The renderer and the plugin process | 2920 // the mouse events to the parent. The renderer and the plugin process |
| 2919 // handle these events. | 2921 // handle these events. |
| 2920 if (!is_fullscreen_ && window_->parent()->delegate() && | 2922 if (!is_fullscreen_ && window_->parent()->delegate() && |
| 2921 !(event->flags() & ui::EF_FROM_TOUCH)) | 2923 !(event->flags() & ui::EF_FROM_TOUCH)) { |
| 2924 event->ConvertLocationToTarget(window_, window_->parent()); |
| 2922 window_->parent()->delegate()->OnMouseEvent(event); | 2925 window_->parent()->delegate()->OnMouseEvent(event); |
| 2926 } |
| 2923 | 2927 |
| 2924 if (!IsXButtonUpEvent(event)) | 2928 if (!IsXButtonUpEvent(event)) |
| 2925 event->SetHandled(); | 2929 event->SetHandled(); |
| 2926 } | 2930 } |
| 2927 | 2931 |
| 2928 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { | 2932 void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { |
| 2929 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); | 2933 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnScrollEvent"); |
| 2930 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | 2934 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) |
| 2931 return; | 2935 return; |
| 2932 | 2936 |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3566 RenderWidgetHost* widget) { | 3570 RenderWidgetHost* widget) { |
| 3567 return new RenderWidgetHostViewAura(widget); | 3571 return new RenderWidgetHostViewAura(widget); |
| 3568 } | 3572 } |
| 3569 | 3573 |
| 3570 // static | 3574 // static |
| 3571 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3575 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3572 GetScreenInfoForWindow(results, NULL); | 3576 GetScreenInfoForWindow(results, NULL); |
| 3573 } | 3577 } |
| 3574 | 3578 |
| 3575 } // namespace content | 3579 } // namespace content |
| OLD | NEW |