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

Side by Side Diff: content/renderer/render_view_impl_android.cc

Issue 2443613002: Rename classes related to top controls (Closed)
Patch Set: fix test Created 4 years, 1 month 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
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/render_widget_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "cc/trees/layer_tree_host.h" 9 #include "cc/trees/layer_tree_host.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
11 #include "content/renderer/gpu/render_widget_compositor.h" 11 #include "content/renderer/gpu/render_widget_compositor.h"
12 #include "third_party/WebKit/public/web/WebView.h" 12 #include "third_party/WebKit/public/web/WebView.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 // Check content::TopControlsState, and blink::WebWidget::TopControlsState 16 // Check content::BrowserControlsState, and
17 // blink::WebWidget::BrowserControlsState
17 // are kept in sync. 18 // are kept in sync.
18 static_assert( 19 static_assert(int(BROWSER_CONTROLS_STATE_SHOWN) ==
19 int(TOP_CONTROLS_STATE_SHOWN) == int(blink::WebTopControlsShown), 20 int(blink::WebBrowserControlsShown),
20 "mismatching enums: SHOWN"); 21 "mismatching enums: SHOWN");
21 static_assert( 22 static_assert(int(BROWSER_CONTROLS_STATE_HIDDEN) ==
22 int(TOP_CONTROLS_STATE_HIDDEN) == int(blink::WebTopControlsHidden), 23 int(blink::WebBrowserControlsHidden),
23 "mismatching enums: HIDDEN"); 24 "mismatching enums: HIDDEN");
24 static_assert( 25 static_assert(int(BROWSER_CONTROLS_STATE_BOTH) ==
25 int(TOP_CONTROLS_STATE_BOTH) == int(blink::WebTopControlsBoth), 26 int(blink::WebBrowserControlsBoth),
26 "mismatching enums: BOTH"); 27 "mismatching enums: BOTH");
27 28
28 blink::WebTopControlsState ContentToBlink( 29 blink::WebBrowserControlsState ContentToBlink(BrowserControlsState state) {
29 TopControlsState state) { 30 return static_cast<blink::WebBrowserControlsState>(state);
30 return static_cast<blink::WebTopControlsState>(state);
31 } 31 }
32 32
33 33
34 // TODO(mvanouwerkerk): Stop calling this code path and delete it. 34 // TODO(mvanouwerkerk): Stop calling this code path and delete it.
35 void RenderViewImpl::OnUpdateTopControlsState(bool enable_hiding, 35 void RenderViewImpl::OnUpdateBrowserControlsState(bool enable_hiding,
36 bool enable_showing, 36 bool enable_showing,
37 bool animate) { 37 bool animate) {
38 // TODO(tedchoc): Investigate why messages are getting here before the 38 // TODO(tedchoc): Investigate why messages are getting here before the
39 // compositor has been initialized. 39 // compositor has been initialized.
40 LOG_IF(WARNING, !compositor_) << "OnUpdateTopControlsState was unhandled."; 40 LOG_IF(WARNING, !compositor_)
41 TopControlsState constraints = TOP_CONTROLS_STATE_BOTH; 41 << "OnUpdateBrowserControlsState was unhandled.";
42 BrowserControlsState constraints = BROWSER_CONTROLS_STATE_BOTH;
42 if (!enable_showing) 43 if (!enable_showing)
43 constraints = TOP_CONTROLS_STATE_HIDDEN; 44 constraints = BROWSER_CONTROLS_STATE_HIDDEN;
44 if (!enable_hiding) 45 if (!enable_hiding)
45 constraints = TOP_CONTROLS_STATE_SHOWN; 46 constraints = BROWSER_CONTROLS_STATE_SHOWN;
46 TopControlsState current = TOP_CONTROLS_STATE_BOTH; 47 BrowserControlsState current = BROWSER_CONTROLS_STATE_BOTH;
47 48
48 UpdateTopControlsState(constraints, current, animate); 49 UpdateBrowserControlsState(constraints, current, animate);
49 } 50 }
50 51
51 void RenderViewImpl::UpdateTopControlsState(TopControlsState constraints, 52 void RenderViewImpl::UpdateBrowserControlsState(
52 TopControlsState current, 53 BrowserControlsState constraints,
53 bool animate) { 54 BrowserControlsState current,
55 bool animate) {
54 if (GetWebWidget()) 56 if (GetWebWidget())
55 GetWebWidget()->updateTopControlsState(ContentToBlink(constraints), 57 GetWebWidget()->updateBrowserControlsState(
56 ContentToBlink(current), animate); 58 ContentToBlink(constraints), ContentToBlink(current), animate);
57 59
58 top_controls_constraints_ = constraints; 60 top_controls_constraints_ = constraints;
59 } 61 }
60 62
61 void RenderViewImpl::didScrollWithKeyboard(const blink::WebSize& delta) { 63 void RenderViewImpl::didScrollWithKeyboard(const blink::WebSize& delta) {
62 if (delta.height == 0) 64 if (delta.height == 0)
63 return; 65 return;
64 66
65 TopControlsState current = delta.height < 0 ? TOP_CONTROLS_STATE_SHOWN 67 BrowserControlsState current = delta.height < 0
66 : TOP_CONTROLS_STATE_HIDDEN; 68 ? BROWSER_CONTROLS_STATE_SHOWN
69 : BROWSER_CONTROLS_STATE_HIDDEN;
67 70
68 UpdateTopControlsState(top_controls_constraints_, current, true); 71 UpdateBrowserControlsState(top_controls_constraints_, current, true);
69 } 72 }
70 73
71 void RenderViewImpl::OnExtractSmartClipData(const gfx::Rect& rect) { 74 void RenderViewImpl::OnExtractSmartClipData(const gfx::Rect& rect) {
72 blink::WebString clip_text; 75 blink::WebString clip_text;
73 blink::WebString clip_html; 76 blink::WebString clip_html;
74 blink::WebRect clip_rect; 77 blink::WebRect clip_rect;
75 webview()->extractSmartClipData(rect, clip_text, clip_html, clip_rect); 78 webview()->extractSmartClipData(rect, clip_text, clip_html, clip_rect);
76 Send(new ViewHostMsg_SmartClipDataExtracted( 79 Send(new ViewHostMsg_SmartClipDataExtracted(
77 routing_id_, clip_text, clip_html, clip_rect)); 80 routing_id_, clip_text, clip_html, clip_rect));
78 } 81 }
79 82
80 } // namespace content 83 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/render_widget_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698