Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1735833002: Remove WebContentsObserver::DidGetUserGesture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 2709 matching lines...) Expand 10 before | Expand all | Expand 10 after
2720 } 2720 }
2721 2721
2722 void WebContentsImpl::SystemDragEnded() { 2722 void WebContentsImpl::SystemDragEnded() {
2723 if (GetRenderViewHost()) 2723 if (GetRenderViewHost())
2724 GetRenderViewHost()->DragSourceSystemDragEnded(); 2724 GetRenderViewHost()->DragSourceSystemDragEnded();
2725 if (browser_plugin_embedder_.get()) 2725 if (browser_plugin_embedder_.get())
2726 browser_plugin_embedder_->SystemDragEnded(); 2726 browser_plugin_embedder_->SystemDragEnded();
2727 } 2727 }
2728 2728
2729 void WebContentsImpl::UserGestureDone() { 2729 void WebContentsImpl::UserGestureDone() {
2730 OnUserGesture(GetRenderViewHost()->GetWidget()); 2730 OnUserInteraction(GetRenderViewHost()->GetWidget(),
Charlie Reis 2016/02/25 18:28:02 Side question: Would you be a good person to chat
dominickn 2016/02/26 00:36:11 I'm by no means an expert on the widget hierarchy,
2731 blink::WebInputEvent::Undefined);
2731 } 2732 }
2732 2733
2733 void WebContentsImpl::SetClosedByUserGesture(bool value) { 2734 void WebContentsImpl::SetClosedByUserGesture(bool value) {
2734 closed_by_user_gesture_ = value; 2735 closed_by_user_gesture_ = value;
2735 } 2736 }
2736 2737
2737 bool WebContentsImpl::GetClosedByUserGesture() const { 2738 bool WebContentsImpl::GetClosedByUserGesture() const {
2738 return closed_by_user_gesture_; 2739 return closed_by_user_gesture_;
2739 } 2740 }
2740 2741
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
4339 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { 4340 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) {
4340 GetRenderManager()->CreateRenderFrameProxy(instance); 4341 GetRenderManager()->CreateRenderFrameProxy(instance);
4341 } else { 4342 } else {
4342 GetRenderManager()->CreateRenderFrame( 4343 GetRenderManager()->CreateRenderFrame(
4343 instance, CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN, 4344 instance, CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN,
4344 &render_view_routing_id); 4345 &render_view_routing_id);
4345 } 4346 }
4346 return render_view_routing_id; 4347 return render_view_routing_id;
4347 } 4348 }
4348 4349
4349 void WebContentsImpl::OnUserGesture(RenderWidgetHostImpl* render_widget_host) { 4350 void WebContentsImpl::OnUserInteraction(
4351 RenderWidgetHostImpl* render_widget_host,
4352 const blink::WebInputEvent::Type type) {
4353 // Ignore when the renderer is swapped out.
Charlie Reis 2016/02/25 18:28:02 We should probably have a TODO here to support wid
dominickn 2016/02/26 00:36:11 Done.
4350 if (render_widget_host != GetRenderViewHost()->GetWidget()) 4354 if (render_widget_host != GetRenderViewHost()->GetWidget())
4351 return; 4355 return;
4352 4356
4353 // Notify observers. 4357 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
4354 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetUserGesture()); 4358 DidGetUserInteraction(type));
4355 4359
4356 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); 4360 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get();
4357 if (rdh) // NULL in unittests. 4361 // Exclude scroll events as user gestures for resource load dispatches.
4362 // rdh is NULL in unittests.
4363 if (rdh && type != blink::WebInputEvent::MouseWheel)
4358 rdh->OnUserGesture(this); 4364 rdh->OnUserGesture(this);
4359 } 4365 }
4360 4366
4361 void WebContentsImpl::OnUserInteraction(const blink::WebInputEvent::Type type) {
4362 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
4363 DidGetUserInteraction(type));
4364 }
4365
4366 void WebContentsImpl::OnIgnoredUIEvent() { 4367 void WebContentsImpl::OnIgnoredUIEvent() {
4367 // Notify observers. 4368 // Notify observers.
4368 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent()); 4369 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent());
4369 } 4370 }
4370 4371
4371 void WebContentsImpl::RendererUnresponsive( 4372 void WebContentsImpl::RendererUnresponsive(
4372 RenderWidgetHostImpl* render_widget_host) { 4373 RenderWidgetHostImpl* render_widget_host) {
4373 // Don't show hung renderer dialog for a swapped out RVH. 4374 // Don't show hung renderer dialog for a swapped out RVH.
4374 if (render_widget_host != GetRenderViewHost()->GetWidget()) 4375 if (render_widget_host != GetRenderViewHost()->GetWidget())
4375 return; 4376 return;
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
4787 const WebContentsObserver::MediaPlayerId& id) { 4788 const WebContentsObserver::MediaPlayerId& id) {
4788 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); 4789 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id));
4789 } 4790 }
4790 4791
4791 void WebContentsImpl::MediaStoppedPlaying( 4792 void WebContentsImpl::MediaStoppedPlaying(
4792 const WebContentsObserver::MediaPlayerId& id) { 4793 const WebContentsObserver::MediaPlayerId& id) {
4793 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); 4794 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id));
4794 } 4795 }
4795 4796
4796 } // namespace content 4797 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698