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 3741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3752 } | 3752 } |
3753 | 3753 |
3754 blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { | 3754 blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { |
3755 if (!speech_recognition_dispatcher_) | 3755 if (!speech_recognition_dispatcher_) |
3756 speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); | 3756 speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); |
3757 return speech_recognition_dispatcher_; | 3757 return speech_recognition_dispatcher_; |
3758 } | 3758 } |
3759 | 3759 |
3760 void RenderViewImpl::zoomLimitsChanged(double minimum_level, | 3760 void RenderViewImpl::zoomLimitsChanged(double minimum_level, |
3761 double maximum_level) { | 3761 double maximum_level) { |
3762 int minimum_percent = static_cast<int>( | 3762 // Round the double to avoid returning incorrect minimum/maximum zoom |
| 3763 // percentages. |
| 3764 int minimum_percent = round( |
3763 ZoomLevelToZoomFactor(minimum_level) * 100); | 3765 ZoomLevelToZoomFactor(minimum_level) * 100); |
3764 int maximum_percent = static_cast<int>( | 3766 int maximum_percent = round( |
3765 ZoomLevelToZoomFactor(maximum_level) * 100); | 3767 ZoomLevelToZoomFactor(maximum_level) * 100); |
3766 | 3768 |
3767 Send(new ViewHostMsg_UpdateZoomLimits( | 3769 Send(new ViewHostMsg_UpdateZoomLimits( |
3768 routing_id_, minimum_percent, maximum_percent)); | 3770 routing_id_, minimum_percent, maximum_percent)); |
3769 } | 3771 } |
3770 | 3772 |
3771 void RenderViewImpl::zoomLevelChanged() { | 3773 void RenderViewImpl::zoomLevelChanged() { |
3772 double zoom_level = webview()->zoomLevel(); | 3774 double zoom_level = webview()->zoomLevel(); |
3773 | 3775 |
3774 // Do not send empty URLs to the browser when we are just setting the default | 3776 // Do not send empty URLs to the browser when we are just setting the default |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4098 std::vector<gfx::Size> sizes; | 4100 std::vector<gfx::Size> sizes; |
4099 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4101 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4100 if (!url.isEmpty()) | 4102 if (!url.isEmpty()) |
4101 urls.push_back( | 4103 urls.push_back( |
4102 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4104 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4103 } | 4105 } |
4104 SendUpdateFaviconURL(urls); | 4106 SendUpdateFaviconURL(urls); |
4105 } | 4107 } |
4106 | 4108 |
4107 } // namespace content | 4109 } // namespace content |
OLD | NEW |