| 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 #endif | 651 #endif |
| 652 #if defined(OS_WIN) | 652 #if defined(OS_WIN) |
| 653 focused_plugin_id_(-1), | 653 focused_plugin_id_(-1), |
| 654 #endif | 654 #endif |
| 655 #if defined(ENABLE_PLUGINS) | 655 #if defined(ENABLE_PLUGINS) |
| 656 plugin_find_handler_(NULL), | 656 plugin_find_handler_(NULL), |
| 657 focused_pepper_plugin_(NULL), | 657 focused_pepper_plugin_(NULL), |
| 658 pepper_last_mouse_event_target_(NULL), | 658 pepper_last_mouse_event_target_(NULL), |
| 659 #endif | 659 #endif |
| 660 enumeration_completion_id_(0), | 660 enumeration_completion_id_(0), |
| 661 session_storage_namespace_id_(params.session_storage_namespace_id), | 661 session_storage_namespace_id_(params.session_storage_namespace_id) { |
| 662 page_scale_factor_is_one_(true) { | |
| 663 } | 662 } |
| 664 | 663 |
| 665 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, | 664 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, |
| 666 bool was_created_by_renderer) { | 665 bool was_created_by_renderer) { |
| 667 routing_id_ = params.view_id; | 666 routing_id_ = params.view_id; |
| 668 | 667 |
| 669 int opener_view_routing_id; | 668 int opener_view_routing_id; |
| 670 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( | 669 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( |
| 671 params.opener_frame_route_id, &opener_view_routing_id); | 670 params.opener_frame_route_id, &opener_view_routing_id); |
| 672 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer) | 671 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer) |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1292 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
| 1294 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1293 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
| 1295 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1294 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
| 1296 OnScrollFocusedEditableNodeIntoRect) | 1295 OnScrollFocusedEditableNodeIntoRect) |
| 1297 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1296 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
| 1298 OnSetEditCommandsForNextKeyEvent) | 1297 OnSetEditCommandsForNextKeyEvent) |
| 1299 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 1298 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
| 1300 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) | 1299 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) |
| 1301 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) | 1300 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) |
| 1302 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) | 1301 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) |
| 1303 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageScale, OnResetPageScale) | 1302 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) |
| 1304 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1303 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
| 1305 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 1304 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
| 1306 OnSetZoomLevelForLoadingURL) | 1305 OnSetZoomLevelForLoadingURL) |
| 1307 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView, | 1306 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView, |
| 1308 OnSetZoomLevelForView) | 1307 OnSetZoomLevelForView) |
| 1309 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1308 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
| 1310 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1309 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
| 1311 OnResetPageEncodingToDefault) | 1310 OnResetPageEncodingToDefault) |
| 1312 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1311 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
| 1313 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1312 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
| (...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2451 } | 2450 } |
| 2452 | 2451 |
| 2453 gfx::RectF active_rect = main_frame->activeFindMatchRect(); | 2452 gfx::RectF active_rect = main_frame->activeFindMatchRect(); |
| 2454 Send(new ViewHostMsg_FindMatchRects_Reply(routing_id_, | 2453 Send(new ViewHostMsg_FindMatchRects_Reply(routing_id_, |
| 2455 rects_version, | 2454 rects_version, |
| 2456 match_rects, | 2455 match_rects, |
| 2457 active_rect)); | 2456 active_rect)); |
| 2458 } | 2457 } |
| 2459 #endif | 2458 #endif |
| 2460 | 2459 |
| 2461 void RenderViewImpl::OnResetPageScale() { | 2460 void RenderViewImpl::OnSetPageScale(float page_scale_factor) { |
| 2462 if (!webview()) | 2461 if (!webview()) |
| 2463 return; | 2462 return; |
| 2464 webview()->setPageScaleFactor(1); | 2463 webview()->setPageScaleFactor(page_scale_factor); |
| 2465 } | 2464 } |
| 2466 | 2465 |
| 2467 void RenderViewImpl::OnZoom(PageZoom zoom) { | 2466 void RenderViewImpl::OnZoom(PageZoom zoom) { |
| 2468 if (!webview()) // Not sure if this can happen, but no harm in being safe. | 2467 if (!webview()) // Not sure if this can happen, but no harm in being safe. |
| 2469 return; | 2468 return; |
| 2470 | 2469 |
| 2471 webview()->hidePopups(); | 2470 webview()->hidePopups(); |
| 2472 | 2471 |
| 2473 double old_zoom_level = webview()->zoomLevel(); | 2472 double old_zoom_level = webview()->zoomLevel(); |
| 2474 double zoom_level; | 2473 double zoom_level; |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3364 // saved values if necessary | 3363 // saved values if necessary |
| 3365 Send(new ViewHostMsg_DidZoomURL( | 3364 Send(new ViewHostMsg_DidZoomURL( |
| 3366 routing_id_, zoom_level, | 3365 routing_id_, zoom_level, |
| 3367 GURL(webview()->mainFrame()->document().url()))); | 3366 GURL(webview()->mainFrame()->document().url()))); |
| 3368 } | 3367 } |
| 3369 } | 3368 } |
| 3370 | 3369 |
| 3371 void RenderViewImpl::pageScaleFactorChanged() { | 3370 void RenderViewImpl::pageScaleFactorChanged() { |
| 3372 if (!webview()) | 3371 if (!webview()) |
| 3373 return; | 3372 return; |
| 3374 bool page_scale_factor_is_one = webview()->pageScaleFactor() == 1; | 3373 |
| 3375 if (page_scale_factor_is_one == page_scale_factor_is_one_) | 3374 Send(new ViewHostMsg_PageScaleFactorChanged(routing_id_, |
| 3376 return; | 3375 webview()->pageScaleFactor())); |
| 3377 page_scale_factor_is_one_ = page_scale_factor_is_one; | |
| 3378 Send(new ViewHostMsg_PageScaleFactorIsOneChanged(routing_id_, | |
| 3379 page_scale_factor_is_one_)); | |
| 3380 } | 3376 } |
| 3381 | 3377 |
| 3382 double RenderViewImpl::zoomLevelToZoomFactor(double zoom_level) const { | 3378 double RenderViewImpl::zoomLevelToZoomFactor(double zoom_level) const { |
| 3383 return ZoomLevelToZoomFactor(zoom_level); | 3379 return ZoomLevelToZoomFactor(zoom_level); |
| 3384 } | 3380 } |
| 3385 | 3381 |
| 3386 double RenderViewImpl::zoomFactorToZoomLevel(double factor) const { | 3382 double RenderViewImpl::zoomFactorToZoomLevel(double factor) const { |
| 3387 return ZoomFactorToZoomLevel(factor); | 3383 return ZoomFactorToZoomLevel(factor); |
| 3388 } | 3384 } |
| 3389 | 3385 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3685 std::vector<gfx::Size> sizes; | 3681 std::vector<gfx::Size> sizes; |
| 3686 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3682 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 3687 if (!url.isEmpty()) | 3683 if (!url.isEmpty()) |
| 3688 urls.push_back( | 3684 urls.push_back( |
| 3689 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3685 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 3690 } | 3686 } |
| 3691 SendUpdateFaviconURL(urls); | 3687 SendUpdateFaviconURL(urls); |
| 3692 } | 3688 } |
| 3693 | 3689 |
| 3694 } // namespace content | 3690 } // namespace content |
| OLD | NEW |