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 // Round the double to avoid returning incorrect minimum/maximum zoom | |
3763 // percentages. | |
3762 int minimum_percent = static_cast<int>( | 3764 int minimum_percent = static_cast<int>( |
3763 ZoomLevelToZoomFactor(minimum_level) * 100); | 3765 ZoomLevelToZoomFactor(minimum_level) * 100 + 0.5); |
sky
2015/01/22 17:30:35
If we're rounding, why not use a round api?
| |
3764 int maximum_percent = static_cast<int>( | 3766 int maximum_percent = static_cast<int>( |
3765 ZoomLevelToZoomFactor(maximum_level) * 100); | 3767 ZoomLevelToZoomFactor(maximum_level) * 100 + 0.5); |
3766 | |
3767 Send(new ViewHostMsg_UpdateZoomLimits( | 3768 Send(new ViewHostMsg_UpdateZoomLimits( |
3768 routing_id_, minimum_percent, maximum_percent)); | 3769 routing_id_, minimum_percent, maximum_percent)); |
3769 } | 3770 } |
3770 | 3771 |
3771 void RenderViewImpl::zoomLevelChanged() { | 3772 void RenderViewImpl::zoomLevelChanged() { |
3772 double zoom_level = webview()->zoomLevel(); | 3773 double zoom_level = webview()->zoomLevel(); |
3773 | 3774 |
3774 // Do not send empty URLs to the browser when we are just setting the default | 3775 // Do not send empty URLs to the browser when we are just setting the default |
3775 // zoom level (from RendererPreferences) before the first navigation. | 3776 // zoom level (from RendererPreferences) before the first navigation. |
3776 if (!webview()->mainFrame()->document().url().isEmpty()) { | 3777 if (!webview()->mainFrame()->document().url().isEmpty()) { |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4098 std::vector<gfx::Size> sizes; | 4099 std::vector<gfx::Size> sizes; |
4099 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4100 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4100 if (!url.isEmpty()) | 4101 if (!url.isEmpty()) |
4101 urls.push_back( | 4102 urls.push_back( |
4102 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4103 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4103 } | 4104 } |
4104 SendUpdateFaviconURL(urls); | 4105 SendUpdateFaviconURL(urls); |
4105 } | 4106 } |
4106 | 4107 |
4107 } // namespace content | 4108 } // namespace content |
OLD | NEW |