| 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 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 bool handled = true; | 1275 bool handled = true; |
| 1276 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1276 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
| 1277 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1277 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
| 1278 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1278 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
| 1279 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1279 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
| 1280 OnScrollFocusedEditableNodeIntoRect) | 1280 OnScrollFocusedEditableNodeIntoRect) |
| 1281 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1281 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
| 1282 OnSetEditCommandsForNextKeyEvent) | 1282 OnSetEditCommandsForNextKeyEvent) |
| 1283 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) | 1283 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) |
| 1284 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1284 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
| 1285 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | |
| 1286 OnSetZoomLevelForLoadingURL) | |
| 1287 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1285 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
| 1288 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1286 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
| 1289 OnResetPageEncodingToDefault) | 1287 OnResetPageEncodingToDefault) |
| 1290 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1288 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
| 1291 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1289 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
| 1292 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 1290 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
| 1293 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) | 1291 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
| 1294 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) | 1292 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) |
| 1295 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, | 1293 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, |
| 1296 OnDragSourceSystemDragEnded) | 1294 OnDragSourceSystemDragEnded) |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2249 zoom_level = static_cast<int>(old_zoom_level + zoom); | 2247 zoom_level = static_cast<int>(old_zoom_level + zoom); |
| 2250 } else { | 2248 } else { |
| 2251 // We're going towards 100%, so first go to the next whole number. | 2249 // We're going towards 100%, so first go to the next whole number. |
| 2252 zoom_level = static_cast<int>(old_zoom_level); | 2250 zoom_level = static_cast<int>(old_zoom_level); |
| 2253 } | 2251 } |
| 2254 } | 2252 } |
| 2255 SetZoomLevel(zoom_level); | 2253 SetZoomLevel(zoom_level); |
| 2256 zoomLevelChanged(); | 2254 zoomLevelChanged(); |
| 2257 } | 2255 } |
| 2258 | 2256 |
| 2259 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, | |
| 2260 double zoom_level) { | |
| 2261 // TODO(wjmaclean): We should see if this restriction is really necessary, | |
| 2262 // since it isn't enforced in other parts of the page zoom system (e.g. | |
| 2263 // when a users changes the zoom of a currently displayed page). Android | |
| 2264 // has no UI for this, so in theory the following code would normally just use | |
| 2265 // the default zoom anyways. | |
| 2266 #if !defined(OS_ANDROID) | |
| 2267 // On Android, page zoom isn't used, and in case of WebView, text zoom is used | |
| 2268 // for legacy WebView text scaling emulation. Thus, the code that resets | |
| 2269 // the zoom level from this map will be effectively resetting text zoom level. | |
| 2270 host_zoom_levels_[url] = zoom_level; | |
| 2271 #endif | |
| 2272 } | |
| 2273 | |
| 2274 void RenderViewImpl::OnSetZoomLevel( | 2257 void RenderViewImpl::OnSetZoomLevel( |
| 2275 PageMsg_SetZoomLevel_Command command, | 2258 PageMsg_SetZoomLevel_Command command, |
| 2276 double zoom_level) { | 2259 double zoom_level) { |
| 2277 switch (command) { | 2260 switch (command) { |
| 2278 case PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY: | 2261 case PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY: |
| 2279 uses_temporary_zoom_level_ = false; | 2262 uses_temporary_zoom_level_ = false; |
| 2280 break; | 2263 break; |
| 2281 case PageMsg_SetZoomLevel_Command::SET_TEMPORARY: | 2264 case PageMsg_SetZoomLevel_Command::SET_TEMPORARY: |
| 2282 uses_temporary_zoom_level_ = true; | 2265 uses_temporary_zoom_level_ = true; |
| 2283 break; | 2266 break; |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3080 return render_frame->focused_pepper_plugin(); | 3063 return render_frame->focused_pepper_plugin(); |
| 3081 } | 3064 } |
| 3082 frame = frame->traverseNext(false); | 3065 frame = frame->traverseNext(false); |
| 3083 } | 3066 } |
| 3084 | 3067 |
| 3085 return nullptr; | 3068 return nullptr; |
| 3086 } | 3069 } |
| 3087 #endif | 3070 #endif |
| 3088 | 3071 |
| 3089 } // namespace content | 3072 } // namespace content |
| OLD | NEW |