| OLD | NEW |
| 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 "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.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 4465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4476 } else { | 4476 } else { |
| 4477 // We're going towards 100%, so first go to the next whole number. | 4477 // We're going towards 100%, so first go to the next whole number. |
| 4478 zoom_level = static_cast<int>(old_zoom_level); | 4478 zoom_level = static_cast<int>(old_zoom_level); |
| 4479 } | 4479 } |
| 4480 } | 4480 } |
| 4481 | 4481 |
| 4482 webview()->setZoomLevel(false, zoom_level); | 4482 webview()->setZoomLevel(false, zoom_level); |
| 4483 zoomLevelChanged(); | 4483 zoomLevelChanged(); |
| 4484 } | 4484 } |
| 4485 | 4485 |
| 4486 void RenderView::OnSetZoomLevel(double zoom_level) { | 4486 void RenderView::OnSetZoomLevel(int request_id, double zoom_level) { |
| 4487 // Don't set zoom level for full-page plugin since they don't use the same | |
| 4488 // zoom settings. | |
| 4489 if (webview()->mainFrame()->document().isPluginDocument()) | |
| 4490 return; | |
| 4491 | |
| 4492 webview()->hidePopups(); | 4487 webview()->hidePopups(); |
| 4493 webview()->setZoomLevel(false, zoom_level); | 4488 webview()->setZoomLevel(false, zoom_level); |
| 4494 zoomLevelChanged(); | 4489 zoomLevelChanged(request_id); |
| 4495 } | 4490 } |
| 4496 | 4491 |
| 4497 void RenderView::OnSetContentSettingsForLoadingURL( | 4492 void RenderView::OnSetContentSettingsForLoadingURL( |
| 4498 const GURL& url, | 4493 const GURL& url, |
| 4499 const ContentSettings& content_settings) { | 4494 const ContentSettings& content_settings) { |
| 4500 host_content_settings_[url] = content_settings; | 4495 host_content_settings_[url] = content_settings; |
| 4501 } | 4496 } |
| 4502 | 4497 |
| 4503 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, | 4498 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, |
| 4504 double zoom_level) { | 4499 double zoom_level) { |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5666 int minimum_percent = static_cast<int>( | 5661 int minimum_percent = static_cast<int>( |
| 5667 WebView::zoomLevelToZoomFactor(minimum_level) * 100); | 5662 WebView::zoomLevelToZoomFactor(minimum_level) * 100); |
| 5668 int maximum_percent = static_cast<int>( | 5663 int maximum_percent = static_cast<int>( |
| 5669 WebView::zoomLevelToZoomFactor(maximum_level) * 100); | 5664 WebView::zoomLevelToZoomFactor(maximum_level) * 100); |
| 5670 | 5665 |
| 5671 Send(new ViewHostMsg_UpdateZoomLimits( | 5666 Send(new ViewHostMsg_UpdateZoomLimits( |
| 5672 routing_id_, minimum_percent, maximum_percent, remember)); | 5667 routing_id_, minimum_percent, maximum_percent, remember)); |
| 5673 } | 5668 } |
| 5674 | 5669 |
| 5675 void RenderView::zoomLevelChanged() { | 5670 void RenderView::zoomLevelChanged() { |
| 5671 // Currently only extension zoom requests have a request id |
| 5672 zoomLevelChanged(-1); |
| 5673 } |
| 5674 |
| 5675 void RenderView::zoomLevelChanged(int request_id) { |
| 5676 bool remember = !webview()->mainFrame()->document().isPluginDocument(); | 5676 bool remember = !webview()->mainFrame()->document().isPluginDocument(); |
| 5677 | 5677 |
| 5678 // Tell the browser which url got zoomed so it can update the menu and the | 5678 // Tell the browser which url got zoomed so it can update the menu and the |
| 5679 // saved values if necessary | 5679 // saved values if necessary |
| 5680 Send(new ViewHostMsg_DidZoomURL( | 5680 Send(new ViewHostMsg_DidZoomURL( |
| 5681 routing_id_, webview()->zoomLevel(), remember, | 5681 routing_id_, request_id, webview()->zoomLevel(), remember, |
| 5682 GURL(webview()->mainFrame()->url()))); | 5682 GURL(webview()->mainFrame()->url()))); |
| 5683 } | 5683 } |
| 5684 | 5684 |
| 5685 bool RenderView::IsNonLocalTopLevelNavigation( | 5685 bool RenderView::IsNonLocalTopLevelNavigation( |
| 5686 const GURL& url, WebKit::WebFrame* frame, WebKit::WebNavigationType type) { | 5686 const GURL& url, WebKit::WebFrame* frame, WebKit::WebNavigationType type) { |
| 5687 // Must be a top level frame. | 5687 // Must be a top level frame. |
| 5688 if (frame->parent() != NULL) | 5688 if (frame->parent() != NULL) |
| 5689 return false; | 5689 return false; |
| 5690 | 5690 |
| 5691 // Navigations initiated within Webkit are not sent out to the external host | 5691 // Navigations initiated within Webkit are not sent out to the external host |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5782 } | 5782 } |
| 5783 } | 5783 } |
| 5784 | 5784 |
| 5785 void RenderView::OnContextMenuClosed( | 5785 void RenderView::OnContextMenuClosed( |
| 5786 const webkit_glue::CustomContextMenuContext& custom_context) { | 5786 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 5787 if (custom_context.is_pepper_menu) | 5787 if (custom_context.is_pepper_menu) |
| 5788 pepper_delegate_.OnContextMenuClosed(custom_context); | 5788 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 5789 else | 5789 else |
| 5790 context_menu_node_.reset(); | 5790 context_menu_node_.reset(); |
| 5791 } | 5791 } |
| OLD | NEW |