| 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 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 int32 routing_id, | 1068 int32 routing_id, |
| 1069 int32 main_frame_routing_id, | 1069 int32 main_frame_routing_id, |
| 1070 int32 surface_id, | 1070 int32 surface_id, |
| 1071 int64 session_storage_namespace_id, | 1071 int64 session_storage_namespace_id, |
| 1072 const base::string16& frame_name, | 1072 const base::string16& frame_name, |
| 1073 bool is_renderer_created, | 1073 bool is_renderer_created, |
| 1074 bool swapped_out, | 1074 bool swapped_out, |
| 1075 bool hidden, | 1075 bool hidden, |
| 1076 int32 next_page_id, | 1076 int32 next_page_id, |
| 1077 const blink::WebScreenInfo& screen_info, | 1077 const blink::WebScreenInfo& screen_info, |
| 1078 AccessibilityMode accessibility_mode, | 1078 unsigned int accessibility_mode, |
| 1079 bool allow_partial_swap) { | 1079 bool allow_partial_swap) { |
| 1080 DCHECK(routing_id != MSG_ROUTING_NONE); | 1080 DCHECK(routing_id != MSG_ROUTING_NONE); |
| 1081 RenderViewImplParams params( | 1081 RenderViewImplParams params( |
| 1082 opener_id, | 1082 opener_id, |
| 1083 renderer_prefs, | 1083 renderer_prefs, |
| 1084 webkit_prefs, | 1084 webkit_prefs, |
| 1085 routing_id, | 1085 routing_id, |
| 1086 main_frame_routing_id, | 1086 main_frame_routing_id, |
| 1087 surface_id, | 1087 surface_id, |
| 1088 session_storage_namespace_id, | 1088 session_storage_namespace_id, |
| (...skipping 4071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5160 | 5160 |
| 5161 void RenderViewImpl::OnSetBackground(const SkBitmap& background) { | 5161 void RenderViewImpl::OnSetBackground(const SkBitmap& background) { |
| 5162 if (webview()) | 5162 if (webview()) |
| 5163 webview()->setIsTransparent(!background.empty()); | 5163 webview()->setIsTransparent(!background.empty()); |
| 5164 if (compositor_) | 5164 if (compositor_) |
| 5165 compositor_->setHasTransparentBackground(!background.empty()); | 5165 compositor_->setHasTransparentBackground(!background.empty()); |
| 5166 | 5166 |
| 5167 SetBackground(background); | 5167 SetBackground(background); |
| 5168 } | 5168 } |
| 5169 | 5169 |
| 5170 void RenderViewImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) { | 5170 void RenderViewImpl::OnSetAccessibilityMode(unsigned int new_mode) { |
| 5171 if (accessibility_mode_ == new_mode) | 5171 if (accessibility_mode_ == new_mode) |
| 5172 return; | 5172 return; |
| 5173 accessibility_mode_ = new_mode; | 5173 accessibility_mode_ = new_mode; |
| 5174 if (renderer_accessibility_) { | 5174 if (renderer_accessibility_) { |
| 5175 delete renderer_accessibility_; | 5175 delete renderer_accessibility_; |
| 5176 renderer_accessibility_ = NULL; | 5176 renderer_accessibility_ = NULL; |
| 5177 } | 5177 } |
| 5178 if (accessibility_mode_ == AccessibilityModeComplete) | 5178 if (accessibility_mode_ == AccessibilityModeOff) |
| 5179 return; |
| 5180 |
| 5181 if (accessibility_mode_ & AccessibilityModeFlagPlatformFullTree) |
| 5179 renderer_accessibility_ = new RendererAccessibilityComplete(this); | 5182 renderer_accessibility_ = new RendererAccessibilityComplete(this); |
| 5180 #if !defined(OS_ANDROID) | 5183 #if !defined(OS_ANDROID) |
| 5181 else if (accessibility_mode_ == AccessibilityModeEditableTextOnly) | 5184 else |
| 5182 renderer_accessibility_ = new RendererAccessibilityFocusOnly(this); | 5185 renderer_accessibility_ = new RendererAccessibilityFocusOnly(this); |
| 5183 #endif | 5186 #endif |
| 5184 } | 5187 } |
| 5185 | 5188 |
| 5186 void RenderViewImpl::OnSetActive(bool active) { | 5189 void RenderViewImpl::OnSetActive(bool active) { |
| 5187 if (webview()) | 5190 if (webview()) |
| 5188 webview()->setIsActive(active); | 5191 webview()->setIsActive(active); |
| 5189 | 5192 |
| 5190 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX) | 5193 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX) |
| 5191 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 5194 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5938 if (main_frame && main_frame->opener()) | 5941 if (main_frame && main_frame->opener()) |
| 5939 main_frame->setOpener(NULL); | 5942 main_frame->setOpener(NULL); |
| 5940 } | 5943 } |
| 5941 | 5944 |
| 5942 #if defined(OS_ANDROID) | 5945 #if defined(OS_ANDROID) |
| 5943 bool RenderViewImpl::didTapMultipleTargets( | 5946 bool RenderViewImpl::didTapMultipleTargets( |
| 5944 const blink::WebGestureEvent& event, | 5947 const blink::WebGestureEvent& event, |
| 5945 const WebVector<WebRect>& target_rects) { | 5948 const WebVector<WebRect>& target_rects) { |
| 5946 // Never show a disambiguation popup when accessibility is enabled, | 5949 // Never show a disambiguation popup when accessibility is enabled, |
| 5947 // as this interferes with "touch exploration". | 5950 // as this interferes with "touch exploration". |
| 5948 if (accessibility_mode_ == AccessibilityModeComplete) | 5951 bool matchesAccessibilityModeComplete = |
| 5952 (accessibility_mode_ & AccessibilityModeComplete) == |
| 5953 AccessibilityModeComplete; |
| 5954 if (matchesAccessibilityModeComplete) |
| 5949 return false; | 5955 return false; |
| 5950 | 5956 |
| 5951 gfx::Rect finger_rect( | 5957 gfx::Rect finger_rect( |
| 5952 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, | 5958 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, |
| 5953 event.data.tap.width, event.data.tap.height); | 5959 event.data.tap.width, event.data.tap.height); |
| 5954 gfx::Rect zoom_rect; | 5960 gfx::Rect zoom_rect; |
| 5955 float new_total_scale = | 5961 float new_total_scale = |
| 5956 DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( | 5962 DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( |
| 5957 finger_rect, target_rects, GetSize(), | 5963 finger_rect, target_rects, GetSize(), |
| 5958 gfx::Rect(webview()->mainFrame()->visibleContentRect()).size(), | 5964 gfx::Rect(webview()->mainFrame()->visibleContentRect()).size(), |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6098 for (size_t i = 0; i < icon_urls.size(); i++) { | 6104 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 6099 WebURL url = icon_urls[i].iconURL(); | 6105 WebURL url = icon_urls[i].iconURL(); |
| 6100 if (!url.isEmpty()) | 6106 if (!url.isEmpty()) |
| 6101 urls.push_back(FaviconURL(url, | 6107 urls.push_back(FaviconURL(url, |
| 6102 ToFaviconType(icon_urls[i].iconType()))); | 6108 ToFaviconType(icon_urls[i].iconType()))); |
| 6103 } | 6109 } |
| 6104 SendUpdateFaviconURL(urls); | 6110 SendUpdateFaviconURL(urls); |
| 6105 } | 6111 } |
| 6106 | 6112 |
| 6107 } // namespace content | 6113 } // namespace content |
| OLD | NEW |