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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 11 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
12 #include "content/browser/download/drag_download_util.h" | 12 #include "content/browser/download/drag_download_util.h" |
13 #include "content/browser/frame_host/interstitial_page_impl.h" | 13 #include "content/browser/frame_host/interstitial_page_impl.h" |
14 #include "content/browser/frame_host/navigation_entry_impl.h" | 14 #include "content/browser/frame_host/navigation_entry_impl.h" |
15 #include "content/browser/renderer_host/dip_util.h" | 15 #include "content/browser/renderer_host/dip_util.h" |
16 #include "content/browser/renderer_host/overscroll_controller.h" | 16 #include "content/browser/renderer_host/overscroll_controller.h" |
17 #include "content/browser/renderer_host/render_view_host_factory.h" | 17 #include "content/browser/renderer_host/render_view_host_factory.h" |
18 #include "content/browser/renderer_host/render_view_host_impl.h" | 18 #include "content/browser/renderer_host/render_view_host_impl.h" |
19 #include "content/browser/renderer_host/render_widget_host_impl.h" | 19 #include "content/browser/renderer_host/render_widget_host_impl.h" |
20 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 20 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
21 #include "content/browser/renderer_host/web_input_event_aura.h" | 21 #include "content/browser/renderer_host/web_input_event_aura.h" |
22 #include "content/browser/web_contents/aura/gesture_nav_simple.h" | 22 #include "content/browser/web_contents/aura/gesture_nav_simple.h" |
23 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" | 23 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" |
24 #include "content/browser/web_contents/touch_editable_impl_aura.h" | 24 #include "content/browser/web_contents/aura/touch_selection_controller_client_au
ra.h" |
25 #include "content/browser/web_contents/web_contents_impl.h" | 25 #include "content/browser/web_contents/web_contents_impl.h" |
26 #include "content/public/browser/content_browser_client.h" | 26 #include "content/public/browser/content_browser_client.h" |
27 #include "content/public/browser/notification_observer.h" | 27 #include "content/public/browser/notification_observer.h" |
28 #include "content/public/browser/notification_registrar.h" | 28 #include "content/public/browser/notification_registrar.h" |
29 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
30 #include "content/public/browser/notification_types.h" | 30 #include "content/public/browser/notification_types.h" |
31 #include "content/public/browser/overscroll_configuration.h" | 31 #include "content/public/browser/overscroll_configuration.h" |
32 #include "content/public/browser/render_view_host.h" | 32 #include "content/public/browser/render_view_host.h" |
33 #include "content/public/browser/render_widget_host.h" | 33 #include "content/public/browser/render_widget_host.h" |
34 #include "content/public/browser/render_widget_host_view.h" | 34 #include "content/public/browser/render_widget_host_view.h" |
(...skipping 21 matching lines...) Expand all Loading... |
56 #include "ui/base/dragdrop/os_exchange_data.h" | 56 #include "ui/base/dragdrop/os_exchange_data.h" |
57 #include "ui/base/hit_test.h" | 57 #include "ui/base/hit_test.h" |
58 #include "ui/compositor/layer.h" | 58 #include "ui/compositor/layer.h" |
59 #include "ui/events/event.h" | 59 #include "ui/events/event.h" |
60 #include "ui/events/event_utils.h" | 60 #include "ui/events/event_utils.h" |
61 #include "ui/gfx/canvas.h" | 61 #include "ui/gfx/canvas.h" |
62 #include "ui/gfx/image/image.h" | 62 #include "ui/gfx/image/image.h" |
63 #include "ui/gfx/image/image_png_rep.h" | 63 #include "ui/gfx/image/image_png_rep.h" |
64 #include "ui/gfx/image/image_skia.h" | 64 #include "ui/gfx/image/image_skia.h" |
65 #include "ui/gfx/screen.h" | 65 #include "ui/gfx/screen.h" |
| 66 #include "ui/touch_selection/touch_selection_controller.h" |
66 #include "ui/wm/public/drag_drop_client.h" | 67 #include "ui/wm/public/drag_drop_client.h" |
67 #include "ui/wm/public/drag_drop_delegate.h" | 68 #include "ui/wm/public/drag_drop_delegate.h" |
68 | 69 |
69 namespace content { | 70 namespace content { |
70 WebContentsView* CreateWebContentsView( | 71 WebContentsView* CreateWebContentsView( |
71 WebContentsImpl* web_contents, | 72 WebContentsImpl* web_contents, |
72 WebContentsViewDelegate* delegate, | 73 WebContentsViewDelegate* delegate, |
73 RenderViewHostDelegateView** render_view_host_delegate_view) { | 74 RenderViewHostDelegateView** render_view_host_delegate_view) { |
74 WebContentsViewAura* rv = new WebContentsViewAura(web_contents, delegate); | 75 WebContentsViewAura* rv = new WebContentsViewAura(web_contents, delegate); |
75 *render_view_host_delegate_view = rv; | 76 *render_view_host_delegate_view = rv; |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } | 525 } |
525 #endif | 526 #endif |
526 } | 527 } |
527 } | 528 } |
528 | 529 |
529 void OnWindowBoundsChanged(aura::Window* window, | 530 void OnWindowBoundsChanged(aura::Window* window, |
530 const gfx::Rect& old_bounds, | 531 const gfx::Rect& old_bounds, |
531 const gfx::Rect& new_bounds) override { | 532 const gfx::Rect& new_bounds) override { |
532 if (window == host_window_ || window == view_->window_) { | 533 if (window == host_window_ || window == view_->window_) { |
533 SendScreenRects(); | 534 SendScreenRects(); |
534 if (view_->touch_editable_) | 535 if (old_bounds.origin() != new_bounds.origin()) { |
535 view_->touch_editable_->UpdateEditingController(); | 536 ui::TouchSelectionController* selection_controller = |
| 537 view_->GetSelectionController(); |
| 538 if (selection_controller) |
| 539 selection_controller->OnNativeViewMoved(); |
| 540 } |
536 #if defined(OS_WIN) | 541 #if defined(OS_WIN) |
537 } else { | 542 } else { |
538 UpdateConstrainedWindows(NULL); | 543 UpdateConstrainedWindows(NULL); |
539 #endif | 544 #endif |
540 } | 545 } |
541 } | 546 } |
542 | 547 |
543 void OnWindowDestroying(aura::Window* window) override { | 548 void OnWindowDestroying(aura::Window* window) override { |
544 if (window == host_window_) { | 549 if (window == host_window_) { |
545 host_window_->RemoveObserver(this); | 550 host_window_->RemoveObserver(this); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 WebContentsViewAura::WebContentsViewAura(WebContentsImpl* web_contents, | 648 WebContentsViewAura::WebContentsViewAura(WebContentsImpl* web_contents, |
644 WebContentsViewDelegate* delegate) | 649 WebContentsViewDelegate* delegate) |
645 : web_contents_(web_contents), | 650 : web_contents_(web_contents), |
646 delegate_(delegate), | 651 delegate_(delegate), |
647 current_drag_op_(blink::WebDragOperationNone), | 652 current_drag_op_(blink::WebDragOperationNone), |
648 drag_dest_delegate_(NULL), | 653 drag_dest_delegate_(NULL), |
649 current_rvh_for_drag_(NULL), | 654 current_rvh_for_drag_(NULL), |
650 current_overscroll_gesture_(OVERSCROLL_NONE), | 655 current_overscroll_gesture_(OVERSCROLL_NONE), |
651 completed_overscroll_gesture_(OVERSCROLL_NONE), | 656 completed_overscroll_gesture_(OVERSCROLL_NONE), |
652 navigation_overlay_(nullptr), | 657 navigation_overlay_(nullptr), |
653 touch_editable_(TouchEditableImplAura::Create()), | |
654 is_or_was_visible_(false) { | 658 is_or_was_visible_(false) { |
655 } | 659 } |
656 | 660 |
657 //////////////////////////////////////////////////////////////////////////////// | 661 //////////////////////////////////////////////////////////////////////////////// |
658 // WebContentsViewAura, private: | 662 // WebContentsViewAura, private: |
659 | 663 |
660 WebContentsViewAura::~WebContentsViewAura() { | 664 WebContentsViewAura::~WebContentsViewAura() { |
661 if (!window_) | 665 if (!window_) |
662 return; | 666 return; |
663 | 667 |
664 window_observer_.reset(); | 668 window_observer_.reset(); |
665 window_->RemoveObserver(this); | 669 window_->RemoveObserver(this); |
666 | 670 |
667 // Window needs a valid delegate during its destructor, so we explicitly | 671 // Window needs a valid delegate during its destructor, so we explicitly |
668 // delete it here. | 672 // delete it here. |
669 window_.reset(); | 673 window_.reset(); |
670 } | 674 } |
671 | 675 |
672 void WebContentsViewAura::SetTouchEditableForTest( | |
673 TouchEditableImplAura* touch_editable) { | |
674 touch_editable_.reset(touch_editable); | |
675 AttachTouchEditableToRenderView(); | |
676 } | |
677 | |
678 void WebContentsViewAura::SizeChangedCommon(const gfx::Size& size) { | 676 void WebContentsViewAura::SizeChangedCommon(const gfx::Size& size) { |
679 if (web_contents_->GetInterstitialPage()) | 677 if (web_contents_->GetInterstitialPage()) |
680 web_contents_->GetInterstitialPage()->SetSize(size); | 678 web_contents_->GetInterstitialPage()->SetSize(size); |
681 RenderWidgetHostView* rwhv = | 679 RenderWidgetHostView* rwhv = |
682 web_contents_->GetRenderWidgetHostView(); | 680 web_contents_->GetRenderWidgetHostView(); |
683 if (rwhv) | 681 if (rwhv) |
684 rwhv->SetSize(size); | 682 rwhv->SetSize(size); |
685 } | 683 } |
686 | 684 |
687 void WebContentsViewAura::EndDrag(blink::WebDragOperationsMask ops) { | 685 void WebContentsViewAura::EndDrag(blink::WebDragOperationsMask ops) { |
(...skipping 29 matching lines...) Expand all Loading... |
717 if (!navigation_overlay_) { | 715 if (!navigation_overlay_) { |
718 navigation_overlay_.reset( | 716 navigation_overlay_.reset( |
719 new OverscrollNavigationOverlay(web_contents_, window_.get())); | 717 new OverscrollNavigationOverlay(web_contents_, window_.get())); |
720 } | 718 } |
721 } | 719 } |
722 | 720 |
723 void WebContentsViewAura::CompleteOverscrollNavigation(OverscrollMode mode) { | 721 void WebContentsViewAura::CompleteOverscrollNavigation(OverscrollMode mode) { |
724 if (!web_contents_->GetRenderWidgetHostView()) | 722 if (!web_contents_->GetRenderWidgetHostView()) |
725 return; | 723 return; |
726 navigation_overlay_->relay_delegate()->OnOverscrollComplete(mode); | 724 navigation_overlay_->relay_delegate()->OnOverscrollComplete(mode); |
727 if (touch_editable_) | 725 ui::TouchSelectionController* selection_controller = GetSelectionController(); |
728 touch_editable_->OverscrollCompleted(); | 726 if (selection_controller) |
729 } | 727 selection_controller->HideAndDisallowShowingAutomatically(); |
730 | |
731 void WebContentsViewAura::AttachTouchEditableToRenderView() { | |
732 if (!touch_editable_) | |
733 return; | |
734 RenderWidgetHostViewAura* rwhva = ToRenderWidgetHostViewAura( | |
735 web_contents_->GetRenderWidgetHostView()); | |
736 touch_editable_->AttachToView(rwhva); | |
737 } | 728 } |
738 | 729 |
739 void WebContentsViewAura::OverscrollUpdateForWebContentsDelegate( | 730 void WebContentsViewAura::OverscrollUpdateForWebContentsDelegate( |
740 float delta_y) { | 731 float delta_y) { |
741 if (web_contents_->GetDelegate() && IsScrollEndEffectEnabled()) | 732 if (web_contents_->GetDelegate() && IsScrollEndEffectEnabled()) |
742 web_contents_->GetDelegate()->OverscrollUpdate(delta_y); | 733 web_contents_->GetDelegate()->OverscrollUpdate(delta_y); |
743 } | 734 } |
744 | 735 |
| 736 ui::TouchSelectionController* WebContentsViewAura::GetSelectionController() { |
| 737 RenderWidgetHostViewAura* view = |
| 738 ToRenderWidgetHostViewAura(web_contents_->GetRenderWidgetHostView()); |
| 739 return view ? view->selection_controller() : nullptr; |
| 740 } |
| 741 |
745 //////////////////////////////////////////////////////////////////////////////// | 742 //////////////////////////////////////////////////////////////////////////////// |
746 // WebContentsViewAura, WebContentsView implementation: | 743 // WebContentsViewAura, WebContentsView implementation: |
747 | 744 |
748 gfx::NativeView WebContentsViewAura::GetNativeView() const { | 745 gfx::NativeView WebContentsViewAura::GetNativeView() const { |
749 return window_.get(); | 746 return window_.get(); |
750 } | 747 } |
751 | 748 |
752 gfx::NativeView WebContentsViewAura::GetContentNativeView() const { | 749 gfx::NativeView WebContentsViewAura::GetContentNativeView() const { |
753 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); | 750 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
754 return rwhv ? rwhv->GetNativeView() : NULL; | 751 return rwhv ? rwhv->GetNativeView() : NULL; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 // this actually is happening (and somebody isn't accidentally creating the | 871 // this actually is happening (and somebody isn't accidentally creating the |
875 // view twice), we check for the RVH Factory, which will be set when we're | 872 // view twice), we check for the RVH Factory, which will be set when we're |
876 // making special ones (which go along with the special views). | 873 // making special ones (which go along with the special views). |
877 DCHECK(RenderViewHostFactory::has_factory()); | 874 DCHECK(RenderViewHostFactory::has_factory()); |
878 return static_cast<RenderWidgetHostViewBase*>( | 875 return static_cast<RenderWidgetHostViewBase*>( |
879 render_widget_host->GetView()); | 876 render_widget_host->GetView()); |
880 } | 877 } |
881 | 878 |
882 RenderWidgetHostViewAura* view = | 879 RenderWidgetHostViewAura* view = |
883 new RenderWidgetHostViewAura(render_widget_host, is_guest_view_hack); | 880 new RenderWidgetHostViewAura(render_widget_host, is_guest_view_hack); |
| 881 scoped_ptr<TouchSelectionControllerClientAura> selection_controller_client( |
| 882 new TouchSelectionControllerClientAura(view)); |
| 883 view->InitSelectionController(selection_controller_client.Pass()); |
| 884 |
884 view->InitAsChild(NULL); | 885 view->InitAsChild(NULL); |
885 GetNativeView()->AddChild(view->GetNativeView()); | 886 GetNativeView()->AddChild(view->GetNativeView()); |
886 | 887 |
887 RenderWidgetHostImpl* host_impl = | 888 RenderWidgetHostImpl* host_impl = |
888 RenderWidgetHostImpl::From(render_widget_host); | 889 RenderWidgetHostImpl::From(render_widget_host); |
889 | 890 |
890 if (!host_impl->is_hidden()) | 891 if (!host_impl->is_hidden()) |
891 view->Show(); | 892 view->Show(); |
892 | 893 |
893 // We listen to drag drop events in the newly created view's window. | 894 // We listen to drag drop events in the newly created view's window. |
894 aura::client::SetDragDropDelegate(view->GetNativeView(), this); | 895 aura::client::SetDragDropDelegate(view->GetNativeView(), this); |
895 | 896 |
896 if (view->overscroll_controller() && | 897 if (view->overscroll_controller() && |
897 (!web_contents_->GetDelegate() || | 898 (!web_contents_->GetDelegate() || |
898 web_contents_->GetDelegate()->CanOverscrollContent())) { | 899 web_contents_->GetDelegate()->CanOverscrollContent())) { |
899 InstallOverscrollControllerDelegate(view); | 900 InstallOverscrollControllerDelegate(view); |
900 } | 901 } |
901 | 902 |
902 AttachTouchEditableToRenderView(); | |
903 return view; | 903 return view; |
904 } | 904 } |
905 | 905 |
906 RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForPopupWidget( | 906 RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForPopupWidget( |
907 RenderWidgetHost* render_widget_host) { | 907 RenderWidgetHost* render_widget_host) { |
908 return new RenderWidgetHostViewAura(render_widget_host, false); | 908 return new RenderWidgetHostViewAura(render_widget_host, false); |
909 } | 909 } |
910 | 910 |
911 void WebContentsViewAura::SetPageTitle(const base::string16& title) { | 911 void WebContentsViewAura::SetPageTitle(const base::string16& title) { |
912 window_->SetTitle(title); | 912 window_->SetTitle(title); |
913 } | 913 } |
914 | 914 |
915 void WebContentsViewAura::RenderViewCreated(RenderViewHost* host) { | 915 void WebContentsViewAura::RenderViewCreated(RenderViewHost* host) { |
916 } | 916 } |
917 | 917 |
918 void WebContentsViewAura::RenderViewSwappedIn(RenderViewHost* host) { | 918 void WebContentsViewAura::RenderViewSwappedIn(RenderViewHost* host) { |
919 AttachTouchEditableToRenderView(); | |
920 } | 919 } |
921 | 920 |
922 void WebContentsViewAura::SetOverscrollControllerEnabled(bool enabled) { | 921 void WebContentsViewAura::SetOverscrollControllerEnabled(bool enabled) { |
923 RenderWidgetHostViewAura* view = | 922 RenderWidgetHostViewAura* view = |
924 ToRenderWidgetHostViewAura(web_contents_->GetRenderWidgetHostView()); | 923 ToRenderWidgetHostViewAura(web_contents_->GetRenderWidgetHostView()); |
925 if (view) { | 924 if (view) { |
926 view->SetOverscrollControllerEnabled(enabled); | 925 view->SetOverscrollControllerEnabled(enabled); |
927 if (enabled) | 926 if (enabled) |
928 InstallOverscrollControllerDelegate(view); | 927 InstallOverscrollControllerDelegate(view); |
929 } | 928 } |
930 | 929 |
931 if (!enabled) { | 930 if (!enabled) { |
932 navigation_overlay_.reset(); | 931 navigation_overlay_.reset(); |
933 } else if (!navigation_overlay_) { | 932 } else if (!navigation_overlay_) { |
934 navigation_overlay_.reset( | 933 navigation_overlay_.reset( |
935 new OverscrollNavigationOverlay(web_contents_, window_.get())); | 934 new OverscrollNavigationOverlay(web_contents_, window_.get())); |
936 } | 935 } |
937 } | 936 } |
938 | 937 |
939 //////////////////////////////////////////////////////////////////////////////// | 938 //////////////////////////////////////////////////////////////////////////////// |
940 // WebContentsViewAura, RenderViewHostDelegateView implementation: | 939 // WebContentsViewAura, RenderViewHostDelegateView implementation: |
941 | 940 |
942 void WebContentsViewAura::ShowContextMenu(RenderFrameHost* render_frame_host, | 941 void WebContentsViewAura::ShowContextMenu(RenderFrameHost* render_frame_host, |
943 const ContextMenuParams& params) { | 942 const ContextMenuParams& params) { |
944 if (touch_editable_) { | 943 ui::TouchSelectionController* selection_controller = GetSelectionController(); |
945 touch_editable_->EndTouchEditing(false); | 944 if (selection_controller) |
946 } | 945 selection_controller->HideAndDisallowShowingAutomatically(); |
947 if (delegate_) { | 946 if (delegate_) { |
948 RenderWidgetHostViewAura* view = ToRenderWidgetHostViewAura( | 947 RenderWidgetHostViewAura* view = ToRenderWidgetHostViewAura( |
949 web_contents_->GetRenderWidgetHostView()); | 948 web_contents_->GetRenderWidgetHostView()); |
950 if (view) | 949 if (view) |
951 view->OnShowContextMenu(); | 950 view->OnShowContextMenu(); |
952 | 951 |
953 delegate_->ShowContextMenu(render_frame_host, params); | 952 delegate_->ShowContextMenu(render_frame_host, params); |
954 // WARNING: we may have been deleted during the call to ShowContextMenu(). | 953 // WARNING: we may have been deleted during the call to ShowContextMenu(). |
955 } | 954 } |
956 } | 955 } |
957 | 956 |
958 void WebContentsViewAura::StartDragging( | 957 void WebContentsViewAura::StartDragging( |
959 const DropData& drop_data, | 958 const DropData& drop_data, |
960 blink::WebDragOperationsMask operations, | 959 blink::WebDragOperationsMask operations, |
961 const gfx::ImageSkia& image, | 960 const gfx::ImageSkia& image, |
962 const gfx::Vector2d& image_offset, | 961 const gfx::Vector2d& image_offset, |
963 const DragEventSourceInfo& event_info) { | 962 const DragEventSourceInfo& event_info) { |
964 aura::Window* root_window = GetNativeView()->GetRootWindow(); | 963 aura::Window* root_window = GetNativeView()->GetRootWindow(); |
965 if (!aura::client::GetDragDropClient(root_window)) { | 964 if (!aura::client::GetDragDropClient(root_window)) { |
966 web_contents_->SystemDragEnded(); | 965 web_contents_->SystemDragEnded(); |
967 return; | 966 return; |
968 } | 967 } |
969 | 968 |
970 if (touch_editable_) | 969 ui::TouchSelectionController* selection_controller = GetSelectionController(); |
971 touch_editable_->EndTouchEditing(false); | 970 if (selection_controller) |
972 | 971 selection_controller->HideAndDisallowShowingAutomatically(); |
973 ui::OSExchangeData::Provider* provider = ui::OSExchangeData::CreateProvider(); | 972 ui::OSExchangeData::Provider* provider = ui::OSExchangeData::CreateProvider(); |
974 PrepareDragData(drop_data, provider, web_contents_); | 973 PrepareDragData(drop_data, provider, web_contents_); |
975 | 974 |
976 ui::OSExchangeData data(provider); // takes ownership of |provider|. | 975 ui::OSExchangeData data(provider); // takes ownership of |provider|. |
977 | 976 |
978 if (!image.isNull()) | 977 if (!image.isNull()) |
979 drag_utils::SetDragImageOnDataObject(image, image_offset, &data); | 978 drag_utils::SetDragImageOnDataObject(image, image_offset, &data); |
980 | 979 |
981 scoped_ptr<WebDragSourceAura> drag_source( | 980 scoped_ptr<WebDragSourceAura> drag_source( |
982 new WebDragSourceAura(GetNativeView(), web_contents_)); | 981 new WebDragSourceAura(GetNativeView(), web_contents_)); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 web_contents_->GetDelegate()->OverscrollComplete(); | 1073 web_contents_->GetDelegate()->OverscrollComplete(); |
1075 } | 1074 } |
1076 CompleteOverscrollNavigation(mode); | 1075 CompleteOverscrollNavigation(mode); |
1077 } | 1076 } |
1078 | 1077 |
1079 void WebContentsViewAura::OnOverscrollModeChange(OverscrollMode old_mode, | 1078 void WebContentsViewAura::OnOverscrollModeChange(OverscrollMode old_mode, |
1080 OverscrollMode new_mode) { | 1079 OverscrollMode new_mode) { |
1081 if (old_mode == OVERSCROLL_NORTH || old_mode == OVERSCROLL_SOUTH) | 1080 if (old_mode == OVERSCROLL_NORTH || old_mode == OVERSCROLL_SOUTH) |
1082 OverscrollUpdateForWebContentsDelegate(0); | 1081 OverscrollUpdateForWebContentsDelegate(0); |
1083 | 1082 |
1084 if (touch_editable_) { | |
1085 if (new_mode == OVERSCROLL_NONE) | |
1086 touch_editable_->OverscrollCompleted(); | |
1087 else | |
1088 touch_editable_->OverscrollStarted(); | |
1089 } | |
1090 | |
1091 current_overscroll_gesture_ = new_mode; | 1083 current_overscroll_gesture_ = new_mode; |
1092 navigation_overlay_->relay_delegate()->OnOverscrollModeChange(old_mode, | 1084 navigation_overlay_->relay_delegate()->OnOverscrollModeChange(old_mode, |
1093 new_mode); | 1085 new_mode); |
1094 completed_overscroll_gesture_ = OVERSCROLL_NONE; | 1086 completed_overscroll_gesture_ = OVERSCROLL_NONE; |
1095 } | 1087 } |
1096 | 1088 |
1097 //////////////////////////////////////////////////////////////////////////////// | 1089 //////////////////////////////////////////////////////////////////////////////// |
1098 // WebContentsViewAura, aura::WindowDelegate implementation: | 1090 // WebContentsViewAura, aura::WindowDelegate implementation: |
1099 | 1091 |
1100 gfx::Size WebContentsViewAura::GetMinimumSize() const { | 1092 gfx::Size WebContentsViewAura::GetMinimumSize() const { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 if (visible) { | 1317 if (visible) { |
1326 if (!web_contents_->should_normally_be_visible()) | 1318 if (!web_contents_->should_normally_be_visible()) |
1327 web_contents_->WasShown(); | 1319 web_contents_->WasShown(); |
1328 } else { | 1320 } else { |
1329 if (web_contents_->should_normally_be_visible()) | 1321 if (web_contents_->should_normally_be_visible()) |
1330 web_contents_->WasHidden(); | 1322 web_contents_->WasHidden(); |
1331 } | 1323 } |
1332 } | 1324 } |
1333 | 1325 |
1334 } // namespace content | 1326 } // namespace content |
OLD | NEW |