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 <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 // Page messages. | 1245 // Page messages. |
1246 IPC_MESSAGE_HANDLER(PageMsg_UpdateWindowScreenRect, | 1246 IPC_MESSAGE_HANDLER(PageMsg_UpdateWindowScreenRect, |
1247 OnUpdateWindowScreenRect) | 1247 OnUpdateWindowScreenRect) |
1248 IPC_MESSAGE_HANDLER(PageMsg_SetZoomLevel, OnSetZoomLevel) | 1248 IPC_MESSAGE_HANDLER(PageMsg_SetZoomLevel, OnSetZoomLevel) |
1249 IPC_MESSAGE_HANDLER(PageMsg_SetDeviceScaleFactor, OnSetDeviceScaleFactor); | 1249 IPC_MESSAGE_HANDLER(PageMsg_SetDeviceScaleFactor, OnSetDeviceScaleFactor); |
1250 IPC_MESSAGE_HANDLER(PageMsg_WasHidden, OnPageWasHidden) | 1250 IPC_MESSAGE_HANDLER(PageMsg_WasHidden, OnPageWasHidden) |
1251 IPC_MESSAGE_HANDLER(PageMsg_WasShown, OnPageWasShown) | 1251 IPC_MESSAGE_HANDLER(PageMsg_WasShown, OnPageWasShown) |
1252 IPC_MESSAGE_HANDLER(PageMsg_SetHistoryOffsetAndLength, | 1252 IPC_MESSAGE_HANDLER(PageMsg_SetHistoryOffsetAndLength, |
1253 OnSetHistoryOffsetAndLength) | 1253 OnSetHistoryOffsetAndLength) |
1254 IPC_MESSAGE_HANDLER(PageMsg_AudioStateChanged, OnAudioStateChanged) | 1254 IPC_MESSAGE_HANDLER(PageMsg_AudioStateChanged, OnAudioStateChanged) |
| 1255 IPC_MESSAGE_HANDLER(PageMsg_UpdateScreenInfo, OnUpdateScreenInfo) |
1255 | 1256 |
1256 #if defined(OS_ANDROID) | 1257 #if defined(OS_ANDROID) |
1257 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserControlsState, | 1258 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserControlsState, |
1258 OnUpdateBrowserControlsState) | 1259 OnUpdateBrowserControlsState) |
1259 #elif defined(OS_MACOSX) | 1260 #elif defined(OS_MACOSX) |
1260 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText, | 1261 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText, |
1261 OnGetRenderedText) | 1262 OnGetRenderedText) |
1262 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 1263 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
1263 #endif | 1264 #endif |
1264 // Adding a new message? Add platform independent ones first, then put the | 1265 // Adding a new message? Add platform independent ones first, then put the |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 webview()->AcceptLanguagesChanged(); | 2127 webview()->AcceptLanguagesChanged(); |
2127 } | 2128 } |
2128 } | 2129 } |
2129 | 2130 |
2130 void RenderViewImpl::OnMediaPlayerActionAt(const gfx::Point& location, | 2131 void RenderViewImpl::OnMediaPlayerActionAt(const gfx::Point& location, |
2131 const WebMediaPlayerAction& action) { | 2132 const WebMediaPlayerAction& action) { |
2132 if (webview()) | 2133 if (webview()) |
2133 webview()->PerformMediaPlayerAction(action, location); | 2134 webview()->PerformMediaPlayerAction(action, location); |
2134 } | 2135 } |
2135 | 2136 |
2136 void RenderViewImpl::OnOrientationChange() { | |
2137 if (webview() && webview()->MainFrame()->IsWebLocalFrame()) | |
2138 webview()->MainFrame()->ToWebLocalFrame()->SendOrientationChangeEvent(); | |
2139 } | |
2140 | |
2141 void RenderViewImpl::OnPluginActionAt(const gfx::Point& location, | 2137 void RenderViewImpl::OnPluginActionAt(const gfx::Point& location, |
2142 const WebPluginAction& action) { | 2138 const WebPluginAction& action) { |
2143 if (webview()) | 2139 if (webview()) |
2144 webview()->PerformPluginAction(action, location); | 2140 webview()->PerformPluginAction(action, location); |
2145 } | 2141 } |
2146 | 2142 |
2147 void RenderViewImpl::OnClosePage() { | 2143 void RenderViewImpl::OnClosePage() { |
2148 for (auto& observer : observers_) | 2144 for (auto& observer : observers_) |
2149 observer.ClosePage(); | 2145 observer.ClosePage(); |
2150 // TODO(creis): We'd rather use webview()->Close() here, but that currently | 2146 // TODO(creis): We'd rather use webview()->Close() here, but that currently |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 #endif | 2267 #endif |
2272 | 2268 |
2273 if (webview()) { | 2269 if (webview()) { |
2274 blink::WebPageVisibilityState visibilityState = | 2270 blink::WebPageVisibilityState visibilityState = |
2275 GetMainRenderFrame() ? GetMainRenderFrame()->VisibilityState() | 2271 GetMainRenderFrame() ? GetMainRenderFrame()->VisibilityState() |
2276 : blink::kWebPageVisibilityStateVisible; | 2272 : blink::kWebPageVisibilityStateVisible; |
2277 webview()->SetVisibilityState(visibilityState, false); | 2273 webview()->SetVisibilityState(visibilityState, false); |
2278 } | 2274 } |
2279 } | 2275 } |
2280 | 2276 |
| 2277 void RenderViewImpl::OnUpdateScreenInfo(const ScreenInfo& screen_info) { |
| 2278 // This IPC only updates the screen info on RenderViews that have a remote |
| 2279 // main frame. For local main frames, the ScreenInfo is updated in |
| 2280 // ViewMsg_Resize. |
| 2281 if (!main_render_frame_) |
| 2282 screen_info_ = screen_info; |
| 2283 } |
| 2284 |
2281 GURL RenderViewImpl::GetURLForGraphicsContext3D() { | 2285 GURL RenderViewImpl::GetURLForGraphicsContext3D() { |
2282 DCHECK(webview()); | 2286 DCHECK(webview()); |
2283 if (webview()->MainFrame()->IsWebLocalFrame()) | 2287 if (webview()->MainFrame()->IsWebLocalFrame()) |
2284 return GURL(webview()->MainFrame()->GetDocument().Url()); | 2288 return GURL(webview()->MainFrame()->GetDocument().Url()); |
2285 else | 2289 else |
2286 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); | 2290 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); |
2287 } | 2291 } |
2288 | 2292 |
2289 void RenderViewImpl::OnSetFocus(bool enable) { | 2293 void RenderViewImpl::OnSetFocus(bool enable) { |
2290 // This message must always be received when the main frame is a | 2294 // This message must always be received when the main frame is a |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2660 input_event.GetCoalescedEventsPointers(), latency_info, | 2664 input_event.GetCoalescedEventsPointers(), latency_info, |
2661 dispatch_type); | 2665 dispatch_type); |
2662 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 2666 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
2663 } | 2667 } |
2664 idle_user_detector_->ActivityDetected(); | 2668 idle_user_detector_->ActivityDetected(); |
2665 return RenderWidget::HandleInputEvent(input_event, latency_info, | 2669 return RenderWidget::HandleInputEvent(input_event, latency_info, |
2666 dispatch_type); | 2670 dispatch_type); |
2667 } | 2671 } |
2668 | 2672 |
2669 } // namespace content | 2673 } // namespace content |
OLD | NEW |