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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
27 #include "content/public/browser/notification_types.h" | 27 #include "content/public/browser/notification_types.h" |
28 #include "content/public/browser/overscroll_configuration.h" | 28 #include "content/public/browser/overscroll_configuration.h" |
29 #include "content/public/browser/render_view_host.h" | 29 #include "content/public/browser/render_view_host.h" |
30 #include "content/public/browser/render_widget_host.h" | 30 #include "content/public/browser/render_widget_host.h" |
31 #include "content/public/browser/render_widget_host_view.h" | 31 #include "content/public/browser/render_widget_host_view.h" |
32 #include "content/public/browser/web_contents_delegate.h" | 32 #include "content/public/browser/web_contents_delegate.h" |
33 #include "content/public/browser/web_contents_observer.h" | 33 #include "content/public/browser/web_contents_observer.h" |
34 #include "content/public/browser/web_contents_view_delegate.h" | 34 #include "content/public/browser/web_contents_view_delegate.h" |
35 #include "content/public/browser/web_drag_dest_delegate.h" | 35 #include "content/public/browser/web_drag_dest_delegate.h" |
36 #include "content/public/common/content_switches.h" | 36 #include "content/public/common/content_switches_util.h" |
37 #include "content/public/common/drop_data.h" | 37 #include "content/public/common/drop_data.h" |
38 #include "net/base/net_util.h" | 38 #include "net/base/net_util.h" |
39 #include "third_party/WebKit/public/web/WebInputEvent.h" | 39 #include "third_party/WebKit/public/web/WebInputEvent.h" |
40 #include "ui/aura/client/aura_constants.h" | 40 #include "ui/aura/client/aura_constants.h" |
41 #include "ui/aura/client/drag_drop_client.h" | 41 #include "ui/aura/client/drag_drop_client.h" |
42 #include "ui/aura/client/drag_drop_delegate.h" | 42 #include "ui/aura/client/drag_drop_delegate.h" |
43 #include "ui/aura/client/window_tree_client.h" | 43 #include "ui/aura/client/window_tree_client.h" |
44 #include "ui/aura/env.h" | 44 #include "ui/aura/env.h" |
45 #include "ui/aura/root_window.h" | 45 #include "ui/aura/root_window.h" |
46 #include "ui/aura/root_window_observer.h" | 46 #include "ui/aura/root_window_observer.h" |
(...skipping 21 matching lines...) Expand all Loading... |
68 WebContentsImpl* web_contents, | 68 WebContentsImpl* web_contents, |
69 WebContentsViewDelegate* delegate, | 69 WebContentsViewDelegate* delegate, |
70 RenderViewHostDelegateView** render_view_host_delegate_view) { | 70 RenderViewHostDelegateView** render_view_host_delegate_view) { |
71 WebContentsViewAura* rv = new WebContentsViewAura(web_contents, delegate); | 71 WebContentsViewAura* rv = new WebContentsViewAura(web_contents, delegate); |
72 *render_view_host_delegate_view = rv; | 72 *render_view_host_delegate_view = rv; |
73 return rv; | 73 return rv; |
74 } | 74 } |
75 | 75 |
76 namespace { | 76 namespace { |
77 | 77 |
78 bool IsScrollEndEffectEnabled() { | |
79 return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
80 switches::kScrollEndEffect) == "1"; | |
81 } | |
82 | |
83 bool ShouldNavigateForward(const NavigationController& controller, | 78 bool ShouldNavigateForward(const NavigationController& controller, |
84 OverscrollMode mode) { | 79 OverscrollMode mode) { |
85 return mode == (base::i18n::IsRTL() ? OVERSCROLL_EAST : OVERSCROLL_WEST) && | 80 return mode == (base::i18n::IsRTL() ? OVERSCROLL_EAST : OVERSCROLL_WEST) && |
86 controller.CanGoForward(); | 81 controller.CanGoForward(); |
87 } | 82 } |
88 | 83 |
89 bool ShouldNavigateBack(const NavigationController& controller, | 84 bool ShouldNavigateBack(const NavigationController& controller, |
90 OverscrollMode mode) { | 85 OverscrollMode mode) { |
91 return mode == (base::i18n::IsRTL() ? OVERSCROLL_WEST : OVERSCROLL_EAST) && | 86 return mode == (base::i18n::IsRTL() ? OVERSCROLL_WEST : OVERSCROLL_EAST) && |
92 controller.CanGoBack(); | 87 controller.CanGoBack(); |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 | 1040 |
1046 void WebContentsViewAura::AttachTouchEditableToRenderView() { | 1041 void WebContentsViewAura::AttachTouchEditableToRenderView() { |
1047 if (!touch_editable_) | 1042 if (!touch_editable_) |
1048 return; | 1043 return; |
1049 RenderWidgetHostViewAura* rwhva = ToRenderWidgetHostViewAura( | 1044 RenderWidgetHostViewAura* rwhva = ToRenderWidgetHostViewAura( |
1050 web_contents_->GetRenderWidgetHostView()); | 1045 web_contents_->GetRenderWidgetHostView()); |
1051 touch_editable_->AttachToView(rwhva); | 1046 touch_editable_->AttachToView(rwhva); |
1052 } | 1047 } |
1053 | 1048 |
1054 void WebContentsViewAura::OverscrollUpdateForWebContentsDelegate(int delta_y) { | 1049 void WebContentsViewAura::OverscrollUpdateForWebContentsDelegate(int delta_y) { |
1055 if (web_contents_->GetDelegate() && IsScrollEndEffectEnabled()) | 1050 if (web_contents_->GetDelegate() && switches::IsScrollEndEffectEnabled()) |
1056 web_contents_->GetDelegate()->OverscrollUpdate(delta_y); | 1051 web_contents_->GetDelegate()->OverscrollUpdate(delta_y); |
1057 } | 1052 } |
1058 | 1053 |
1059 //////////////////////////////////////////////////////////////////////////////// | 1054 //////////////////////////////////////////////////////////////////////////////// |
1060 // WebContentsViewAura, WebContentsView implementation: | 1055 // WebContentsViewAura, WebContentsView implementation: |
1061 | 1056 |
1062 gfx::NativeView WebContentsViewAura::GetNativeView() const { | 1057 gfx::NativeView WebContentsViewAura::GetNativeView() const { |
1063 return window_.get(); | 1058 return window_.get(); |
1064 } | 1059 } |
1065 | 1060 |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 event.location(), | 1641 event.location(), |
1647 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1642 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
1648 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1643 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1649 if (drag_dest_delegate_) | 1644 if (drag_dest_delegate_) |
1650 drag_dest_delegate_->OnDrop(); | 1645 drag_dest_delegate_->OnDrop(); |
1651 current_drop_data_.reset(); | 1646 current_drop_data_.reset(); |
1652 return current_drag_op_; | 1647 return current_drag_op_; |
1653 } | 1648 } |
1654 | 1649 |
1655 } // namespace content | 1650 } // namespace content |
OLD | NEW |