| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/android/overscroll_controller_android.h" | 5 #include "content/browser/android/overscroll_controller_android.h" |
| 6 | 6 |
| 7 #include "base/android/build_info.h" | 7 #include "base/android/build_info.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
| 10 #include "cc/output/compositor_frame_metadata.h" | 10 #include "cc/output/compositor_frame_metadata.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 OverscrollControllerAndroid::OverscrollControllerAndroid( | 91 OverscrollControllerAndroid::OverscrollControllerAndroid( |
| 92 ContentViewCoreImpl* content_view_core) | 92 ContentViewCoreImpl* content_view_core) |
| 93 : compositor_(content_view_core->GetWindowAndroid()->GetCompositor()), | 93 : compositor_(content_view_core->GetWindowAndroid()->GetCompositor()), |
| 94 dpi_scale_(content_view_core->GetDpiScale()), | 94 dpi_scale_(content_view_core->GetDpiScale()), |
| 95 enabled_(true), | 95 enabled_(true), |
| 96 glow_effect_(CreateGlowEffect(this, dpi_scale_)), | 96 glow_effect_(CreateGlowEffect(this, dpi_scale_)), |
| 97 refresh_effect_(CreateRefreshEffect(content_view_core)), | 97 refresh_effect_(CreateRefreshEffect(content_view_core)), |
| 98 is_fullscreen_(false) { | 98 is_fullscreen_(false) { |
| 99 DCHECK(compositor_); | 99 DCHECK(compositor_); |
| 100 // Fullscreen state is only relevant for the refresh effect. |
| 101 if (refresh_effect_) { |
| 102 WebContentsImpl* web_contents = |
| 103 static_cast<WebContentsImpl*>(content_view_core->GetWebContents()); |
| 104 is_fullscreen_ = web_contents->IsFullscreenForCurrentTab(); |
| 105 Observe(web_contents); |
| 106 } |
| 100 } | 107 } |
| 101 | 108 |
| 102 OverscrollControllerAndroid::~OverscrollControllerAndroid() { | 109 OverscrollControllerAndroid::~OverscrollControllerAndroid() { |
| 103 } | 110 } |
| 104 | 111 |
| 105 bool OverscrollControllerAndroid::WillHandleGestureEvent( | 112 bool OverscrollControllerAndroid::WillHandleGestureEvent( |
| 106 const blink::WebGestureEvent& event) { | 113 const blink::WebGestureEvent& event) { |
| 107 if (!enabled_) | 114 if (!enabled_) |
| 108 return false; | 115 return false; |
| 109 | 116 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 if (!enabled_) { | 268 if (!enabled_) { |
| 262 if (refresh_effect_) | 269 if (refresh_effect_) |
| 263 refresh_effect_->Reset(); | 270 refresh_effect_->Reset(); |
| 264 if (glow_effect_) | 271 if (glow_effect_) |
| 265 glow_effect_->Reset(); | 272 glow_effect_->Reset(); |
| 266 } | 273 } |
| 267 } | 274 } |
| 268 | 275 |
| 269 void OverscrollControllerAndroid::DidToggleFullscreenModeForTab( | 276 void OverscrollControllerAndroid::DidToggleFullscreenModeForTab( |
| 270 bool entered_fullscreen) { | 277 bool entered_fullscreen) { |
| 278 DCHECK(refresh_effect_); |
| 271 if (is_fullscreen_ == entered_fullscreen) | 279 if (is_fullscreen_ == entered_fullscreen) |
| 272 return; | 280 return; |
| 273 is_fullscreen_ = entered_fullscreen; | 281 is_fullscreen_ = entered_fullscreen; |
| 274 if (is_fullscreen_) | 282 if (is_fullscreen_) |
| 275 refresh_effect_->ReleaseWithoutActivation(); | 283 refresh_effect_->ReleaseWithoutActivation(); |
| 276 } | 284 } |
| 277 | 285 |
| 278 scoped_ptr<EdgeEffectBase> OverscrollControllerAndroid::CreateEdgeEffect() { | 286 scoped_ptr<EdgeEffectBase> OverscrollControllerAndroid::CreateEdgeEffect() { |
| 279 return CreateGlowEdgeEffect(&compositor_->GetResourceManager(), dpi_scale_); | 287 return CreateGlowEdgeEffect(&compositor_->GetResourceManager(), dpi_scale_); |
| 280 } | 288 } |
| 281 | 289 |
| 282 void OverscrollControllerAndroid::SetNeedsAnimate() { | 290 void OverscrollControllerAndroid::SetNeedsAnimate() { |
| 283 compositor_->SetNeedsAnimate(); | 291 compositor_->SetNeedsAnimate(); |
| 284 } | 292 } |
| 285 | 293 |
| 286 } // namespace content | 294 } // namespace content |
| OLD | NEW |