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 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1292 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1292 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
| 1293 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1293 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
| 1294 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1294 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
| 1295 OnScrollFocusedEditableNodeIntoRect) | 1295 OnScrollFocusedEditableNodeIntoRect) |
| 1296 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1296 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
| 1297 OnSetEditCommandsForNextKeyEvent) | 1297 OnSetEditCommandsForNextKeyEvent) |
| 1298 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 1298 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
| 1299 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) | 1299 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) |
| 1300 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) | 1300 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) |
| 1301 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) | 1301 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) |
| 1302 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) | |
| 1302 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageScale, OnResetPageScale) | 1303 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageScale, OnResetPageScale) |
|
wjmaclean
2015/10/19 15:43:28
Ditto, perhaps we can remove this.
Kevin McNee - google account
2015/10/20 15:13:43
Done.
| |
| 1303 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1304 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
| 1304 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 1305 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
| 1305 OnSetZoomLevelForLoadingURL) | 1306 OnSetZoomLevelForLoadingURL) |
| 1306 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView, | 1307 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView, |
| 1307 OnSetZoomLevelForView) | 1308 OnSetZoomLevelForView) |
| 1308 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1309 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
| 1309 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1310 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
| 1310 OnResetPageEncodingToDefault) | 1311 OnResetPageEncodingToDefault) |
| 1311 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1312 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
| 1312 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1313 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
| (...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2458 } | 2459 } |
| 2459 | 2460 |
| 2460 gfx::RectF active_rect = main_frame->activeFindMatchRect(); | 2461 gfx::RectF active_rect = main_frame->activeFindMatchRect(); |
| 2461 Send(new ViewHostMsg_FindMatchRects_Reply(routing_id_, | 2462 Send(new ViewHostMsg_FindMatchRects_Reply(routing_id_, |
| 2462 rects_version, | 2463 rects_version, |
| 2463 match_rects, | 2464 match_rects, |
| 2464 active_rect)); | 2465 active_rect)); |
| 2465 } | 2466 } |
| 2466 #endif | 2467 #endif |
| 2467 | 2468 |
| 2469 void RenderViewImpl::OnSetPageScale(float page_scale_factor) { | |
| 2470 // TODO(mcnee): RenderViewImpl deprecated, move to RenderFrameImpl? | |
| 2471 if (!webview()) | |
| 2472 return; | |
| 2473 webview()->setPageScaleFactor(page_scale_factor); | |
| 2474 } | |
| 2475 | |
| 2468 void RenderViewImpl::OnResetPageScale() { | 2476 void RenderViewImpl::OnResetPageScale() { |
|
wjmaclean
2015/10/19 15:43:28
This can probably go away too ...
Kevin McNee - google account
2015/10/20 15:13:43
Done.
| |
| 2469 if (!webview()) | 2477 if (!webview()) |
| 2470 return; | 2478 return; |
| 2471 webview()->setPageScaleFactor(1); | 2479 webview()->setPageScaleFactor(1); |
| 2472 } | 2480 } |
| 2473 | 2481 |
| 2474 void RenderViewImpl::OnZoom(PageZoom zoom) { | 2482 void RenderViewImpl::OnZoom(PageZoom zoom) { |
| 2475 if (!webview()) // Not sure if this can happen, but no harm in being safe. | 2483 if (!webview()) // Not sure if this can happen, but no harm in being safe. |
| 2476 return; | 2484 return; |
| 2477 | 2485 |
| 2478 webview()->hidePopups(); | 2486 webview()->hidePopups(); |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3369 // saved values if necessary | 3377 // saved values if necessary |
| 3370 Send(new ViewHostMsg_DidZoomURL( | 3378 Send(new ViewHostMsg_DidZoomURL( |
| 3371 routing_id_, zoom_level, | 3379 routing_id_, zoom_level, |
| 3372 GURL(webview()->mainFrame()->document().url()))); | 3380 GURL(webview()->mainFrame()->document().url()))); |
| 3373 } | 3381 } |
| 3374 } | 3382 } |
| 3375 | 3383 |
| 3376 void RenderViewImpl::pageScaleFactorChanged() { | 3384 void RenderViewImpl::pageScaleFactorChanged() { |
| 3377 if (!webview()) | 3385 if (!webview()) |
| 3378 return; | 3386 return; |
| 3387 | |
| 3388 // TODO(mcnee): RenderViewImpl deprecated, move to RenderFrameImpl? | |
| 3389 Send(new ViewHostMsg_PageScaleFactorChanged(routing_id_, | |
|
wjmaclean
2015/10/19 15:43:29
Yeah, but for now this is here, so I guess we modi
Kevin McNee - google account
2015/10/20 15:13:43
Acknowledged.
| |
| 3390 webview()->pageScaleFactor())); | |
| 3391 | |
| 3392 // TODO(mcnee): now that we send all changes, should we get rid of this msg | |
| 3393 // and have the browser handle this logic? | |
|
wjmaclean
2015/10/19 15:43:28
Yes, remove the extra message.
Kevin McNee - google account
2015/10/20 15:13:43
Done.
| |
| 3379 bool page_scale_factor_is_one = webview()->pageScaleFactor() == 1; | 3394 bool page_scale_factor_is_one = webview()->pageScaleFactor() == 1; |
| 3380 if (page_scale_factor_is_one == page_scale_factor_is_one_) | 3395 if (page_scale_factor_is_one == page_scale_factor_is_one_) |
| 3381 return; | 3396 return; |
| 3382 page_scale_factor_is_one_ = page_scale_factor_is_one; | 3397 page_scale_factor_is_one_ = page_scale_factor_is_one; |
| 3383 Send(new ViewHostMsg_PageScaleFactorIsOneChanged(routing_id_, | 3398 Send(new ViewHostMsg_PageScaleFactorIsOneChanged(routing_id_, |
| 3384 page_scale_factor_is_one_)); | 3399 page_scale_factor_is_one_)); |
| 3385 } | 3400 } |
| 3386 | 3401 |
| 3387 double RenderViewImpl::zoomLevelToZoomFactor(double zoom_level) const { | 3402 double RenderViewImpl::zoomLevelToZoomFactor(double zoom_level) const { |
| 3388 return ZoomLevelToZoomFactor(zoom_level); | 3403 return ZoomLevelToZoomFactor(zoom_level); |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3690 std::vector<gfx::Size> sizes; | 3705 std::vector<gfx::Size> sizes; |
| 3691 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3706 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 3692 if (!url.isEmpty()) | 3707 if (!url.isEmpty()) |
| 3693 urls.push_back( | 3708 urls.push_back( |
| 3694 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3709 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 3695 } | 3710 } |
| 3696 SendUpdateFaviconURL(urls); | 3711 SendUpdateFaviconURL(urls); |
| 3697 } | 3712 } |
| 3698 | 3713 |
| 3699 } // namespace content | 3714 } // namespace content |
| OLD | NEW |