| 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/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "content/browser/renderer_host/dip_util.h" | 10 #include "content/browser/renderer_host/dip_util.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool ShouldNavigateBack(const NavigationController& controller, | 92 bool ShouldNavigateBack(const NavigationController& controller, |
| 93 OverscrollMode mode) { | 93 OverscrollMode mode) { |
| 94 return mode == (base::i18n::IsRTL() ? OVERSCROLL_WEST : OVERSCROLL_EAST) && | 94 return mode == (base::i18n::IsRTL() ? OVERSCROLL_WEST : OVERSCROLL_EAST) && |
| 95 controller.CanGoBack(); | 95 controller.CanGoBack(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 RenderWidgetHostViewAura* ToRenderWidgetHostViewAura( | 98 RenderWidgetHostViewAura* ToRenderWidgetHostViewAura( |
| 99 RenderWidgetHostView* view) { | 99 RenderWidgetHostView* view) { |
| 100 if (RenderViewHostFactory::has_factory()) | 100 if (!view || RenderViewHostFactory::has_factory()) |
| 101 return NULL; // Can't cast to RenderWidgetHostViewAura in unit tests. | 101 return NULL; // Can't cast to RenderWidgetHostViewAura in unit tests. |
| 102 RenderProcessHostImpl* process = static_cast<RenderProcessHostImpl*>( |
| 103 view->GetRenderWidgetHost()->GetProcess()); |
| 104 if (process->IsGuest()) |
| 105 return NULL; |
| 102 return static_cast<RenderWidgetHostViewAura*>(view); | 106 return static_cast<RenderWidgetHostViewAura*>(view); |
| 103 } | 107 } |
| 104 | 108 |
| 105 // The window delegate for the overscroll window. This redirects trackpad events | 109 // The window delegate for the overscroll window. This redirects trackpad events |
| 106 // to the web-contents window. The delegate destroys itself when the window is | 110 // to the web-contents window. The delegate destroys itself when the window is |
| 107 // destroyed. | 111 // destroyed. |
| 108 class OverscrollWindowDelegate : public aura::WindowDelegate { | 112 class OverscrollWindowDelegate : public aura::WindowDelegate { |
| 109 public: | 113 public: |
| 110 OverscrollWindowDelegate(WebContentsImpl* web_contents, | 114 OverscrollWindowDelegate(WebContentsImpl* web_contents, |
| 111 OverscrollMode overscroll_mode) | 115 OverscrollMode overscroll_mode) |
| (...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1693 event.location(), | 1697 event.location(), |
| 1694 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1698 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
| 1695 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1699 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
| 1696 if (drag_dest_delegate_) | 1700 if (drag_dest_delegate_) |
| 1697 drag_dest_delegate_->OnDrop(); | 1701 drag_dest_delegate_->OnDrop(); |
| 1698 current_drop_data_.reset(); | 1702 current_drop_data_.reset(); |
| 1699 return current_drag_op_; | 1703 return current_drag_op_; |
| 1700 } | 1704 } |
| 1701 | 1705 |
| 1702 } // namespace content | 1706 } // namespace content |
| OLD | NEW |