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/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 12 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
13 #include "content/browser/download/drag_download_util.h" | 13 #include "content/browser/download/drag_download_util.h" |
14 #include "content/browser/frame_host/interstitial_page_impl.h" | 14 #include "content/browser/frame_host/interstitial_page_impl.h" |
15 #include "content/browser/frame_host/navigation_entry_impl.h" | 15 #include "content/browser/frame_host/navigation_entry_impl.h" |
16 #include "content/browser/renderer_host/dip_util.h" | 16 #include "content/browser/renderer_host/dip_util.h" |
17 #include "content/browser/renderer_host/overscroll_controller.h" | 17 #include "content/browser/renderer_host/overscroll_controller.h" |
18 #include "content/browser/renderer_host/render_view_host_factory.h" | 18 #include "content/browser/renderer_host/render_view_host_factory.h" |
19 #include "content/browser/renderer_host/render_view_host_impl.h" | 19 #include "content/browser/renderer_host/render_view_host_impl.h" |
20 #include "content/browser/renderer_host/render_widget_host_impl.h" | 20 #include "content/browser/renderer_host/render_widget_host_impl.h" |
21 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 21 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
22 #include "content/browser/renderer_host/web_input_event_aura.h" | 22 #include "content/browser/renderer_host/web_input_event_aura.h" |
23 #include "content/browser/web_contents/aura/gesture_nav_simple.h" | 23 #include "content/browser/web_contents/aura/gesture_nav_simple.h" |
24 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" | 24 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" |
25 #include "content/browser/web_contents/aura/shadow_layer_delegate.h" | 25 #include "content/browser/web_contents/aura/shadow_layer_delegate.h" |
26 #include "content/browser/web_contents/aura/window_slider.h" | 26 #include "content/browser/web_contents/aura/window_slider.h" |
27 #include "content/browser/web_contents/touch_editable_impl_aura.h" | 27 #include "content/browser/web_contents/touch_selection_controller_aura_client_im pl.h" |
28 #include "content/browser/web_contents/web_contents_impl.h" | 28 #include "content/browser/web_contents/web_contents_impl.h" |
29 #include "content/public/browser/content_browser_client.h" | 29 #include "content/public/browser/content_browser_client.h" |
30 #include "content/public/browser/notification_observer.h" | 30 #include "content/public/browser/notification_observer.h" |
31 #include "content/public/browser/notification_registrar.h" | 31 #include "content/public/browser/notification_registrar.h" |
32 #include "content/public/browser/notification_source.h" | 32 #include "content/public/browser/notification_source.h" |
33 #include "content/public/browser/notification_types.h" | 33 #include "content/public/browser/notification_types.h" |
34 #include "content/public/browser/overscroll_configuration.h" | 34 #include "content/public/browser/overscroll_configuration.h" |
35 #include "content/public/browser/render_view_host.h" | 35 #include "content/public/browser/render_view_host.h" |
36 #include "content/public/browser/render_widget_host.h" | 36 #include "content/public/browser/render_widget_host.h" |
37 #include "content/public/browser/render_widget_host_view.h" | 37 #include "content/public/browser/render_widget_host_view.h" |
(...skipping 23 matching lines...) Expand all Loading... | |
61 #include "ui/base/hit_test.h" | 61 #include "ui/base/hit_test.h" |
62 #include "ui/compositor/layer.h" | 62 #include "ui/compositor/layer.h" |
63 #include "ui/compositor/scoped_layer_animation_settings.h" | 63 #include "ui/compositor/scoped_layer_animation_settings.h" |
64 #include "ui/events/event.h" | 64 #include "ui/events/event.h" |
65 #include "ui/events/event_utils.h" | 65 #include "ui/events/event_utils.h" |
66 #include "ui/gfx/canvas.h" | 66 #include "ui/gfx/canvas.h" |
67 #include "ui/gfx/image/image.h" | 67 #include "ui/gfx/image/image.h" |
68 #include "ui/gfx/image/image_png_rep.h" | 68 #include "ui/gfx/image/image_png_rep.h" |
69 #include "ui/gfx/image/image_skia.h" | 69 #include "ui/gfx/image/image_skia.h" |
70 #include "ui/gfx/screen.h" | 70 #include "ui/gfx/screen.h" |
71 #include "ui/touch_selection/touch_selection_controller_aura.h" | |
71 #include "ui/wm/public/drag_drop_client.h" | 72 #include "ui/wm/public/drag_drop_client.h" |
72 #include "ui/wm/public/drag_drop_delegate.h" | 73 #include "ui/wm/public/drag_drop_delegate.h" |
73 | 74 |
74 namespace content { | 75 namespace content { |
75 WebContentsView* CreateWebContentsView( | 76 WebContentsView* CreateWebContentsView( |
76 WebContentsImpl* web_contents, | 77 WebContentsImpl* web_contents, |
77 WebContentsViewDelegate* delegate, | 78 WebContentsViewDelegate* delegate, |
78 RenderViewHostDelegateView** render_view_host_delegate_view) { | 79 RenderViewHostDelegateView** render_view_host_delegate_view) { |
79 WebContentsViewAura* rv = new WebContentsViewAura(web_contents, delegate); | 80 WebContentsViewAura* rv = new WebContentsViewAura(web_contents, delegate); |
80 *render_view_host_delegate_view = rv; | 81 *render_view_host_delegate_view = rv; |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
609 } | 610 } |
610 #endif | 611 #endif |
611 } | 612 } |
612 } | 613 } |
613 | 614 |
614 void OnWindowBoundsChanged(aura::Window* window, | 615 void OnWindowBoundsChanged(aura::Window* window, |
615 const gfx::Rect& old_bounds, | 616 const gfx::Rect& old_bounds, |
616 const gfx::Rect& new_bounds) override { | 617 const gfx::Rect& new_bounds) override { |
617 if (window == host_window_ || window == view_->window_) { | 618 if (window == host_window_ || window == view_->window_) { |
618 SendScreenRects(); | 619 SendScreenRects(); |
619 if (view_->touch_editable_) | 620 if (old_bounds.origin() != new_bounds.origin()) { |
620 view_->touch_editable_->UpdateEditingController(); | 621 ui::TouchSelectionControllerAura* selection_controller = |
622 view_->GetSelectionController(); | |
623 if (selection_controller) | |
624 selection_controller->OnWindowMoved(); | |
625 } | |
621 #if defined(OS_WIN) | 626 #if defined(OS_WIN) |
622 } else { | 627 } else { |
623 UpdateConstrainedWindows(NULL); | 628 UpdateConstrainedWindows(NULL); |
624 #endif | 629 #endif |
625 } | 630 } |
626 } | 631 } |
627 | 632 |
628 void OnWindowDestroying(aura::Window* window) override { | 633 void OnWindowDestroying(aura::Window* window) override { |
629 if (window == host_window_) { | 634 if (window == host_window_) { |
630 host_window_->RemoveObserver(this); | 635 host_window_->RemoveObserver(this); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
729 WebContentsImpl* web_contents, | 734 WebContentsImpl* web_contents, |
730 WebContentsViewDelegate* delegate) | 735 WebContentsViewDelegate* delegate) |
731 : web_contents_(web_contents), | 736 : web_contents_(web_contents), |
732 delegate_(delegate), | 737 delegate_(delegate), |
733 current_drag_op_(blink::WebDragOperationNone), | 738 current_drag_op_(blink::WebDragOperationNone), |
734 drag_dest_delegate_(NULL), | 739 drag_dest_delegate_(NULL), |
735 current_rvh_for_drag_(NULL), | 740 current_rvh_for_drag_(NULL), |
736 overscroll_change_brightness_(false), | 741 overscroll_change_brightness_(false), |
737 current_overscroll_gesture_(OVERSCROLL_NONE), | 742 current_overscroll_gesture_(OVERSCROLL_NONE), |
738 completed_overscroll_gesture_(OVERSCROLL_NONE), | 743 completed_overscroll_gesture_(OVERSCROLL_NONE), |
739 touch_editable_(TouchEditableImplAura::Create()), | |
740 is_or_was_visible_(false) { | 744 is_or_was_visible_(false) { |
741 } | 745 } |
742 | 746 |
743 //////////////////////////////////////////////////////////////////////////////// | 747 //////////////////////////////////////////////////////////////////////////////// |
744 // WebContentsViewAura, private: | 748 // WebContentsViewAura, private: |
745 | 749 |
746 WebContentsViewAura::~WebContentsViewAura() { | 750 WebContentsViewAura::~WebContentsViewAura() { |
747 if (!window_) | 751 if (!window_) |
748 return; | 752 return; |
749 | 753 |
750 window_observer_.reset(); | 754 window_observer_.reset(); |
751 window_->RemoveObserver(this); | 755 window_->RemoveObserver(this); |
752 | 756 |
753 // Window needs a valid delegate during its destructor, so we explicitly | 757 // Window needs a valid delegate during its destructor, so we explicitly |
754 // delete it here. | 758 // delete it here. |
755 window_.reset(); | 759 window_.reset(); |
756 } | 760 } |
757 | 761 |
758 void WebContentsViewAura::SetTouchEditableForTest( | |
759 TouchEditableImplAura* touch_editable) { | |
760 touch_editable_.reset(touch_editable); | |
761 AttachTouchEditableToRenderView(); | |
762 } | |
763 | |
764 void WebContentsViewAura::SizeChangedCommon(const gfx::Size& size) { | 762 void WebContentsViewAura::SizeChangedCommon(const gfx::Size& size) { |
765 if (web_contents_->GetInterstitialPage()) | 763 if (web_contents_->GetInterstitialPage()) |
766 web_contents_->GetInterstitialPage()->SetSize(size); | 764 web_contents_->GetInterstitialPage()->SetSize(size); |
767 RenderWidgetHostView* rwhv = | 765 RenderWidgetHostView* rwhv = |
768 web_contents_->GetRenderWidgetHostView(); | 766 web_contents_->GetRenderWidgetHostView(); |
769 if (rwhv) | 767 if (rwhv) |
770 rwhv->SetSize(size); | 768 rwhv->SetSize(size); |
771 } | 769 } |
772 | 770 |
773 void WebContentsViewAura::EndDrag(blink::WebDragOperationsMask ops) { | 771 void WebContentsViewAura::EndDrag(blink::WebDragOperationsMask ops) { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
967 ratio = 1.f - ratio; | 965 ratio = 1.f - ratio; |
968 float brightness = current_overscroll_gesture_ == OVERSCROLL_WEST ? | 966 float brightness = current_overscroll_gesture_ == OVERSCROLL_WEST ? |
969 kBrightnessMin + ratio * (kBrightnessMax - kBrightnessMin) : | 967 kBrightnessMin + ratio * (kBrightnessMax - kBrightnessMin) : |
970 kBrightnessMax - ratio * (kBrightnessMax - kBrightnessMin); | 968 kBrightnessMax - ratio * (kBrightnessMax - kBrightnessMin); |
971 brightness = std::max(kBrightnessMin, brightness); | 969 brightness = std::max(kBrightnessMin, brightness); |
972 brightness = std::min(kBrightnessMax, brightness); | 970 brightness = std::min(kBrightnessMax, brightness); |
973 aura::Window* window = GetWindowToAnimateForOverscroll(); | 971 aura::Window* window = GetWindowToAnimateForOverscroll(); |
974 window->layer()->SetLayerBrightness(brightness); | 972 window->layer()->SetLayerBrightness(brightness); |
975 } | 973 } |
976 | 974 |
977 void WebContentsViewAura::AttachTouchEditableToRenderView() { | |
978 if (!touch_editable_) | |
979 return; | |
980 RenderWidgetHostViewAura* rwhva = ToRenderWidgetHostViewAura( | |
981 web_contents_->GetRenderWidgetHostView()); | |
982 touch_editable_->AttachToView(rwhva); | |
983 } | |
984 | |
985 void WebContentsViewAura::OverscrollUpdateForWebContentsDelegate( | 975 void WebContentsViewAura::OverscrollUpdateForWebContentsDelegate( |
986 float delta_y) { | 976 float delta_y) { |
987 if (web_contents_->GetDelegate() && IsScrollEndEffectEnabled()) | 977 if (web_contents_->GetDelegate() && IsScrollEndEffectEnabled()) |
988 web_contents_->GetDelegate()->OverscrollUpdate(delta_y); | 978 web_contents_->GetDelegate()->OverscrollUpdate(delta_y); |
989 } | 979 } |
990 | 980 |
981 ui::TouchSelectionControllerAura* | |
982 WebContentsViewAura::GetSelectionController() { | |
983 RenderWidgetHostViewAura* view = | |
984 ToRenderWidgetHostViewAura(web_contents_->GetRenderWidgetHostView()); | |
985 return view ? view->selection_controller() : nullptr; | |
986 } | |
987 | |
991 //////////////////////////////////////////////////////////////////////////////// | 988 //////////////////////////////////////////////////////////////////////////////// |
992 // WebContentsViewAura, WebContentsView implementation: | 989 // WebContentsViewAura, WebContentsView implementation: |
993 | 990 |
994 gfx::NativeView WebContentsViewAura::GetNativeView() const { | 991 gfx::NativeView WebContentsViewAura::GetNativeView() const { |
995 return window_.get(); | 992 return window_.get(); |
996 } | 993 } |
997 | 994 |
998 gfx::NativeView WebContentsViewAura::GetContentNativeView() const { | 995 gfx::NativeView WebContentsViewAura::GetContentNativeView() const { |
999 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); | 996 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
1000 return rwhv ? rwhv->GetNativeView() : NULL; | 997 return rwhv ? rwhv->GetNativeView() : NULL; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1120 // this actually is happening (and somebody isn't accidentally creating the | 1117 // this actually is happening (and somebody isn't accidentally creating the |
1121 // view twice), we check for the RVH Factory, which will be set when we're | 1118 // view twice), we check for the RVH Factory, which will be set when we're |
1122 // making special ones (which go along with the special views). | 1119 // making special ones (which go along with the special views). |
1123 DCHECK(RenderViewHostFactory::has_factory()); | 1120 DCHECK(RenderViewHostFactory::has_factory()); |
1124 return static_cast<RenderWidgetHostViewBase*>( | 1121 return static_cast<RenderWidgetHostViewBase*>( |
1125 render_widget_host->GetView()); | 1122 render_widget_host->GetView()); |
1126 } | 1123 } |
1127 | 1124 |
1128 RenderWidgetHostViewAura* view = | 1125 RenderWidgetHostViewAura* view = |
1129 new RenderWidgetHostViewAura(render_widget_host, is_guest_view_hack); | 1126 new RenderWidgetHostViewAura(render_widget_host, is_guest_view_hack); |
1127 TouchSelectionControllerAuraClientImpl* selection_controller_client = | |
1128 new TouchSelectionControllerAuraClientImpl(view); | |
1129 view->InitSelectionController(selection_controller_client); | |
sadrul
2015/03/05 12:37:03
Why can't RWHVA itself create this?
mfomitchev
2015/03/05 16:07:54
Because TouchSelectionControllerAuraClientImpl is
| |
1130 | |
1130 view->InitAsChild(NULL); | 1131 view->InitAsChild(NULL); |
1131 GetNativeView()->AddChild(view->GetNativeView()); | 1132 GetNativeView()->AddChild(view->GetNativeView()); |
1132 | 1133 |
1133 if (navigation_overlay_.get() && navigation_overlay_->has_window()) { | 1134 if (navigation_overlay_.get() && navigation_overlay_->has_window()) { |
1134 navigation_overlay_->StartObserving(); | 1135 navigation_overlay_->StartObserving(); |
1135 } | 1136 } |
1136 | 1137 |
1137 RenderWidgetHostImpl* host_impl = | 1138 RenderWidgetHostImpl* host_impl = |
1138 RenderWidgetHostImpl::From(render_widget_host); | 1139 RenderWidgetHostImpl::From(render_widget_host); |
1139 | 1140 |
1140 if (!host_impl->is_hidden()) | 1141 if (!host_impl->is_hidden()) |
1141 view->Show(); | 1142 view->Show(); |
1142 | 1143 |
1143 // We listen to drag drop events in the newly created view's window. | 1144 // We listen to drag drop events in the newly created view's window. |
1144 aura::client::SetDragDropDelegate(view->GetNativeView(), this); | 1145 aura::client::SetDragDropDelegate(view->GetNativeView(), this); |
1145 | 1146 |
1146 if (view->overscroll_controller() && | 1147 if (view->overscroll_controller() && |
1147 (!web_contents_->GetDelegate() || | 1148 (!web_contents_->GetDelegate() || |
1148 web_contents_->GetDelegate()->CanOverscrollContent())) { | 1149 web_contents_->GetDelegate()->CanOverscrollContent())) { |
1149 InstallOverscrollControllerDelegate(view); | 1150 InstallOverscrollControllerDelegate(view); |
1150 } | 1151 } |
1151 | 1152 |
1152 AttachTouchEditableToRenderView(); | |
1153 return view; | 1153 return view; |
1154 } | 1154 } |
1155 | 1155 |
1156 RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForPopupWidget( | 1156 RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForPopupWidget( |
1157 RenderWidgetHost* render_widget_host) { | 1157 RenderWidgetHost* render_widget_host) { |
1158 return new RenderWidgetHostViewAura(render_widget_host, false); | 1158 return new RenderWidgetHostViewAura(render_widget_host, false); |
1159 } | 1159 } |
1160 | 1160 |
1161 void WebContentsViewAura::SetPageTitle(const base::string16& title) { | 1161 void WebContentsViewAura::SetPageTitle(const base::string16& title) { |
1162 window_->SetTitle(title); | 1162 window_->SetTitle(title); |
1163 } | 1163 } |
1164 | 1164 |
1165 void WebContentsViewAura::RenderViewCreated(RenderViewHost* host) { | 1165 void WebContentsViewAura::RenderViewCreated(RenderViewHost* host) { |
1166 } | 1166 } |
1167 | 1167 |
1168 void WebContentsViewAura::RenderViewSwappedIn(RenderViewHost* host) { | 1168 void WebContentsViewAura::RenderViewSwappedIn(RenderViewHost* host) { |
1169 if (navigation_overlay_.get() && navigation_overlay_->has_window()) | 1169 if (navigation_overlay_.get() && navigation_overlay_->has_window()) |
1170 navigation_overlay_->StartObserving(); | 1170 navigation_overlay_->StartObserving(); |
1171 AttachTouchEditableToRenderView(); | |
1172 } | 1171 } |
1173 | 1172 |
1174 void WebContentsViewAura::SetOverscrollControllerEnabled(bool enabled) { | 1173 void WebContentsViewAura::SetOverscrollControllerEnabled(bool enabled) { |
1175 RenderWidgetHostViewAura* view = | 1174 RenderWidgetHostViewAura* view = |
1176 ToRenderWidgetHostViewAura(web_contents_->GetRenderWidgetHostView()); | 1175 ToRenderWidgetHostViewAura(web_contents_->GetRenderWidgetHostView()); |
1177 if (view) { | 1176 if (view) { |
1178 view->SetOverscrollControllerEnabled(enabled); | 1177 view->SetOverscrollControllerEnabled(enabled); |
1179 if (enabled) | 1178 if (enabled) |
1180 InstallOverscrollControllerDelegate(view); | 1179 InstallOverscrollControllerDelegate(view); |
1181 } | 1180 } |
1182 | 1181 |
1183 if (!enabled) | 1182 if (!enabled) |
1184 navigation_overlay_.reset(); | 1183 navigation_overlay_.reset(); |
1185 else if (!navigation_overlay_) | 1184 else if (!navigation_overlay_) |
1186 navigation_overlay_.reset(new OverscrollNavigationOverlay(web_contents_)); | 1185 navigation_overlay_.reset(new OverscrollNavigationOverlay(web_contents_)); |
1187 } | 1186 } |
1188 | 1187 |
1189 //////////////////////////////////////////////////////////////////////////////// | 1188 //////////////////////////////////////////////////////////////////////////////// |
1190 // WebContentsViewAura, RenderViewHostDelegateView implementation: | 1189 // WebContentsViewAura, RenderViewHostDelegateView implementation: |
1191 | 1190 |
1192 void WebContentsViewAura::ShowContextMenu(RenderFrameHost* render_frame_host, | 1191 void WebContentsViewAura::ShowContextMenu(RenderFrameHost* render_frame_host, |
1193 const ContextMenuParams& params) { | 1192 const ContextMenuParams& params) { |
1194 if (touch_editable_) { | 1193 ui::TouchSelectionControllerAura* selection_controller = |
1195 touch_editable_->EndTouchEditing(false); | 1194 GetSelectionController(); |
1196 } | 1195 if (selection_controller) |
1196 selection_controller->HideAndDisallowShowingAutomatically(); | |
1197 if (delegate_) { | 1197 if (delegate_) { |
1198 delegate_->ShowContextMenu(render_frame_host, params); | 1198 delegate_->ShowContextMenu(render_frame_host, params); |
1199 // WARNING: we may have been deleted during the call to ShowContextMenu(). | 1199 // WARNING: we may have been deleted during the call to ShowContextMenu(). |
1200 } | 1200 } |
1201 } | 1201 } |
1202 | 1202 |
1203 void WebContentsViewAura::StartDragging( | 1203 void WebContentsViewAura::StartDragging( |
1204 const DropData& drop_data, | 1204 const DropData& drop_data, |
1205 blink::WebDragOperationsMask operations, | 1205 blink::WebDragOperationsMask operations, |
1206 const gfx::ImageSkia& image, | 1206 const gfx::ImageSkia& image, |
1207 const gfx::Vector2d& image_offset, | 1207 const gfx::Vector2d& image_offset, |
1208 const DragEventSourceInfo& event_info) { | 1208 const DragEventSourceInfo& event_info) { |
1209 aura::Window* root_window = GetNativeView()->GetRootWindow(); | 1209 aura::Window* root_window = GetNativeView()->GetRootWindow(); |
1210 if (!aura::client::GetDragDropClient(root_window)) { | 1210 if (!aura::client::GetDragDropClient(root_window)) { |
1211 web_contents_->SystemDragEnded(); | 1211 web_contents_->SystemDragEnded(); |
1212 return; | 1212 return; |
1213 } | 1213 } |
1214 | 1214 |
1215 if (touch_editable_) | 1215 ui::TouchSelectionControllerAura* selection_controller = |
1216 touch_editable_->EndTouchEditing(false); | 1216 GetSelectionController(); |
1217 | 1217 if (selection_controller) |
1218 selection_controller->HideAndDisallowShowingAutomatically(); | |
1218 ui::OSExchangeData::Provider* provider = ui::OSExchangeData::CreateProvider(); | 1219 ui::OSExchangeData::Provider* provider = ui::OSExchangeData::CreateProvider(); |
1219 PrepareDragData(drop_data, provider, web_contents_); | 1220 PrepareDragData(drop_data, provider, web_contents_); |
1220 | 1221 |
1221 ui::OSExchangeData data(provider); // takes ownership of |provider|. | 1222 ui::OSExchangeData data(provider); // takes ownership of |provider|. |
1222 | 1223 |
1223 if (!image.isNull()) | 1224 if (!image.isNull()) |
1224 drag_utils::SetDragImageOnDataObject(image, image_offset, &data); | 1225 drag_utils::SetDragImageOnDataObject(image, image_offset, &data); |
1225 | 1226 |
1226 scoped_ptr<WebDragSourceAura> drag_source( | 1227 scoped_ptr<WebDragSourceAura> drag_source( |
1227 new WebDragSourceAura(GetNativeView(), web_contents_)); | 1228 new WebDragSourceAura(GetNativeView(), web_contents_)); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1339 } | 1340 } |
1340 | 1341 |
1341 void WebContentsViewAura::OnOverscrollModeChange(OverscrollMode old_mode, | 1342 void WebContentsViewAura::OnOverscrollModeChange(OverscrollMode old_mode, |
1342 OverscrollMode new_mode) { | 1343 OverscrollMode new_mode) { |
1343 // Reset any in-progress overscroll animation first. | 1344 // Reset any in-progress overscroll animation first. |
1344 ResetOverscrollTransform(); | 1345 ResetOverscrollTransform(); |
1345 | 1346 |
1346 if (old_mode == OVERSCROLL_NORTH || old_mode == OVERSCROLL_SOUTH) | 1347 if (old_mode == OVERSCROLL_NORTH || old_mode == OVERSCROLL_SOUTH) |
1347 OverscrollUpdateForWebContentsDelegate(0); | 1348 OverscrollUpdateForWebContentsDelegate(0); |
1348 | 1349 |
1349 if (new_mode != OVERSCROLL_NONE && touch_editable_) | 1350 if (new_mode != OVERSCROLL_NONE) { |
1350 touch_editable_->OverscrollStarted(); | 1351 ui::TouchSelectionControllerAura* selection_controller = |
1351 | 1352 GetSelectionController(); |
1353 if (selection_controller) | |
1354 selection_controller->OnOverscrollStarted(); | |
1355 } | |
1352 if (new_mode == OVERSCROLL_NONE || | 1356 if (new_mode == OVERSCROLL_NONE || |
1353 !GetContentNativeView() || | 1357 !GetContentNativeView() || |
1354 ((new_mode == OVERSCROLL_EAST || new_mode == OVERSCROLL_WEST) && | 1358 ((new_mode == OVERSCROLL_EAST || new_mode == OVERSCROLL_WEST) && |
1355 navigation_overlay_.get() && navigation_overlay_->has_window())) { | 1359 navigation_overlay_.get() && navigation_overlay_->has_window())) { |
1356 current_overscroll_gesture_ = OVERSCROLL_NONE; | 1360 current_overscroll_gesture_ = OVERSCROLL_NONE; |
1357 } else { | 1361 } else { |
1358 aura::Window* target = GetWindowToAnimateForOverscroll(); | 1362 aura::Window* target = GetWindowToAnimateForOverscroll(); |
1359 if (target) { | 1363 if (target) { |
1360 StopObservingImplicitAnimations(); | 1364 StopObservingImplicitAnimations(); |
1361 target->layer()->GetAnimator()->AbortAllAnimations(); | 1365 target->layer()->GetAnimator()->AbortAllAnimations(); |
(...skipping 20 matching lines...) Expand all Loading... | |
1382 | 1386 |
1383 if (ShouldNavigateForward(web_contents_->GetController(), | 1387 if (ShouldNavigateForward(web_contents_->GetController(), |
1384 completed_overscroll_gesture_)) { | 1388 completed_overscroll_gesture_)) { |
1385 web_contents_->GetController().GoForward(); | 1389 web_contents_->GetController().GoForward(); |
1386 PrepareOverscrollNavigationOverlay(); | 1390 PrepareOverscrollNavigationOverlay(); |
1387 } else if (ShouldNavigateBack(web_contents_->GetController(), | 1391 } else if (ShouldNavigateBack(web_contents_->GetController(), |
1388 completed_overscroll_gesture_)) { | 1392 completed_overscroll_gesture_)) { |
1389 web_contents_->GetController().GoBack(); | 1393 web_contents_->GetController().GoBack(); |
1390 PrepareOverscrollNavigationOverlay(); | 1394 PrepareOverscrollNavigationOverlay(); |
1391 } else { | 1395 } else { |
1392 if (touch_editable_) | 1396 ui::TouchSelectionControllerAura* selection_controller = |
1393 touch_editable_->OverscrollCompleted(); | 1397 GetSelectionController(); |
1398 if (selection_controller) | |
1399 selection_controller->OnOverscrollCompleted(); | |
1394 } | 1400 } |
1395 | 1401 |
1396 aura::Window* content = GetContentNativeView(); | 1402 aura::Window* content = GetContentNativeView(); |
1397 if (content) { | 1403 if (content) { |
1398 content->SetTransform(gfx::Transform()); | 1404 content->SetTransform(gfx::Transform()); |
1399 content->layer()->SetLayerBrightness(0.f); | 1405 content->layer()->SetLayerBrightness(0.f); |
1400 } | 1406 } |
1401 current_overscroll_gesture_ = OVERSCROLL_NONE; | 1407 current_overscroll_gesture_ = OVERSCROLL_NONE; |
1402 completed_overscroll_gesture_ = OVERSCROLL_NONE; | 1408 completed_overscroll_gesture_ = OVERSCROLL_NONE; |
1403 overscroll_window_.reset(); | 1409 overscroll_window_.reset(); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1635 if (visible) { | 1641 if (visible) { |
1636 if (!web_contents_->should_normally_be_visible()) | 1642 if (!web_contents_->should_normally_be_visible()) |
1637 web_contents_->WasShown(); | 1643 web_contents_->WasShown(); |
1638 } else { | 1644 } else { |
1639 if (web_contents_->should_normally_be_visible()) | 1645 if (web_contents_->should_normally_be_visible()) |
1640 web_contents_->WasHidden(); | 1646 web_contents_->WasHidden(); |
1641 } | 1647 } |
1642 } | 1648 } |
1643 | 1649 |
1644 } // namespace content | 1650 } // namespace content |
OLD | NEW |