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/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 blink::WebWidget::TopControlsState |
17 // are kept in sync. | 17 // are kept in sync. |
18 static_assert( | 18 static_assert( |
19 int(TOP_CONTROLS_STATE_SHOWN) == int(blink::WebTopControlsShown), | 19 int(BROWSER_CONTROLS_STATE_SHOWN) == int(blink::WebTopControlsShown), |
20 "mismatching enums: SHOWN"); | 20 "mismatching enums: SHOWN"); |
21 static_assert( | 21 static_assert( |
22 int(TOP_CONTROLS_STATE_HIDDEN) == int(blink::WebTopControlsHidden), | 22 int(BROWSER_CONTROLS_STATE_HIDDEN) == int(blink::WebTopControlsHidden), |
23 "mismatching enums: HIDDEN"); | 23 "mismatching enums: HIDDEN"); |
24 static_assert( | 24 static_assert( |
25 int(TOP_CONTROLS_STATE_BOTH) == int(blink::WebTopControlsBoth), | 25 int(BROWSER_CONTROLS_STATE_BOTH) == int(blink::WebTopControlsBoth), |
26 "mismatching enums: BOTH"); | 26 "mismatching enums: BOTH"); |
27 | 27 |
28 blink::WebTopControlsState ContentToBlink( | 28 blink::WebTopControlsState ContentToBlink( |
29 TopControlsState state) { | 29 BrowserControlsState state) { |
30 return static_cast<blink::WebTopControlsState>(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::OnUpdateTopControlsState(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_) << "OnUpdateTopControlsState was unhandled."; |
aelias_OOO_until_Jul13
2016/10/21 18:44:21
OnUpdateBrowserControlsState
| |
41 TopControlsState constraints = TOP_CONTROLS_STATE_BOTH; | 41 BrowserControlsState constraints = BROWSER_CONTROLS_STATE_BOTH; |
42 if (!enable_showing) | 42 if (!enable_showing) |
43 constraints = TOP_CONTROLS_STATE_HIDDEN; | 43 constraints = BROWSER_CONTROLS_STATE_HIDDEN; |
44 if (!enable_hiding) | 44 if (!enable_hiding) |
45 constraints = TOP_CONTROLS_STATE_SHOWN; | 45 constraints = BROWSER_CONTROLS_STATE_SHOWN; |
46 TopControlsState current = TOP_CONTROLS_STATE_BOTH; | 46 BrowserControlsState current = BROWSER_CONTROLS_STATE_BOTH; |
47 | 47 |
48 UpdateTopControlsState(constraints, current, animate); | 48 UpdateTopControlsState(constraints, current, animate); |
49 } | 49 } |
50 | 50 |
51 void RenderViewImpl::UpdateTopControlsState(TopControlsState constraints, | 51 void RenderViewImpl::UpdateTopControlsState(BrowserControlsState constraints, |
52 TopControlsState current, | 52 BrowserControlsState current, |
53 bool animate) { | 53 bool animate) { |
54 if (GetWebWidget()) | 54 if (GetWebWidget()) |
55 GetWebWidget()->updateTopControlsState(ContentToBlink(constraints), | 55 GetWebWidget()->updateTopControlsState(ContentToBlink(constraints), |
56 ContentToBlink(current), animate); | 56 ContentToBlink(current), animate); |
57 | 57 |
58 top_controls_constraints_ = constraints; | 58 top_controls_constraints_ = constraints; |
59 } | 59 } |
60 | 60 |
61 void RenderViewImpl::didScrollWithKeyboard(const blink::WebSize& delta) { | 61 void RenderViewImpl::didScrollWithKeyboard(const blink::WebSize& delta) { |
62 if (delta.height == 0) | 62 if (delta.height == 0) |
63 return; | 63 return; |
64 | 64 |
65 TopControlsState current = delta.height < 0 ? TOP_CONTROLS_STATE_SHOWN | 65 BrowserControlsState current = delta.height < 0 ? BROWSER_CONTROLS_STATE_SHOWN |
66 : TOP_CONTROLS_STATE_HIDDEN; | 66 : BROWSER_CONTROLS_STATE_HIDDEN; |
67 | 67 |
68 UpdateTopControlsState(top_controls_constraints_, current, true); | 68 UpdateTopControlsState(top_controls_constraints_, current, true); |
69 } | 69 } |
70 | 70 |
71 void RenderViewImpl::OnExtractSmartClipData(const gfx::Rect& rect) { | 71 void RenderViewImpl::OnExtractSmartClipData(const gfx::Rect& rect) { |
72 blink::WebString clip_text; | 72 blink::WebString clip_text; |
73 blink::WebString clip_html; | 73 blink::WebString clip_html; |
74 blink::WebRect clip_rect; | 74 blink::WebRect clip_rect; |
75 webview()->extractSmartClipData(rect, clip_text, clip_html, clip_rect); | 75 webview()->extractSmartClipData(rect, clip_text, clip_html, clip_rect); |
76 Send(new ViewHostMsg_SmartClipDataExtracted( | 76 Send(new ViewHostMsg_SmartClipDataExtracted( |
77 routing_id_, clip_text, clip_html, clip_rect)); | 77 routing_id_, clip_text, clip_html, clip_rect)); |
78 } | 78 } |
79 | 79 |
80 } // namespace content | 80 } // namespace content |
OLD | NEW |