| 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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 opened_by_user_gesture_(true), | 640 opened_by_user_gesture_(true), |
| 641 opener_suppressed_(false), | 641 opener_suppressed_(false), |
| 642 suppress_dialogs_until_swap_out_(false), | 642 suppress_dialogs_until_swap_out_(false), |
| 643 page_id_(-1), | 643 page_id_(-1), |
| 644 last_page_id_sent_to_browser_(-1), | 644 last_page_id_sent_to_browser_(-1), |
| 645 next_page_id_(params->next_page_id), | 645 next_page_id_(params->next_page_id), |
| 646 history_list_offset_(-1), | 646 history_list_offset_(-1), |
| 647 history_list_length_(0), | 647 history_list_length_(0), |
| 648 frames_in_progress_(0), | 648 frames_in_progress_(0), |
| 649 target_url_status_(TARGET_NONE), | 649 target_url_status_(TARGET_NONE), |
| 650 uses_temporary_zoom_level_(false), |
| 650 #if defined(OS_ANDROID) | 651 #if defined(OS_ANDROID) |
| 651 top_controls_constraints_(cc::BOTH), | 652 top_controls_constraints_(cc::BOTH), |
| 652 #endif | 653 #endif |
| 653 has_scrolled_focused_editable_node_into_rect_(false), | 654 has_scrolled_focused_editable_node_into_rect_(false), |
| 654 push_messaging_dispatcher_(NULL), | 655 push_messaging_dispatcher_(NULL), |
| 655 speech_recognition_dispatcher_(NULL), | 656 speech_recognition_dispatcher_(NULL), |
| 656 media_stream_dispatcher_(NULL), | 657 media_stream_dispatcher_(NULL), |
| 657 browser_plugin_manager_(NULL), | 658 browser_plugin_manager_(NULL), |
| 658 midi_dispatcher_(NULL), | 659 midi_dispatcher_(NULL), |
| 659 devtools_agent_(NULL), | 660 devtools_agent_(NULL), |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1075 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
| 1075 OnSetEditCommandsForNextKeyEvent) | 1076 OnSetEditCommandsForNextKeyEvent) |
| 1076 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) | 1077 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) |
| 1077 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 1078 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
| 1078 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) | 1079 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) |
| 1079 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) | 1080 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) |
| 1080 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) | 1081 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) |
| 1081 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1082 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
| 1082 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 1083 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
| 1083 OnSetZoomLevelForLoadingURL) | 1084 OnSetZoomLevelForLoadingURL) |
| 1085 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView, |
| 1086 OnSetZoomLevelForView) |
| 1084 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1087 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
| 1085 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1088 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
| 1086 OnResetPageEncodingToDefault) | 1089 OnResetPageEncodingToDefault) |
| 1087 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent) | 1090 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent) |
| 1088 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1091 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
| 1089 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1092 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
| 1090 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 1093 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
| 1091 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) | 1094 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
| 1092 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) | 1095 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) |
| 1093 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, | 1096 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, |
| (...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2607 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, | 2610 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, |
| 2608 double zoom_level) { | 2611 double zoom_level) { |
| 2609 #if !defined(OS_ANDROID) | 2612 #if !defined(OS_ANDROID) |
| 2610 // On Android, page zoom isn't used, and in case of WebView, text zoom is used | 2613 // On Android, page zoom isn't used, and in case of WebView, text zoom is used |
| 2611 // for legacy WebView text scaling emulation. Thus, the code that resets | 2614 // for legacy WebView text scaling emulation. Thus, the code that resets |
| 2612 // the zoom level from this map will be effectively resetting text zoom level. | 2615 // the zoom level from this map will be effectively resetting text zoom level. |
| 2613 host_zoom_levels_[url] = zoom_level; | 2616 host_zoom_levels_[url] = zoom_level; |
| 2614 #endif | 2617 #endif |
| 2615 } | 2618 } |
| 2616 | 2619 |
| 2620 void RenderViewImpl::OnSetZoomLevelForView(bool uses_temporary_zoom_level, |
| 2621 double level) { |
| 2622 uses_temporary_zoom_level_ = uses_temporary_zoom_level; |
| 2623 |
| 2624 webview()->hidePopups(); |
| 2625 webview()->setZoomLevel(level); |
| 2626 } |
| 2627 |
| 2617 void RenderViewImpl::OnSetPageEncoding(const std::string& encoding_name) { | 2628 void RenderViewImpl::OnSetPageEncoding(const std::string& encoding_name) { |
| 2618 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); | 2629 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); |
| 2619 } | 2630 } |
| 2620 | 2631 |
| 2621 void RenderViewImpl::OnResetPageEncodingToDefault() { | 2632 void RenderViewImpl::OnResetPageEncodingToDefault() { |
| 2622 WebString no_encoding; | 2633 WebString no_encoding; |
| 2623 webview()->setPageEncoding(no_encoding); | 2634 webview()->setPageEncoding(no_encoding); |
| 2624 } | 2635 } |
| 2625 | 2636 |
| 2626 void RenderViewImpl::OnPostMessageEvent( | 2637 void RenderViewImpl::OnPostMessageEvent( |
| (...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4012 std::vector<gfx::Size> sizes; | 4023 std::vector<gfx::Size> sizes; |
| 4013 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4024 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4014 if (!url.isEmpty()) | 4025 if (!url.isEmpty()) |
| 4015 urls.push_back( | 4026 urls.push_back( |
| 4016 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4027 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4017 } | 4028 } |
| 4018 SendUpdateFaviconURL(urls); | 4029 SendUpdateFaviconURL(urls); |
| 4019 } | 4030 } |
| 4020 | 4031 |
| 4021 } // namespace content | 4032 } // namespace content |
| OLD | NEW |