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) |
1285 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1287 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
1286 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1288 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
1287 OnResetPageEncodingToDefault) | 1289 OnResetPageEncodingToDefault) |
1288 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1290 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
1289 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1291 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
1290 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 1292 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
1291 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) | 1293 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
1292 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) | 1294 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) |
1293 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, | 1295 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, |
1294 OnDragSourceSystemDragEnded) | 1296 OnDragSourceSystemDragEnded) |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2247 zoom_level = static_cast<int>(old_zoom_level + zoom); | 2249 zoom_level = static_cast<int>(old_zoom_level + zoom); |
2248 } else { | 2250 } else { |
2249 // We're going towards 100%, so first go to the next whole number. | 2251 // We're going towards 100%, so first go to the next whole number. |
2250 zoom_level = static_cast<int>(old_zoom_level); | 2252 zoom_level = static_cast<int>(old_zoom_level); |
2251 } | 2253 } |
2252 } | 2254 } |
2253 SetZoomLevel(zoom_level); | 2255 SetZoomLevel(zoom_level); |
2254 zoomLevelChanged(); | 2256 zoomLevelChanged(); |
2255 } | 2257 } |
2256 | 2258 |
| 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 |
2257 void RenderViewImpl::OnSetZoomLevel( | 2274 void RenderViewImpl::OnSetZoomLevel( |
2258 PageMsg_SetZoomLevel_Command command, | 2275 PageMsg_SetZoomLevel_Command command, |
2259 double zoom_level) { | 2276 double zoom_level) { |
2260 switch (command) { | 2277 switch (command) { |
2261 case PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY: | 2278 case PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY: |
2262 uses_temporary_zoom_level_ = false; | 2279 uses_temporary_zoom_level_ = false; |
2263 break; | 2280 break; |
2264 case PageMsg_SetZoomLevel_Command::SET_TEMPORARY: | 2281 case PageMsg_SetZoomLevel_Command::SET_TEMPORARY: |
2265 uses_temporary_zoom_level_ = true; | 2282 uses_temporary_zoom_level_ = true; |
2266 break; | 2283 break; |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3063 return render_frame->focused_pepper_plugin(); | 3080 return render_frame->focused_pepper_plugin(); |
3064 } | 3081 } |
3065 frame = frame->traverseNext(false); | 3082 frame = frame->traverseNext(false); |
3066 } | 3083 } |
3067 | 3084 |
3068 return nullptr; | 3085 return nullptr; |
3069 } | 3086 } |
3070 #endif | 3087 #endif |
3071 | 3088 |
3072 } // namespace content | 3089 } // namespace content |
OLD | NEW |