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

Unified Diff: content/renderer/render_view_impl_android.cc

Issue 814083004: Notify main-thread of top controls state changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass TopControlsState to webwidget Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« cc/trees/layer_tree_host_impl.cc ('K') | « content/renderer/render_view_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl_android.cc
diff --git a/content/renderer/render_view_impl_android.cc b/content/renderer/render_view_impl_android.cc
index dc74a3aff3d29b018a4ecc9002a19dabae3a8592..c01c3d23b416f5df6a40f119b50b928417d2f169 100644
--- a/content/renderer/render_view_impl_android.cc
+++ b/content/renderer/render_view_impl_android.cc
@@ -13,19 +13,33 @@
namespace content {
-// Check content::TopControlsState and cc::TopControlsState are kept in sync.
+// Check content::TopControlsState , cc::TopControlsState, and
+// blink::WebWidget::TopControlsState are kept in sync.
static_assert(int(TOP_CONTROLS_STATE_SHOWN) == int(cc::SHOWN),
"mismatching enums: SHOWN");
+static_assert(int(TOP_CONTROLS_STATE_SHOWN) == int(blink::WebWidget::Shown),
+ "mismatching enums: SHOWN");
static_assert(int(TOP_CONTROLS_STATE_HIDDEN) == int(cc::HIDDEN),
"mismatching enums: HIDDEN");
+static_assert(int(TOP_CONTROLS_STATE_HIDDEN) == int(blink::WebWidget::Hidden),
+ "mismatching enums: HIDDEN");
static_assert(int(TOP_CONTROLS_STATE_BOTH) == int(cc::BOTH),
"mismatching enums: BOTH");
+static_assert(int(TOP_CONTROLS_STATE_BOTH) == int(blink::WebWidget::Both),
+ "mismatching enums: BOTH");
-cc::TopControlsState ContentToCcTopControlsState(
+cc::TopControlsState ContentToCc(
TopControlsState state) {
return static_cast<cc::TopControlsState>(state);
}
+// TODO(majidvp) Use a single enum for both cc and blink
+blink::WebWidget::TopControlsState ContentToBlink(
+ TopControlsState state) {
+ return static_cast<blink::WebWidget::TopControlsState>(state);
+}
+
+
// TODO(mvanouwerkerk): Stop calling this code path and delete it.
void RenderViewImpl::OnUpdateTopControlsState(bool enable_hiding,
bool enable_showing,
@@ -33,38 +47,41 @@ void RenderViewImpl::OnUpdateTopControlsState(bool enable_hiding,
// TODO(tedchoc): Investigate why messages are getting here before the
// compositor has been initialized.
LOG_IF(WARNING, !compositor_) << "OnUpdateTopControlsState was unhandled.";
- if (compositor_) {
- cc::TopControlsState constraints = cc::BOTH;
- if (!enable_showing)
- constraints = cc::HIDDEN;
- if (!enable_hiding)
- constraints = cc::SHOWN;
- cc::TopControlsState current = cc::BOTH;
- compositor_->UpdateTopControlsState(constraints, current, animate);
- top_controls_constraints_ = constraints;
- }
+ TopControlsState constraints = TOP_CONTROLS_STATE_BOTH;
+ if (!enable_showing)
+ constraints = TOP_CONTROLS_STATE_HIDDEN;
+ if (!enable_hiding)
+ constraints = TOP_CONTROLS_STATE_SHOWN;
+ TopControlsState current = TOP_CONTROLS_STATE_BOTH;
+
+ UpdateTopControlsState(constraints, current, animate);
}
void RenderViewImpl::UpdateTopControlsState(TopControlsState constraints,
TopControlsState current,
bool animate) {
- cc::TopControlsState constraints_cc =
- ContentToCcTopControlsState(constraints);
- cc::TopControlsState current_cc = ContentToCcTopControlsState(current);
- if (compositor_)
- compositor_->UpdateTopControlsState(constraints_cc, current_cc, animate);
- top_controls_constraints_ = constraints_cc;
+ if (compositor_) {
+ compositor_->UpdateTopControlsState(ContentToCc(constraints),
aelias_OOO_until_Jul13 2015/02/12 00:45:29 Instead of having the plumbing fork here, let's pl
majidvp 2015/02/12 13:51:48 That sounds good. In which case to be consistent I
aelias_OOO_until_Jul13 2015/02/12 19:24:54 Sounds good, go ahead.
+ ContentToCc(current),
+ animate);
+ }
+ if (webwidget()) {
+ webwidget()->updateTopControlsState(ContentToBlink(constraints),
+ ContentToBlink(current),
+ animate);
+ }
+
+ top_controls_constraints_ = constraints;
}
void RenderViewImpl::didScrollWithKeyboard(const blink::WebSize& delta) {
if (delta.height == 0)
return;
- if (compositor_) {
- cc::TopControlsState current = delta.height < 0 ? cc::SHOWN : cc::HIDDEN;
- compositor_->UpdateTopControlsState(top_controls_constraints_,
- current,
- true);
- }
+
+ TopControlsState current = delta.height < 0 ? TOP_CONTROLS_STATE_SHOWN
+ : TOP_CONTROLS_STATE_HIDDEN;
+
+ UpdateTopControlsState(top_controls_constraints_, current, true);
}
void RenderViewImpl::OnExtractSmartClipData(const gfx::Rect& rect) {
« cc/trees/layer_tree_host_impl.cc ('K') | « content/renderer/render_view_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698