| 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/overscroll_window_animation.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_editable_impl_aura.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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 53 #include "ui/aura/window_tree_host_observer.h" | 53 #include "ui/aura/window_tree_host_observer.h" |
| 54 #include "ui/aura_extra/image_window_delegate.h" | 54 #include "ui/aura_extra/image_window_delegate.h" |
| 55 #include "ui/base/clipboard/clipboard.h" | 55 #include "ui/base/clipboard/clipboard.h" |
| 56 #include "ui/base/clipboard/custom_data_helper.h" | 56 #include "ui/base/clipboard/custom_data_helper.h" |
| 57 #include "ui/base/dragdrop/drag_drop_types.h" | 57 #include "ui/base/dragdrop/drag_drop_types.h" |
| 58 #include "ui/base/dragdrop/drag_utils.h" | 58 #include "ui/base/dragdrop/drag_utils.h" |
| 59 #include "ui/base/dragdrop/drop_target_event.h" | 59 #include "ui/base/dragdrop/drop_target_event.h" |
| 60 #include "ui/base/dragdrop/os_exchange_data.h" | 60 #include "ui/base/dragdrop/os_exchange_data.h" |
| 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" | |
| 64 #include "ui/events/event.h" | 63 #include "ui/events/event.h" |
| 65 #include "ui/events/event_utils.h" | 64 #include "ui/events/event_utils.h" |
| 66 #include "ui/gfx/canvas.h" | 65 #include "ui/gfx/canvas.h" |
| 67 #include "ui/gfx/image/image.h" | 66 #include "ui/gfx/image/image.h" |
| 68 #include "ui/gfx/image/image_png_rep.h" | 67 #include "ui/gfx/image/image_png_rep.h" |
| 69 #include "ui/gfx/image/image_skia.h" | 68 #include "ui/gfx/image/image_skia.h" |
| 70 #include "ui/gfx/screen.h" | 69 #include "ui/gfx/screen.h" |
| 71 #include "ui/wm/public/drag_drop_client.h" | 70 #include "ui/wm/public/drag_drop_client.h" |
| 72 #include "ui/wm/public/drag_drop_delegate.h" | 71 #include "ui/wm/public/drag_drop_delegate.h" |
| 73 | 72 |
| 74 namespace content { | 73 namespace content { |
| 75 WebContentsView* CreateWebContentsView( | 74 WebContentsView* CreateWebContentsView( |
| 76 WebContentsImpl* web_contents, | 75 WebContentsImpl* web_contents, |
| 77 WebContentsViewDelegate* delegate, | 76 WebContentsViewDelegate* delegate, |
| 78 RenderViewHostDelegateView** render_view_host_delegate_view) { | 77 RenderViewHostDelegateView** render_view_host_delegate_view) { |
| 79 WebContentsViewAura* rv = new WebContentsViewAura(web_contents, delegate); | 78 WebContentsViewAura* rv = new WebContentsViewAura(web_contents, delegate); |
| 80 *render_view_host_delegate_view = rv; | 79 *render_view_host_delegate_view = rv; |
| 81 return rv; | 80 return rv; |
| 82 } | 81 } |
| 83 | 82 |
| 84 namespace { | 83 namespace { |
| 85 | 84 |
| 86 bool IsScrollEndEffectEnabled() { | 85 bool IsScrollEndEffectEnabled() { |
| 87 return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 86 return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 88 switches::kScrollEndEffect) == "1"; | 87 switches::kScrollEndEffect) == "1"; |
| 89 } | 88 } |
| 90 | 89 |
| 91 bool ShouldNavigateForward(const NavigationController& controller, | |
| 92 OverscrollMode mode) { | |
| 93 return mode == (base::i18n::IsRTL() ? OVERSCROLL_EAST : OVERSCROLL_WEST) && | |
| 94 controller.CanGoForward(); | |
| 95 } | |
| 96 | |
| 97 bool ShouldNavigateBack(const NavigationController& controller, | |
| 98 OverscrollMode mode) { | |
| 99 return mode == (base::i18n::IsRTL() ? OVERSCROLL_WEST : OVERSCROLL_EAST) && | |
| 100 controller.CanGoBack(); | |
| 101 } | |
| 102 | |
| 103 RenderWidgetHostViewAura* ToRenderWidgetHostViewAura( | 90 RenderWidgetHostViewAura* ToRenderWidgetHostViewAura( |
| 104 RenderWidgetHostView* view) { | 91 RenderWidgetHostView* view) { |
| 105 if (!view || RenderViewHostFactory::has_factory()) | 92 if (!view || RenderViewHostFactory::has_factory()) |
| 106 return NULL; // Can't cast to RenderWidgetHostViewAura in unit tests. | 93 return NULL; // Can't cast to RenderWidgetHostViewAura in unit tests. |
| 107 | 94 |
| 108 RenderViewHost* rvh = RenderViewHost::From(view->GetRenderWidgetHost()); | 95 RenderViewHost* rvh = RenderViewHost::From(view->GetRenderWidgetHost()); |
| 109 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( | 96 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
| 110 rvh ? WebContents::FromRenderViewHost(rvh) : NULL); | 97 rvh ? WebContents::FromRenderViewHost(rvh) : NULL); |
| 111 if (BrowserPluginGuest::IsGuest(web_contents)) | 98 if (BrowserPluginGuest::IsGuest(web_contents)) |
| 112 return NULL; | 99 return NULL; |
| 113 return static_cast<RenderWidgetHostViewAura*>(view); | 100 return static_cast<RenderWidgetHostViewAura*>(view); |
| 114 } | 101 } |
| 115 | 102 |
| 116 // The window delegate for the overscroll window. This redirects trackpad events | |
| 117 // to the web-contents window. The delegate destroys itself when the window is | |
| 118 // destroyed. | |
| 119 class OverscrollWindowDelegate : public aura_extra::ImageWindowDelegate { | |
| 120 public: | |
| 121 OverscrollWindowDelegate(WebContentsImpl* web_contents, | |
| 122 OverscrollMode overscroll_mode) | |
| 123 : web_contents_(web_contents), | |
| 124 forward_events_(true) { | |
| 125 const NavigationControllerImpl& controller = web_contents->GetController(); | |
| 126 const NavigationEntryImpl* entry = NULL; | |
| 127 if (ShouldNavigateForward(controller, overscroll_mode)) { | |
| 128 entry = NavigationEntryImpl::FromNavigationEntry( | |
| 129 controller.GetEntryAtOffset(1)); | |
| 130 } else if (ShouldNavigateBack(controller, overscroll_mode)) { | |
| 131 entry = NavigationEntryImpl::FromNavigationEntry( | |
| 132 controller.GetEntryAtOffset(-1)); | |
| 133 } | |
| 134 | |
| 135 gfx::Image image; | |
| 136 if (entry && entry->screenshot().get()) { | |
| 137 std::vector<gfx::ImagePNGRep> image_reps; | |
| 138 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), 1.0f)); | |
| 139 image = gfx::Image(image_reps); | |
| 140 } | |
| 141 SetImage(image); | |
| 142 } | |
| 143 | |
| 144 void stop_forwarding_events() { forward_events_ = false; } | |
| 145 | |
| 146 private: | |
| 147 ~OverscrollWindowDelegate() override {} | |
| 148 | |
| 149 aura::Window* web_contents_window() { | |
| 150 return web_contents_->GetView()->GetContentNativeView(); | |
| 151 } | |
| 152 | |
| 153 // Overridden from ui::EventHandler. | |
| 154 void OnScrollEvent(ui::ScrollEvent* event) override { | |
| 155 if (forward_events_ && web_contents_window()) | |
| 156 web_contents_window()->delegate()->OnScrollEvent(event); | |
| 157 } | |
| 158 | |
| 159 void OnGestureEvent(ui::GestureEvent* event) override { | |
| 160 if (forward_events_ && web_contents_window()) | |
| 161 web_contents_window()->delegate()->OnGestureEvent(event); | |
| 162 } | |
| 163 | |
| 164 WebContentsImpl* web_contents_; | |
| 165 | |
| 166 // The window is displayed both during the gesture, and after the gesture | |
| 167 // while the navigation is in progress. During the gesture, it is necessary to | |
| 168 // forward input events to the content page (e.g. when the overscroll window | |
| 169 // slides under the cursor and starts receiving scroll events). However, once | |
| 170 // the gesture is complete, and the window is being displayed as an overlay | |
| 171 // window during navigation, events should not be forwarded anymore. | |
| 172 bool forward_events_; | |
| 173 | |
| 174 DISALLOW_COPY_AND_ASSIGN(OverscrollWindowDelegate); | |
| 175 }; | |
| 176 | |
| 177 // Listens to all mouse drag events during a drag and drop and sends them to | 103 // Listens to all mouse drag events during a drag and drop and sends them to |
| 178 // the renderer. | 104 // the renderer. |
| 179 class WebDragSourceAura : public NotificationObserver { | 105 class WebDragSourceAura : public NotificationObserver { |
| 180 public: | 106 public: |
| 181 WebDragSourceAura(aura::Window* window, WebContentsImpl* contents) | 107 WebDragSourceAura(aura::Window* window, WebContentsImpl* contents) |
| 182 : window_(window), | 108 : window_(window), |
| 183 contents_(contents) { | 109 contents_(contents) { |
| 184 registrar_.Add(this, | 110 registrar_.Add(this, |
| 185 NOTIFICATION_WEB_CONTENTS_DISCONNECTED, | 111 NOTIFICATION_WEB_CONTENTS_DISCONNECTED, |
| 186 Source<WebContents>(contents)); | 112 Source<WebContents>(contents)); |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 // The parent window that hosts the constrained windows. We cache the old host | 646 // The parent window that hosts the constrained windows. We cache the old host |
| 721 // view so that we can unregister when it's not the parent anymore. | 647 // view so that we can unregister when it's not the parent anymore. |
| 722 aura::Window* host_window_; | 648 aura::Window* host_window_; |
| 723 | 649 |
| 724 DISALLOW_COPY_AND_ASSIGN(WindowObserver); | 650 DISALLOW_COPY_AND_ASSIGN(WindowObserver); |
| 725 }; | 651 }; |
| 726 | 652 |
| 727 //////////////////////////////////////////////////////////////////////////////// | 653 //////////////////////////////////////////////////////////////////////////////// |
| 728 // WebContentsViewAura, public: | 654 // WebContentsViewAura, public: |
| 729 | 655 |
| 730 WebContentsViewAura::WebContentsViewAura( | 656 WebContentsViewAura::WebContentsViewAura(WebContentsImpl* web_contents, |
| 731 WebContentsImpl* web_contents, | 657 WebContentsViewDelegate* delegate) |
| 732 WebContentsViewDelegate* delegate) | |
| 733 : web_contents_(web_contents), | 658 : web_contents_(web_contents), |
| 734 delegate_(delegate), | 659 delegate_(delegate), |
| 735 current_drag_op_(blink::WebDragOperationNone), | 660 current_drag_op_(blink::WebDragOperationNone), |
| 736 drag_dest_delegate_(NULL), | 661 drag_dest_delegate_(NULL), |
| 737 current_rvh_for_drag_(NULL), | 662 current_rvh_for_drag_(NULL), |
| 738 overscroll_change_brightness_(false), | |
| 739 current_overscroll_gesture_(OVERSCROLL_NONE), | 663 current_overscroll_gesture_(OVERSCROLL_NONE), |
| 740 completed_overscroll_gesture_(OVERSCROLL_NONE), | 664 completed_overscroll_gesture_(OVERSCROLL_NONE), |
| 741 touch_editable_(TouchEditableImplAura::Create()), | 665 touch_editable_(TouchEditableImplAura::Create()), |
| 742 is_or_was_visible_(false) { | 666 is_or_was_visible_(false), |
| 667 overscroll_window_animation_(nullptr) { |
| 743 } | 668 } |
| 744 | 669 |
| 745 //////////////////////////////////////////////////////////////////////////////// | 670 //////////////////////////////////////////////////////////////////////////////// |
| 746 // WebContentsViewAura, private: | 671 // WebContentsViewAura, private: |
| 747 | 672 |
| 748 WebContentsViewAura::~WebContentsViewAura() { | 673 WebContentsViewAura::~WebContentsViewAura() { |
| 749 if (!window_) | 674 if (!window_) |
| 750 return; | 675 return; |
| 751 | 676 |
| 752 window_observer_.reset(); | 677 window_observer_.reset(); |
| 753 window_->RemoveObserver(this); | 678 window_->RemoveObserver(this); |
| 754 | 679 |
| 755 // Window needs a valid delegate during its destructor, so we explicitly | 680 // Window needs a valid delegate during its destructor, so we explicitly |
| 756 // delete it here. | 681 // delete it here. |
| 757 window_.reset(); | 682 window_.reset(); |
| 758 } | 683 } |
| 759 | 684 |
| 760 void WebContentsViewAura::SetTouchEditableForTest( | 685 void WebContentsViewAura::SetTouchEditableForTest( |
| 761 TouchEditableImplAura* touch_editable) { | 686 TouchEditableImplAura* touch_editable) { |
| 762 touch_editable_.reset(touch_editable); | 687 touch_editable_.reset(touch_editable); |
| 763 AttachTouchEditableToRenderView(); | 688 AttachTouchEditableToRenderView(); |
| 764 } | 689 } |
| 765 | 690 |
| 691 void WebContentsViewAura::DismissOverlay() { |
| 692 if (overscroll_window_animation_) |
| 693 overscroll_window_animation_->DismissOverlay(); |
| 694 } |
| 695 |
| 766 void WebContentsViewAura::SizeChangedCommon(const gfx::Size& size) { | 696 void WebContentsViewAura::SizeChangedCommon(const gfx::Size& size) { |
| 767 if (web_contents_->GetInterstitialPage()) | 697 if (web_contents_->GetInterstitialPage()) |
| 768 web_contents_->GetInterstitialPage()->SetSize(size); | 698 web_contents_->GetInterstitialPage()->SetSize(size); |
| 769 RenderWidgetHostView* rwhv = | 699 RenderWidgetHostView* rwhv = |
| 770 web_contents_->GetRenderWidgetHostView(); | 700 web_contents_->GetRenderWidgetHostView(); |
| 771 if (rwhv) | 701 if (rwhv) |
| 772 rwhv->SetSize(size); | 702 rwhv->SetSize(size); |
| 773 } | 703 } |
| 774 | 704 |
| 775 void WebContentsViewAura::EndDrag(blink::WebDragOperationsMask ops) { | 705 void WebContentsViewAura::EndDrag(blink::WebDragOperationsMask ops) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 796 } | 726 } |
| 797 if (value == "2") { | 727 if (value == "2") { |
| 798 navigation_overlay_.reset(); | 728 navigation_overlay_.reset(); |
| 799 if (!gesture_nav_simple_) | 729 if (!gesture_nav_simple_) |
| 800 gesture_nav_simple_.reset(new GestureNavSimple(web_contents_)); | 730 gesture_nav_simple_.reset(new GestureNavSimple(web_contents_)); |
| 801 view->overscroll_controller()->set_delegate(gesture_nav_simple_.get()); | 731 view->overscroll_controller()->set_delegate(gesture_nav_simple_.get()); |
| 802 return; | 732 return; |
| 803 } | 733 } |
| 804 view->overscroll_controller()->set_delegate(this); | 734 view->overscroll_controller()->set_delegate(this); |
| 805 if (!navigation_overlay_) | 735 if (!navigation_overlay_) |
| 806 navigation_overlay_.reset(new OverscrollNavigationOverlay(web_contents_)); | 736 navigation_overlay_.reset( |
| 807 } | 737 new OverscrollNavigationOverlay(web_contents_, this)); |
| 808 | 738 LOG(ERROR) << "Installing overscroll window animation controller"; |
| 809 void WebContentsViewAura::PrepareOverscrollWindow() { | 739 if (!overscroll_window_animation_) { |
| 810 // If there is an existing |overscroll_window_| which is in the middle of an | 740 overscroll_window_animation_.reset(new OverscrollWindowAnimation( |
| 811 // animation, then destroying the window here causes the animation to be | 741 web_contents_, navigation_overlay_.get(), window_.get())); |
| 812 // completed immediately, which triggers |OnImplicitAnimationsCompleted()| | |
| 813 // callback, and that tries to reset |overscroll_window_| again, causing a | |
| 814 // double-free. So use a temporary variable here. | |
| 815 if (overscroll_window_) { | |
| 816 base::AutoReset<OverscrollMode> reset_state(¤t_overscroll_gesture_, | |
| 817 current_overscroll_gesture_); | |
| 818 scoped_ptr<aura::Window> reset_window(overscroll_window_.release()); | |
| 819 } | 742 } |
| 820 | |
| 821 OverscrollWindowDelegate* overscroll_delegate = new OverscrollWindowDelegate( | |
| 822 web_contents_, | |
| 823 current_overscroll_gesture_); | |
| 824 overscroll_window_.reset(new aura::Window(overscroll_delegate)); | |
| 825 overscroll_window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | |
| 826 overscroll_window_->SetTransparent(true); | |
| 827 overscroll_window_->Init(aura::WINDOW_LAYER_TEXTURED); | |
| 828 overscroll_window_->layer()->SetMasksToBounds(false); | |
| 829 overscroll_window_->SetName("OverscrollOverlay"); | |
| 830 | |
| 831 overscroll_change_brightness_ = overscroll_delegate->has_image(); | |
| 832 window_->AddChild(overscroll_window_.get()); | |
| 833 | |
| 834 gfx::Rect bounds = gfx::Rect(window_->bounds().size()); | |
| 835 if (ShouldNavigateForward(web_contents_->GetController(), | |
| 836 current_overscroll_gesture_)) { | |
| 837 // The overlay will be sliding in from the right edge towards the left in | |
| 838 // non-RTL, or sliding in from the left edge towards the right in RTL. | |
| 839 // So position the overlay window accordingly. | |
| 840 bounds.Offset(base::i18n::IsRTL() ? -bounds.width() : bounds.width(), 0); | |
| 841 } | |
| 842 | |
| 843 aura::Window* animate_window = GetWindowToAnimateForOverscroll(); | |
| 844 if (animate_window == overscroll_window_) | |
| 845 window_->StackChildAbove(overscroll_window_.get(), GetContentNativeView()); | |
| 846 else | |
| 847 window_->StackChildBelow(overscroll_window_.get(), GetContentNativeView()); | |
| 848 | |
| 849 UpdateOverscrollWindowBrightness(0.f); | |
| 850 | |
| 851 overscroll_window_->SetBounds(bounds); | |
| 852 overscroll_window_->Show(); | |
| 853 | |
| 854 overscroll_shadow_.reset(new ShadowLayerDelegate(animate_window->layer())); | |
| 855 } | 743 } |
| 856 | 744 |
| 857 void WebContentsViewAura::PrepareContentWindowForOverscroll() { | 745 void WebContentsViewAura::PrepareContentWindowForOverscroll() { |
| 858 StopObservingImplicitAnimations(); | |
| 859 aura::Window* content = GetContentNativeView(); | 746 aura::Window* content = GetContentNativeView(); |
| 860 content->layer()->GetAnimator()->AbortAllAnimations(); | 747 content->layer()->GetAnimator()->AbortAllAnimations(); |
| 861 content->SetTransform(gfx::Transform()); | 748 content->SetTransform(gfx::Transform()); |
| 862 content->layer()->SetLayerBrightness(0.f); | 749 content->layer()->SetLayerBrightness(0.f); |
| 863 } | 750 } |
| 864 | 751 |
| 865 void WebContentsViewAura::ResetOverscrollTransform() { | |
| 866 if (!web_contents_->GetRenderWidgetHostView()) | |
| 867 return; | |
| 868 aura::Window* target = GetWindowToAnimateForOverscroll(); | |
| 869 if (!target) | |
| 870 return; | |
| 871 { | |
| 872 ui::ScopedLayerAnimationSettings settings(target->layer()->GetAnimator()); | |
| 873 settings.SetPreemptionStrategy( | |
| 874 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | |
| 875 settings.SetTweenType(gfx::Tween::EASE_OUT); | |
| 876 settings.AddObserver(this); | |
| 877 target->SetTransform(gfx::Transform()); | |
| 878 } | |
| 879 { | |
| 880 ui::ScopedLayerAnimationSettings settings(target->layer()->GetAnimator()); | |
| 881 settings.SetPreemptionStrategy( | |
| 882 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | |
| 883 settings.SetTweenType(gfx::Tween::EASE_OUT); | |
| 884 UpdateOverscrollWindowBrightness(0.f); | |
| 885 } | |
| 886 } | |
| 887 | |
| 888 void WebContentsViewAura::CompleteOverscrollNavigation(OverscrollMode mode) { | 752 void WebContentsViewAura::CompleteOverscrollNavigation(OverscrollMode mode) { |
| 889 if (!web_contents_->GetRenderWidgetHostView()) | 753 if (!web_contents_->GetRenderWidgetHostView()) |
| 890 return; | 754 return; |
| 891 | 755 |
| 892 // Animate out the current view first. Navigate to the requested history at | 756 // Animate out the current view first. Navigate to the requested history at |
| 893 // the end of the animation. | 757 // the end of the animation. |
| 758 // TODO maybe the following line is redundant? |
| 894 if (current_overscroll_gesture_ == OVERSCROLL_NONE) | 759 if (current_overscroll_gesture_ == OVERSCROLL_NONE) |
| 895 return; | 760 return; |
| 896 | 761 |
| 897 UMA_HISTOGRAM_ENUMERATION("Overscroll.Navigated", | 762 UMA_HISTOGRAM_ENUMERATION("Overscroll.Navigated", |
| 898 current_overscroll_gesture_, OVERSCROLL_COUNT); | 763 current_overscroll_gesture_, OVERSCROLL_COUNT); |
| 899 OverscrollWindowDelegate* delegate = static_cast<OverscrollWindowDelegate*>( | |
| 900 overscroll_window_->delegate()); | |
| 901 delegate->stop_forwarding_events(); | |
| 902 | 764 |
| 903 completed_overscroll_gesture_ = mode; | 765 overscroll_window_animation_->OnOverscrollComplete(mode); |
| 904 aura::Window* target = GetWindowToAnimateForOverscroll(); | |
| 905 ui::ScopedLayerAnimationSettings settings(target->layer()->GetAnimator()); | |
| 906 settings.SetPreemptionStrategy( | |
| 907 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | |
| 908 settings.SetTweenType(gfx::Tween::EASE_OUT); | |
| 909 settings.AddObserver(this); | |
| 910 gfx::Transform transform; | |
| 911 int content_width = | |
| 912 web_contents_->GetRenderWidgetHostView()->GetViewBounds().width(); | |
| 913 float translate_x = static_cast<float>(mode == OVERSCROLL_WEST ? | |
| 914 -content_width : content_width); | |
| 915 transform.Translate(translate_x, 0); | |
| 916 target->SetTransform(transform); | |
| 917 UpdateOverscrollWindowBrightness(translate_x); | |
| 918 } | |
| 919 | |
| 920 aura::Window* WebContentsViewAura::GetWindowToAnimateForOverscroll() { | |
| 921 if (current_overscroll_gesture_ == OVERSCROLL_NONE) | |
| 922 return NULL; | |
| 923 | |
| 924 return ShouldNavigateForward(web_contents_->GetController(), | |
| 925 current_overscroll_gesture_) ? | |
| 926 overscroll_window_.get() : GetContentNativeView(); | |
| 927 } | |
| 928 | |
| 929 gfx::Vector2dF WebContentsViewAura::GetTranslationForOverscroll(float delta_x, | |
| 930 float delta_y) { | |
| 931 if (current_overscroll_gesture_ == OVERSCROLL_NORTH || | |
| 932 current_overscroll_gesture_ == OVERSCROLL_SOUTH) { | |
| 933 return gfx::Vector2dF(0, delta_y); | |
| 934 } | |
| 935 // For horizontal overscroll, scroll freely if a navigation is possible. Do a | |
| 936 // resistive scroll otherwise. | |
| 937 const NavigationControllerImpl& controller = web_contents_->GetController(); | |
| 938 const gfx::Rect& bounds = GetViewBounds(); | |
| 939 const float bounds_width = static_cast<float>(bounds.width()); | |
| 940 if (ShouldNavigateForward(controller, current_overscroll_gesture_)) | |
| 941 return gfx::Vector2dF(std::max(-bounds_width, delta_x), 0); | |
| 942 else if (ShouldNavigateBack(controller, current_overscroll_gesture_)) | |
| 943 return gfx::Vector2dF(std::min(bounds_width, delta_x), 0); | |
| 944 return gfx::Vector2dF(); | |
| 945 } | 766 } |
| 946 | 767 |
| 947 void WebContentsViewAura::PrepareOverscrollNavigationOverlay() { | 768 void WebContentsViewAura::PrepareOverscrollNavigationOverlay() { |
| 948 OverscrollWindowDelegate* delegate = static_cast<OverscrollWindowDelegate*>( | 769 LOG(ERROR) << "Preparing overscroll navigation overlay"; |
| 949 overscroll_window_->delegate()); | |
| 950 overscroll_window_->SchedulePaintInRect( | |
| 951 gfx::Rect(overscroll_window_->bounds().size())); | |
| 952 overscroll_window_->SetBounds(gfx::Rect(window_->bounds().size())); | |
| 953 overscroll_window_->SetTransform(gfx::Transform()); | |
| 954 navigation_overlay_->SetOverlayWindow(overscroll_window_.Pass(), | |
| 955 delegate); | |
| 956 navigation_overlay_->StartObserving(); | 770 navigation_overlay_->StartObserving(); |
| 957 } | 771 } |
| 958 | 772 |
| 959 void WebContentsViewAura::UpdateOverscrollWindowBrightness(float delta_x) { | |
| 960 if (!overscroll_change_brightness_) | |
| 961 return; | |
| 962 | |
| 963 const float kBrightnessMin = -.1f; | |
| 964 const float kBrightnessMax = -.01f; | |
| 965 | |
| 966 float ratio = fabs(delta_x) / GetViewBounds().width(); | |
| 967 ratio = std::min(1.f, ratio); | |
| 968 if (base::i18n::IsRTL()) | |
| 969 ratio = 1.f - ratio; | |
| 970 float brightness = current_overscroll_gesture_ == OVERSCROLL_WEST ? | |
| 971 kBrightnessMin + ratio * (kBrightnessMax - kBrightnessMin) : | |
| 972 kBrightnessMax - ratio * (kBrightnessMax - kBrightnessMin); | |
| 973 brightness = std::max(kBrightnessMin, brightness); | |
| 974 brightness = std::min(kBrightnessMax, brightness); | |
| 975 aura::Window* window = GetWindowToAnimateForOverscroll(); | |
| 976 window->layer()->SetLayerBrightness(brightness); | |
| 977 } | |
| 978 | |
| 979 void WebContentsViewAura::AttachTouchEditableToRenderView() { | 773 void WebContentsViewAura::AttachTouchEditableToRenderView() { |
| 980 if (!touch_editable_) | 774 if (!touch_editable_) |
| 981 return; | 775 return; |
| 982 RenderWidgetHostViewAura* rwhva = ToRenderWidgetHostViewAura( | 776 RenderWidgetHostViewAura* rwhva = ToRenderWidgetHostViewAura( |
| 983 web_contents_->GetRenderWidgetHostView()); | 777 web_contents_->GetRenderWidgetHostView()); |
| 984 touch_editable_->AttachToView(rwhva); | 778 touch_editable_->AttachToView(rwhva); |
| 985 } | 779 } |
| 986 | 780 |
| 987 void WebContentsViewAura::OverscrollUpdateForWebContentsDelegate( | 781 void WebContentsViewAura::OverscrollUpdateForWebContentsDelegate( |
| 988 float delta_y) { | 782 float delta_y) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 ToRenderWidgetHostViewAura(web_contents_->GetRenderWidgetHostView()); | 972 ToRenderWidgetHostViewAura(web_contents_->GetRenderWidgetHostView()); |
| 1179 if (view) { | 973 if (view) { |
| 1180 view->SetOverscrollControllerEnabled(enabled); | 974 view->SetOverscrollControllerEnabled(enabled); |
| 1181 if (enabled) | 975 if (enabled) |
| 1182 InstallOverscrollControllerDelegate(view); | 976 InstallOverscrollControllerDelegate(view); |
| 1183 } | 977 } |
| 1184 | 978 |
| 1185 if (!enabled) | 979 if (!enabled) |
| 1186 navigation_overlay_.reset(); | 980 navigation_overlay_.reset(); |
| 1187 else if (!navigation_overlay_) | 981 else if (!navigation_overlay_) |
| 1188 navigation_overlay_.reset(new OverscrollNavigationOverlay(web_contents_)); | 982 navigation_overlay_.reset( |
| 983 new OverscrollNavigationOverlay(web_contents_, this)); |
| 1189 } | 984 } |
| 1190 | 985 |
| 1191 //////////////////////////////////////////////////////////////////////////////// | 986 //////////////////////////////////////////////////////////////////////////////// |
| 1192 // WebContentsViewAura, RenderViewHostDelegateView implementation: | 987 // WebContentsViewAura, RenderViewHostDelegateView implementation: |
| 1193 | 988 |
| 1194 void WebContentsViewAura::ShowContextMenu(RenderFrameHost* render_frame_host, | 989 void WebContentsViewAura::ShowContextMenu(RenderFrameHost* render_frame_host, |
| 1195 const ContextMenuParams& params) { | 990 const ContextMenuParams& params) { |
| 1196 if (touch_editable_) { | 991 if (touch_editable_) { |
| 1197 touch_editable_->EndTouchEditing(false); | 992 touch_editable_->EndTouchEditing(false); |
| 1198 } | 993 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 if (!rwhv || !rwhv->IsShowing()) | 1094 if (!rwhv || !rwhv->IsShowing()) |
| 1300 return gfx::Rect(); | 1095 return gfx::Rect(); |
| 1301 | 1096 |
| 1302 return rwhv->GetViewBounds(); | 1097 return rwhv->GetViewBounds(); |
| 1303 } | 1098 } |
| 1304 | 1099 |
| 1305 bool WebContentsViewAura::OnOverscrollUpdate(float delta_x, float delta_y) { | 1100 bool WebContentsViewAura::OnOverscrollUpdate(float delta_x, float delta_y) { |
| 1306 if (current_overscroll_gesture_ == OVERSCROLL_NONE) | 1101 if (current_overscroll_gesture_ == OVERSCROLL_NONE) |
| 1307 return false; | 1102 return false; |
| 1308 | 1103 |
| 1309 aura::Window* target = GetWindowToAnimateForOverscroll(); | |
| 1310 gfx::Vector2dF translate = GetTranslationForOverscroll(delta_x, delta_y); | |
| 1311 gfx::Transform transform; | |
| 1312 | |
| 1313 if (current_overscroll_gesture_ == OVERSCROLL_NORTH || | 1104 if (current_overscroll_gesture_ == OVERSCROLL_NORTH || |
| 1314 current_overscroll_gesture_ == OVERSCROLL_SOUTH) { | 1105 current_overscroll_gesture_ == OVERSCROLL_SOUTH) { |
| 1315 OverscrollUpdateForWebContentsDelegate(translate.y()); | 1106 OverscrollUpdateForWebContentsDelegate(delta_y); |
| 1316 } else { | 1107 return delta_y != 0; |
| 1317 // Only horizontal overscrolls participate in the navigation gesture. | |
| 1318 transform.Translate(translate.x(), translate.y()); | |
| 1319 target->SetTransform(transform); | |
| 1320 UpdateOverscrollWindowBrightness(delta_x); | |
| 1321 } | 1108 } |
| 1322 | 1109 // Only horizontal overscrolls participate in the navigation gesture. |
| 1323 return !translate.IsZero(); | 1110 if (!overscroll_window_animation_) |
| 1111 return false; |
| 1112 return overscroll_window_animation_->OnOverscrollUpdate(delta_x, delta_y); |
| 1324 } | 1113 } |
| 1325 | 1114 |
| 1326 void WebContentsViewAura::OnOverscrollComplete(OverscrollMode mode) { | 1115 void WebContentsViewAura::OnOverscrollComplete(OverscrollMode mode) { |
| 1327 UMA_HISTOGRAM_ENUMERATION("Overscroll.Completed", mode, OVERSCROLL_COUNT); | 1116 UMA_HISTOGRAM_ENUMERATION("Overscroll.Completed", mode, OVERSCROLL_COUNT); |
| 1117 LOG(ERROR) << "OVERSCROLL COMPLETE"; |
| 1328 if (web_contents_->GetDelegate() && | 1118 if (web_contents_->GetDelegate() && |
| 1329 IsScrollEndEffectEnabled() && | 1119 IsScrollEndEffectEnabled() && |
| 1330 (mode == OVERSCROLL_NORTH || mode == OVERSCROLL_SOUTH)) { | 1120 (mode == OVERSCROLL_NORTH || mode == OVERSCROLL_SOUTH)) { |
| 1331 web_contents_->GetDelegate()->OverscrollComplete(); | 1121 web_contents_->GetDelegate()->OverscrollComplete(); |
| 1332 } | 1122 } |
| 1333 NavigationControllerImpl& controller = web_contents_->GetController(); | 1123 NavigationControllerImpl& controller = web_contents_->GetController(); |
| 1334 if (ShouldNavigateForward(controller, mode) || | 1124 OverscrollNavigationOverlay::Direction direction = |
| 1335 ShouldNavigateBack(controller, mode)) { | 1125 navigation_overlay_->GetNavigationDirection(controller, mode); |
| 1336 CompleteOverscrollNavigation(mode); | 1126 // TODO maybe this is irrelevant? |
| 1127 if (direction == OverscrollNavigationOverlay::NONE) |
| 1337 return; | 1128 return; |
| 1338 } | |
| 1339 | 1129 |
| 1340 ResetOverscrollTransform(); | 1130 CompleteOverscrollNavigation(mode); |
| 1131 // TODO uncomment these lines. |
| 1132 /*if (direction == OverscrollNavigationOverlay::FORWARD) |
| 1133 web_contents_->GetController().GoForward(); |
| 1134 else |
| 1135 web_contents_->GetController().GoBack();*/ |
| 1136 PrepareOverscrollNavigationOverlay(); |
| 1341 } | 1137 } |
| 1342 | 1138 |
| 1343 void WebContentsViewAura::OnOverscrollModeChange(OverscrollMode old_mode, | 1139 void WebContentsViewAura::OnOverscrollModeChange(OverscrollMode old_mode, |
| 1344 OverscrollMode new_mode) { | 1140 OverscrollMode new_mode) { |
| 1141 LOG(ERROR) << "Overscroll mode change"; |
| 1345 // Reset any in-progress overscroll animation first. | 1142 // Reset any in-progress overscroll animation first. |
| 1346 ResetOverscrollTransform(); | 1143 // ResetOverscrollTransform(); |
| 1347 | 1144 |
| 1348 if (old_mode == OVERSCROLL_NORTH || old_mode == OVERSCROLL_SOUTH) | 1145 if (old_mode == OVERSCROLL_NORTH || old_mode == OVERSCROLL_SOUTH) |
| 1349 OverscrollUpdateForWebContentsDelegate(0); | 1146 OverscrollUpdateForWebContentsDelegate(0); |
| 1350 | 1147 |
| 1351 if (new_mode != OVERSCROLL_NONE && touch_editable_) | 1148 if (new_mode != OVERSCROLL_NONE && touch_editable_) |
| 1352 touch_editable_->OverscrollStarted(); | 1149 touch_editable_->OverscrollStarted(); |
| 1353 | 1150 |
| 1354 if (new_mode == OVERSCROLL_NONE || | 1151 if (new_mode == OVERSCROLL_NONE || |
| 1355 !GetContentNativeView() || | 1152 !GetContentNativeView() || |
| 1356 ((new_mode == OVERSCROLL_EAST || new_mode == OVERSCROLL_WEST) && | 1153 ((new_mode == OVERSCROLL_EAST || new_mode == OVERSCROLL_WEST) && |
| 1357 navigation_overlay_.get() && navigation_overlay_->has_window())) { | 1154 navigation_overlay_.get() && navigation_overlay_->has_window())) { |
| 1155 // TODO maybe I want to not set directly OVERSCROLL_NONE in the following |
| 1156 // statement? |
| 1358 current_overscroll_gesture_ = OVERSCROLL_NONE; | 1157 current_overscroll_gesture_ = OVERSCROLL_NONE; |
| 1158 overscroll_window_animation_->OnOverscrollModeChange(old_mode, |
| 1159 OVERSCROLL_NONE); |
| 1359 } else { | 1160 } else { |
| 1360 aura::Window* target = GetWindowToAnimateForOverscroll(); | 1161 current_overscroll_gesture_ = new_mode; |
| 1361 if (target) { | 1162 if (overscroll_window_animation_) |
| 1362 StopObservingImplicitAnimations(); | 1163 overscroll_window_animation_->OnOverscrollModeChange(old_mode, new_mode); |
| 1363 target->layer()->GetAnimator()->AbortAllAnimations(); | 1164 PrepareContentWindowForOverscroll(); |
| 1364 } | 1165 } |
| 1166 /* |
| 1167 } else { |
| 1168 if (overscroll_window_animation_) |
| 1169 overscroll_window_animation_->AbortAllAnimations(); |
| 1170 |
| 1365 // Cleanup state of the content window first, because that can reset the | 1171 // Cleanup state of the content window first, because that can reset the |
| 1366 // value of |current_overscroll_gesture_|. | 1172 // value of |current_overscroll_gesture_|. |
| 1367 PrepareContentWindowForOverscroll(); | |
| 1368 | 1173 |
| 1369 current_overscroll_gesture_ = new_mode; | 1174 current_overscroll_gesture_ = new_mode; |
| 1370 if (current_overscroll_gesture_ == OVERSCROLL_EAST || | 1175 if (ShouldNavigateBack(web_contents_->GetController(), |
| 1371 current_overscroll_gesture_ == OVERSCROLL_WEST) | 1176 current_overscroll_gesture_) || |
| 1372 PrepareOverscrollWindow(); | 1177 ShouldNavigateForward(web_contents_->GetController(), |
| 1178 current_overscroll_gesture_)) { |
| 1179 LOG(ERROR) << "Preparing overscroll window"; |
| 1180 //PrepareOverscrollWindow(); |
| 1181 } |
| 1373 | 1182 |
| 1374 UMA_HISTOGRAM_ENUMERATION("Overscroll.Started", new_mode, OVERSCROLL_COUNT); | 1183 UMA_HISTOGRAM_ENUMERATION("Overscroll.Started", new_mode, OVERSCROLL_COUNT); |
| 1375 } | 1184 }*/ |
| 1376 completed_overscroll_gesture_ = OVERSCROLL_NONE; | 1185 completed_overscroll_gesture_ = OVERSCROLL_NONE; |
| 1377 } | 1186 } |
| 1378 | 1187 |
| 1379 //////////////////////////////////////////////////////////////////////////////// | 1188 //////////////////////////////////////////////////////////////////////////////// |
| 1380 // WebContentsViewAura, ui::ImplicitAnimationObserver implementation: | |
| 1381 | |
| 1382 void WebContentsViewAura::OnImplicitAnimationsCompleted() { | |
| 1383 overscroll_shadow_.reset(); | |
| 1384 | |
| 1385 if (ShouldNavigateForward(web_contents_->GetController(), | |
| 1386 completed_overscroll_gesture_)) { | |
| 1387 web_contents_->GetController().GoForward(); | |
| 1388 PrepareOverscrollNavigationOverlay(); | |
| 1389 } else if (ShouldNavigateBack(web_contents_->GetController(), | |
| 1390 completed_overscroll_gesture_)) { | |
| 1391 web_contents_->GetController().GoBack(); | |
| 1392 PrepareOverscrollNavigationOverlay(); | |
| 1393 } else { | |
| 1394 if (touch_editable_) | |
| 1395 touch_editable_->OverscrollCompleted(); | |
| 1396 } | |
| 1397 | |
| 1398 aura::Window* content = GetContentNativeView(); | |
| 1399 if (content) { | |
| 1400 content->SetTransform(gfx::Transform()); | |
| 1401 content->layer()->SetLayerBrightness(0.f); | |
| 1402 } | |
| 1403 current_overscroll_gesture_ = OVERSCROLL_NONE; | |
| 1404 completed_overscroll_gesture_ = OVERSCROLL_NONE; | |
| 1405 overscroll_window_.reset(); | |
| 1406 } | |
| 1407 | |
| 1408 //////////////////////////////////////////////////////////////////////////////// | |
| 1409 // WebContentsViewAura, aura::WindowDelegate implementation: | 1189 // WebContentsViewAura, aura::WindowDelegate implementation: |
| 1410 | 1190 |
| 1411 gfx::Size WebContentsViewAura::GetMinimumSize() const { | 1191 gfx::Size WebContentsViewAura::GetMinimumSize() const { |
| 1412 return gfx::Size(); | 1192 return gfx::Size(); |
| 1413 } | 1193 } |
| 1414 | 1194 |
| 1415 gfx::Size WebContentsViewAura::GetMaximumSize() const { | 1195 gfx::Size WebContentsViewAura::GetMaximumSize() const { |
| 1416 return gfx::Size(); | 1196 return gfx::Size(); |
| 1417 } | 1197 } |
| 1418 | 1198 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 void WebContentsViewAura::OnCaptureLost() { | 1248 void WebContentsViewAura::OnCaptureLost() { |
| 1469 } | 1249 } |
| 1470 | 1250 |
| 1471 void WebContentsViewAura::OnPaint(gfx::Canvas* canvas) { | 1251 void WebContentsViewAura::OnPaint(gfx::Canvas* canvas) { |
| 1472 } | 1252 } |
| 1473 | 1253 |
| 1474 void WebContentsViewAura::OnDeviceScaleFactorChanged( | 1254 void WebContentsViewAura::OnDeviceScaleFactorChanged( |
| 1475 float device_scale_factor) { | 1255 float device_scale_factor) { |
| 1476 } | 1256 } |
| 1477 | 1257 |
| 1258 // TODO move this to overscroll window animation. |
| 1478 void WebContentsViewAura::OnWindowDestroying(aura::Window* window) { | 1259 void WebContentsViewAura::OnWindowDestroying(aura::Window* window) { |
| 1479 // This means the destructor is going to be called soon. If there is an | 1260 // This means the destructor is going to be called soon. If there is an |
| 1480 // overscroll gesture in progress (i.e. |overscroll_window_| is not NULL), | 1261 // overscroll gesture in progress (i.e. |overscroll_window_| is not NULL), |
| 1481 // then destroying it in the WebContentsViewAura destructor can trigger other | 1262 // then destroying it in the WebContentsViewAura destructor can trigger other |
| 1482 // virtual functions to be called (e.g. OnImplicitAnimationsCompleted()). So | 1263 // virtual functions to be called (e.g. OnImplicitAnimationsCompleted()). So |
| 1483 // destroy the overscroll window here. | 1264 // destroy the overscroll window here. |
| 1484 navigation_overlay_.reset(); | 1265 navigation_overlay_.reset(); |
| 1485 overscroll_window_.reset(); | 1266 LOG(ERROR) << "Window destroyed, resetting overscroll window animation"; |
| 1267 overscroll_window_animation_.reset(); |
| 1486 } | 1268 } |
| 1487 | 1269 |
| 1488 void WebContentsViewAura::OnWindowDestroyed(aura::Window* window) { | 1270 void WebContentsViewAura::OnWindowDestroyed(aura::Window* window) { |
| 1489 } | 1271 } |
| 1490 | 1272 |
| 1491 void WebContentsViewAura::OnWindowTargetVisibilityChanged(bool visible) { | 1273 void WebContentsViewAura::OnWindowTargetVisibilityChanged(bool visible) { |
| 1492 } | 1274 } |
| 1493 | 1275 |
| 1494 bool WebContentsViewAura::HasHitTestMask() const { | 1276 bool WebContentsViewAura::HasHitTestMask() const { |
| 1495 return false; | 1277 return false; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 if (visible) { | 1419 if (visible) { |
| 1638 if (!web_contents_->should_normally_be_visible()) | 1420 if (!web_contents_->should_normally_be_visible()) |
| 1639 web_contents_->WasShown(); | 1421 web_contents_->WasShown(); |
| 1640 } else { | 1422 } else { |
| 1641 if (web_contents_->should_normally_be_visible()) | 1423 if (web_contents_->should_normally_be_visible()) |
| 1642 web_contents_->WasHidden(); | 1424 web_contents_->WasHidden(); |
| 1643 } | 1425 } |
| 1644 } | 1426 } |
| 1645 | 1427 |
| 1646 } // namespace content | 1428 } // namespace content |
| OLD | NEW |