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 3704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3715 } | 3715 } |
3716 | 3716 |
3717 blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { | 3717 blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { |
3718 if (!speech_recognition_dispatcher_) | 3718 if (!speech_recognition_dispatcher_) |
3719 speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); | 3719 speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); |
3720 return speech_recognition_dispatcher_; | 3720 return speech_recognition_dispatcher_; |
3721 } | 3721 } |
3722 | 3722 |
3723 void RenderViewImpl::zoomLimitsChanged(double minimum_level, | 3723 void RenderViewImpl::zoomLimitsChanged(double minimum_level, |
3724 double maximum_level) { | 3724 double maximum_level) { |
3725 int minimum_percent = static_cast<int>( | 3725 // Round the double to avoid returning incorrect minimum/maximum zoom |
| 3726 // percentages. |
| 3727 int minimum_percent = round( |
3726 ZoomLevelToZoomFactor(minimum_level) * 100); | 3728 ZoomLevelToZoomFactor(minimum_level) * 100); |
3727 int maximum_percent = static_cast<int>( | 3729 int maximum_percent = round( |
3728 ZoomLevelToZoomFactor(maximum_level) * 100); | 3730 ZoomLevelToZoomFactor(maximum_level) * 100); |
3729 | 3731 |
3730 Send(new ViewHostMsg_UpdateZoomLimits( | 3732 Send(new ViewHostMsg_UpdateZoomLimits( |
3731 routing_id_, minimum_percent, maximum_percent)); | 3733 routing_id_, minimum_percent, maximum_percent)); |
3732 } | 3734 } |
3733 | 3735 |
3734 void RenderViewImpl::zoomLevelChanged() { | 3736 void RenderViewImpl::zoomLevelChanged() { |
3735 double zoom_level = webview()->zoomLevel(); | 3737 double zoom_level = webview()->zoomLevel(); |
3736 | 3738 |
3737 // Do not send empty URLs to the browser when we are just setting the default | 3739 // Do not send empty URLs to the browser when we are just setting the default |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4062 std::vector<gfx::Size> sizes; | 4064 std::vector<gfx::Size> sizes; |
4063 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4065 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4064 if (!url.isEmpty()) | 4066 if (!url.isEmpty()) |
4065 urls.push_back( | 4067 urls.push_back( |
4066 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4068 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4067 } | 4069 } |
4068 SendUpdateFaviconURL(urls); | 4070 SendUpdateFaviconURL(urls); |
4069 } | 4071 } |
4070 | 4072 |
4071 } // namespace content | 4073 } // namespace content |
OLD | NEW |