Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 954923005: Make command-zero reset page scale in addition to zoom level (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) 1289 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand)
1290 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) 1290 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret)
1291 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, 1291 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect,
1292 OnScrollFocusedEditableNodeIntoRect) 1292 OnScrollFocusedEditableNodeIntoRect)
1293 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, 1293 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent,
1294 OnSetEditCommandsForNextKeyEvent) 1294 OnSetEditCommandsForNextKeyEvent)
1295 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) 1295 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
1296 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) 1296 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt)
1297 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) 1297 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
1298 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) 1298 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
1299 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageScale, OnResetPageScale)
1299 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) 1300 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
1300 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, 1301 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL,
1301 OnSetZoomLevelForLoadingURL) 1302 OnSetZoomLevelForLoadingURL)
1302 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView, 1303 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView,
1303 OnSetZoomLevelForView) 1304 OnSetZoomLevelForView)
1304 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) 1305 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
1305 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, 1306 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault,
1306 OnResetPageEncodingToDefault) 1307 OnResetPageEncodingToDefault)
1307 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent) 1308 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent)
1308 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) 1309 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter)
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
2729 } 2730 }
2730 2731
2731 gfx::RectF active_rect = main_frame->activeFindMatchRect(); 2732 gfx::RectF active_rect = main_frame->activeFindMatchRect();
2732 Send(new ViewHostMsg_FindMatchRects_Reply(routing_id_, 2733 Send(new ViewHostMsg_FindMatchRects_Reply(routing_id_,
2733 rects_version, 2734 rects_version,
2734 match_rects, 2735 match_rects,
2735 active_rect)); 2736 active_rect));
2736 } 2737 }
2737 #endif 2738 #endif
2738 2739
2740 void RenderViewImpl::OnResetPageScale() {
2741 if (!webview())
2742 return;
2743 webview()->setPageScaleFactor(1);
2744 }
2745
2739 void RenderViewImpl::OnZoom(PageZoom zoom) { 2746 void RenderViewImpl::OnZoom(PageZoom zoom) {
2740 if (!webview()) // Not sure if this can happen, but no harm in being safe. 2747 if (!webview()) // Not sure if this can happen, but no harm in being safe.
2741 return; 2748 return;
2742 2749
2743 webview()->hidePopups(); 2750 webview()->hidePopups();
2744 2751
2745 double old_zoom_level = webview()->zoomLevel(); 2752 double old_zoom_level = webview()->zoomLevel();
2746 double zoom_level; 2753 double zoom_level;
2747 if (zoom == PAGE_ZOOM_RESET) { 2754 if (zoom == PAGE_ZOOM_RESET) {
2748 zoom_level = 0; 2755 zoom_level = 0;
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
4057 std::vector<gfx::Size> sizes; 4064 std::vector<gfx::Size> sizes;
4058 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4065 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4059 if (!url.isEmpty()) 4066 if (!url.isEmpty())
4060 urls.push_back( 4067 urls.push_back(
4061 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4068 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4062 } 4069 }
4063 SendUpdateFaviconURL(urls); 4070 SendUpdateFaviconURL(urls);
4064 } 4071 }
4065 4072
4066 } // namespace content 4073 } // namespace content
OLDNEW
« chrome/browser/ui/browser_command_controller.cc ('K') | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698