Chromium Code Reviews| 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 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1244 // Page messages. | 1244 // Page messages. |
| 1245 IPC_MESSAGE_HANDLER(PageMsg_UpdateWindowScreenRect, | 1245 IPC_MESSAGE_HANDLER(PageMsg_UpdateWindowScreenRect, |
| 1246 OnUpdateWindowScreenRect) | 1246 OnUpdateWindowScreenRect) |
| 1247 IPC_MESSAGE_HANDLER(PageMsg_SetZoomLevel, OnSetZoomLevel) | 1247 IPC_MESSAGE_HANDLER(PageMsg_SetZoomLevel, OnSetZoomLevel) |
| 1248 IPC_MESSAGE_HANDLER(PageMsg_SetDeviceScaleFactor, OnSetDeviceScaleFactor); | 1248 IPC_MESSAGE_HANDLER(PageMsg_SetDeviceScaleFactor, OnSetDeviceScaleFactor); |
| 1249 IPC_MESSAGE_HANDLER(PageMsg_WasHidden, OnPageWasHidden) | 1249 IPC_MESSAGE_HANDLER(PageMsg_WasHidden, OnPageWasHidden) |
| 1250 IPC_MESSAGE_HANDLER(PageMsg_WasShown, OnPageWasShown) | 1250 IPC_MESSAGE_HANDLER(PageMsg_WasShown, OnPageWasShown) |
| 1251 IPC_MESSAGE_HANDLER(PageMsg_SetHistoryOffsetAndLength, | 1251 IPC_MESSAGE_HANDLER(PageMsg_SetHistoryOffsetAndLength, |
| 1252 OnSetHistoryOffsetAndLength) | 1252 OnSetHistoryOffsetAndLength) |
| 1253 IPC_MESSAGE_HANDLER(PageMsg_AudioStateChanged, OnAudioStateChanged) | 1253 IPC_MESSAGE_HANDLER(PageMsg_AudioStateChanged, OnAudioStateChanged) |
| 1254 IPC_MESSAGE_HANDLER(PageMsg_UpdateScreenInfo, OnUpdateScreenInfo) | |
| 1254 | 1255 |
| 1255 #if defined(OS_ANDROID) | 1256 #if defined(OS_ANDROID) |
| 1256 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserControlsState, | 1257 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserControlsState, |
| 1257 OnUpdateBrowserControlsState) | 1258 OnUpdateBrowserControlsState) |
| 1258 #elif defined(OS_MACOSX) | 1259 #elif defined(OS_MACOSX) |
| 1259 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText, | 1260 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText, |
| 1260 OnGetRenderedText) | 1261 OnGetRenderedText) |
| 1261 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 1262 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
| 1262 #endif | 1263 #endif |
| 1263 // Adding a new message? Add platform independent ones first, then put the | 1264 // Adding a new message? Add platform independent ones first, then put the |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2146 webview()->AcceptLanguagesChanged(); | 2147 webview()->AcceptLanguagesChanged(); |
| 2147 } | 2148 } |
| 2148 } | 2149 } |
| 2149 | 2150 |
| 2150 void RenderViewImpl::OnMediaPlayerActionAt(const gfx::Point& location, | 2151 void RenderViewImpl::OnMediaPlayerActionAt(const gfx::Point& location, |
| 2151 const WebMediaPlayerAction& action) { | 2152 const WebMediaPlayerAction& action) { |
| 2152 if (webview()) | 2153 if (webview()) |
| 2153 webview()->PerformMediaPlayerAction(action, location); | 2154 webview()->PerformMediaPlayerAction(action, location); |
| 2154 } | 2155 } |
| 2155 | 2156 |
| 2156 void RenderViewImpl::OnOrientationChange() { | |
| 2157 if (webview() && webview()->MainFrame()->IsWebLocalFrame()) | |
| 2158 webview()->MainFrame()->ToWebLocalFrame()->SendOrientationChangeEvent(); | |
| 2159 } | |
| 2160 | |
| 2161 void RenderViewImpl::OnPluginActionAt(const gfx::Point& location, | 2157 void RenderViewImpl::OnPluginActionAt(const gfx::Point& location, |
| 2162 const WebPluginAction& action) { | 2158 const WebPluginAction& action) { |
| 2163 if (webview()) | 2159 if (webview()) |
| 2164 webview()->PerformPluginAction(action, location); | 2160 webview()->PerformPluginAction(action, location); |
| 2165 } | 2161 } |
| 2166 | 2162 |
| 2167 void RenderViewImpl::OnClosePage() { | 2163 void RenderViewImpl::OnClosePage() { |
| 2168 for (auto& observer : observers_) | 2164 for (auto& observer : observers_) |
| 2169 observer.ClosePage(); | 2165 observer.ClosePage(); |
| 2170 // TODO(creis): We'd rather use webview()->Close() here, but that currently | 2166 // 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... | |
| 2291 #endif | 2287 #endif |
| 2292 | 2288 |
| 2293 if (webview()) { | 2289 if (webview()) { |
| 2294 blink::WebPageVisibilityState visibilityState = | 2290 blink::WebPageVisibilityState visibilityState = |
| 2295 GetMainRenderFrame() ? GetMainRenderFrame()->VisibilityState() | 2291 GetMainRenderFrame() ? GetMainRenderFrame()->VisibilityState() |
| 2296 : blink::kWebPageVisibilityStateVisible; | 2292 : blink::kWebPageVisibilityStateVisible; |
| 2297 webview()->SetVisibilityState(visibilityState, false); | 2293 webview()->SetVisibilityState(visibilityState, false); |
| 2298 } | 2294 } |
| 2299 } | 2295 } |
| 2300 | 2296 |
| 2297 void RenderViewImpl::OnUpdateScreenInfo(const ScreenInfo& screen_info) { | |
| 2298 // This IPC only updates the screen info on RenderViews that have a remote | |
| 2299 // main frame. For local main frames, the ScreenInfo is updated in | |
| 2300 // ViewMsg_Resize. | |
|
dcheng
2017/04/25 13:10:44
Is this something we'll be able to consolidate eve
lfg
2017/04/25 15:44:31
I've implemented it this way so the OOPIF-change w
dcheng
2017/04/25 23:32:05
It's not clear to me from the CL description how s
| |
| 2301 if (!main_render_frame_) | |
| 2302 screen_info_ = screen_info; | |
| 2303 } | |
| 2304 | |
| 2301 GURL RenderViewImpl::GetURLForGraphicsContext3D() { | 2305 GURL RenderViewImpl::GetURLForGraphicsContext3D() { |
| 2302 DCHECK(webview()); | 2306 DCHECK(webview()); |
| 2303 if (webview()->MainFrame()->IsWebLocalFrame()) | 2307 if (webview()->MainFrame()->IsWebLocalFrame()) |
| 2304 return GURL(webview()->MainFrame()->GetDocument().Url()); | 2308 return GURL(webview()->MainFrame()->GetDocument().Url()); |
| 2305 else | 2309 else |
| 2306 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); | 2310 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); |
| 2307 } | 2311 } |
| 2308 | 2312 |
| 2309 void RenderViewImpl::OnSetFocus(bool enable) { | 2313 void RenderViewImpl::OnSetFocus(bool enable) { |
| 2310 // This message must always be received when the main frame is a | 2314 // 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... | |
| 2680 input_event.GetCoalescedEventsPointers(), latency_info, | 2684 input_event.GetCoalescedEventsPointers(), latency_info, |
| 2681 dispatch_type); | 2685 dispatch_type); |
| 2682 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 2686 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
| 2683 } | 2687 } |
| 2684 idle_user_detector_->ActivityDetected(); | 2688 idle_user_detector_->ActivityDetected(); |
| 2685 return RenderWidget::HandleInputEvent(input_event, latency_info, | 2689 return RenderWidget::HandleInputEvent(input_event, latency_info, |
| 2686 dispatch_type); | 2690 dispatch_type); |
| 2687 } | 2691 } |
| 2688 | 2692 |
| 2689 } // namespace content | 2693 } // namespace content |
| OLD | NEW |