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

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

Issue 8636001: Removing TOUCH_UI from content renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove 2 files handled (better) in another CL. Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 3551 matching lines...) Expand 10 before | Expand all | Expand 10 after
3562 // Send the search result over to the browser process. 3562 // Send the search result over to the browser process.
3563 Send(queued_find_reply_message_.release()); 3563 Send(queued_find_reply_message_.release());
3564 } 3564 }
3565 } 3565 }
3566 3566
3567 void RenderViewImpl::OnZoom(content::PageZoom zoom) { 3567 void RenderViewImpl::OnZoom(content::PageZoom zoom) {
3568 if (!webview()) // Not sure if this can happen, but no harm in being safe. 3568 if (!webview()) // Not sure if this can happen, but no harm in being safe.
3569 return; 3569 return;
3570 3570
3571 webview()->hidePopups(); 3571 webview()->hidePopups();
3572 #if !defined(TOUCH_UI) 3572
3573 double old_zoom_level = webview()->zoomLevel(); 3573 double old_zoom_level = webview()->zoomLevel();
3574 double zoom_level; 3574 double zoom_level;
3575 if (zoom == content::PAGE_ZOOM_RESET) { 3575 if (zoom == content::PAGE_ZOOM_RESET) {
3576 zoom_level = 0; 3576 zoom_level = 0;
3577 } else if (static_cast<int>(old_zoom_level) == old_zoom_level) { 3577 } else if (static_cast<int>(old_zoom_level) == old_zoom_level) {
3578 // Previous zoom level is a whole number, so just increment/decrement. 3578 // Previous zoom level is a whole number, so just increment/decrement.
3579 zoom_level = old_zoom_level + zoom; 3579 zoom_level = old_zoom_level + zoom;
3580 } else { 3580 } else {
3581 // Either the user hit the zoom factor limit and thus the zoom level is now 3581 // Either the user hit the zoom factor limit and thus the zoom level is now
3582 // not a whole number, or a plugin changed it to a custom value. We want 3582 // not a whole number, or a plugin changed it to a custom value. We want
3583 // to go to the next whole number so that the user can always get back to 3583 // to go to the next whole number so that the user can always get back to
3584 // 100% with the keyboard/menu. 3584 // 100% with the keyboard/menu.
3585 if ((old_zoom_level > 1 && zoom > 0) || 3585 if ((old_zoom_level > 1 && zoom > 0) ||
3586 (old_zoom_level < 1 && zoom < 0)) { 3586 (old_zoom_level < 1 && zoom < 0)) {
3587 zoom_level = static_cast<int>(old_zoom_level + zoom); 3587 zoom_level = static_cast<int>(old_zoom_level + zoom);
3588 } else { 3588 } else {
3589 // We're going towards 100%, so first go to the next whole number. 3589 // We're going towards 100%, so first go to the next whole number.
3590 zoom_level = static_cast<int>(old_zoom_level); 3590 zoom_level = static_cast<int>(old_zoom_level);
3591 } 3591 }
3592 } 3592 }
3593 webview()->setZoomLevel(false, zoom_level); 3593 webview()->setZoomLevel(false, zoom_level);
3594 #else
3595 ZoomFactorHelper(zoom, 0, 0, kScalingIncrement);
3596 #endif
3597 zoomLevelChanged(); 3594 zoomLevelChanged();
3598 } 3595 }
3599 3596
3600 void RenderViewImpl::OnZoomFactor(content::PageZoom zoom, 3597 void RenderViewImpl::OnZoomFactor(content::PageZoom zoom,
3601 int zoom_center_x, int zoom_center_y) { 3598 int zoom_center_x, int zoom_center_y) {
3602 ZoomFactorHelper(zoom, zoom_center_x, zoom_center_y, 3599 ZoomFactorHelper(zoom, zoom_center_x, zoom_center_y,
3603 kScalingIncrementForGesture); 3600 kScalingIncrementForGesture);
3604 } 3601 }
3605 3602
3606 void RenderViewImpl::ZoomFactorHelper(content::PageZoom zoom, 3603 void RenderViewImpl::ZoomFactorHelper(content::PageZoom zoom,
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
4536 WebView::zoomLevelToZoomFactor(minimum_level) * 100); 4533 WebView::zoomLevelToZoomFactor(minimum_level) * 100);
4537 int maximum_percent = static_cast<int>( 4534 int maximum_percent = static_cast<int>(
4538 WebView::zoomLevelToZoomFactor(maximum_level) * 100); 4535 WebView::zoomLevelToZoomFactor(maximum_level) * 100);
4539 4536
4540 Send(new ViewHostMsg_UpdateZoomLimits( 4537 Send(new ViewHostMsg_UpdateZoomLimits(
4541 routing_id_, minimum_percent, maximum_percent, remember)); 4538 routing_id_, minimum_percent, maximum_percent, remember));
4542 } 4539 }
4543 4540
4544 void RenderViewImpl::zoomLevelChanged() { 4541 void RenderViewImpl::zoomLevelChanged() {
4545 bool remember = !webview()->mainFrame()->document().isPluginDocument(); 4542 bool remember = !webview()->mainFrame()->document().isPluginDocument();
4546 #if defined(TOUCH_UI)
4547 float zoom_level =
4548 WebView::zoomFactorToZoomLevel(webview()->pageScaleFactor());
4549 #else
4550 float zoom_level = webview()->zoomLevel(); 4543 float zoom_level = webview()->zoomLevel();
4551 #endif
4552 // Tell the browser which url got zoomed so it can update the menu and the 4544 // Tell the browser which url got zoomed so it can update the menu and the
4553 // saved values if necessary 4545 // saved values if necessary
4554 Send(new ViewHostMsg_DidZoomURL( 4546 Send(new ViewHostMsg_DidZoomURL(
4555 routing_id_, zoom_level, remember, 4547 routing_id_, zoom_level, remember,
4556 GURL(webview()->mainFrame()->document().url()))); 4548 GURL(webview()->mainFrame()->document().url())));
4557 } 4549 }
4558 4550
4559 void RenderViewImpl::registerProtocolHandler(const WebString& scheme, 4551 void RenderViewImpl::registerProtocolHandler(const WebString& scheme,
4560 const WebString& base_url, 4552 const WebString& base_url,
4561 const WebString& url, 4553 const WebString& url,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
4729 return !!RenderThreadImpl::current()->compositor_thread(); 4721 return !!RenderThreadImpl::current()->compositor_thread();
4730 } 4722 }
4731 4723
4732 void RenderViewImpl::OnJavaBridgeInit( 4724 void RenderViewImpl::OnJavaBridgeInit(
4733 const IPC::ChannelHandle& channel_handle) { 4725 const IPC::ChannelHandle& channel_handle) {
4734 DCHECK(!java_bridge_dispatcher_.get()); 4726 DCHECK(!java_bridge_dispatcher_.get());
4735 #if defined(ENABLE_JAVA_BRIDGE) 4727 #if defined(ENABLE_JAVA_BRIDGE)
4736 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); 4728 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle));
4737 #endif 4729 #endif
4738 } 4730 }
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698