Chromium Code Reviews| 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 3742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 int minimum_percent = static_cast<int>( |
| 3763 ZoomLevelToZoomFactor(minimum_level) * 100); | 3763 ZoomLevelToZoomFactor(minimum_level) * 100); |
|
Alexei Svitkine (slow)
2015/01/13 14:51:13
This should probably be rounded too.
| |
| 3764 // Round double before dispatching the async IPC. | |
| 3764 int maximum_percent = static_cast<int>( | 3765 int maximum_percent = static_cast<int>( |
| 3765 ZoomLevelToZoomFactor(maximum_level) * 100); | 3766 ZoomLevelToZoomFactor(maximum_level) * 100 + .5); |
|
Alexei Svitkine (slow)
2015/01/13 14:51:13
Nit: 0.5
| |
| 3766 | |
| 3767 Send(new ViewHostMsg_UpdateZoomLimits( | 3767 Send(new ViewHostMsg_UpdateZoomLimits( |
| 3768 routing_id_, minimum_percent, maximum_percent)); | 3768 routing_id_, minimum_percent, maximum_percent)); |
| 3769 } | 3769 } |
| 3770 | 3770 |
| 3771 void RenderViewImpl::zoomLevelChanged() { | 3771 void RenderViewImpl::zoomLevelChanged() { |
| 3772 double zoom_level = webview()->zoomLevel(); | 3772 double zoom_level = webview()->zoomLevel(); |
| 3773 | 3773 |
| 3774 // Do not send empty URLs to the browser when we are just setting the default | 3774 // Do not send empty URLs to the browser when we are just setting the default |
| 3775 // zoom level (from RendererPreferences) before the first navigation. | 3775 // zoom level (from RendererPreferences) before the first navigation. |
| 3776 if (!webview()->mainFrame()->document().url().isEmpty()) { | 3776 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; | 4098 std::vector<gfx::Size> sizes; |
| 4099 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4099 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4100 if (!url.isEmpty()) | 4100 if (!url.isEmpty()) |
| 4101 urls.push_back( | 4101 urls.push_back( |
| 4102 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4102 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4103 } | 4103 } |
| 4104 SendUpdateFaviconURL(urls); | 4104 SendUpdateFaviconURL(urls); |
| 4105 } | 4105 } |
| 4106 | 4106 |
| 4107 } // namespace content | 4107 } // namespace content |
| OLD | NEW |