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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" | 134 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" |
135 #include "third_party/WebKit/public/web/WebDataSource.h" | 135 #include "third_party/WebKit/public/web/WebDataSource.h" |
136 #include "third_party/WebKit/public/web/WebDateTimeChooserCompletion.h" | 136 #include "third_party/WebKit/public/web/WebDateTimeChooserCompletion.h" |
137 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" | 137 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" |
138 #include "third_party/WebKit/public/web/WebDocument.h" | 138 #include "third_party/WebKit/public/web/WebDocument.h" |
139 #include "third_party/WebKit/public/web/WebElement.h" | 139 #include "third_party/WebKit/public/web/WebElement.h" |
140 #include "third_party/WebKit/public/web/WebFileChooserParams.h" | 140 #include "third_party/WebKit/public/web/WebFileChooserParams.h" |
141 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 141 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
142 #include "third_party/WebKit/public/web/WebFormElement.h" | 142 #include "third_party/WebKit/public/web/WebFormElement.h" |
143 #include "third_party/WebKit/public/web/WebFrame.h" | 143 #include "third_party/WebKit/public/web/WebFrame.h" |
| 144 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" |
144 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 145 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
145 #include "third_party/WebKit/public/web/WebHitTestResult.h" | 146 #include "third_party/WebKit/public/web/WebHitTestResult.h" |
146 #include "third_party/WebKit/public/web/WebInputElement.h" | 147 #include "third_party/WebKit/public/web/WebInputElement.h" |
147 #include "third_party/WebKit/public/web/WebInputEvent.h" | 148 #include "third_party/WebKit/public/web/WebInputEvent.h" |
148 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 149 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
149 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" | 150 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" |
150 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 151 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
151 #include "third_party/WebKit/public/web/WebPageImportanceSignals.h" | 152 #include "third_party/WebKit/public/web/WebPageImportanceSignals.h" |
152 #include "third_party/WebKit/public/web/WebPlugin.h" | 153 #include "third_party/WebKit/public/web/WebPlugin.h" |
153 #include "third_party/WebKit/public/web/WebPluginAction.h" | 154 #include "third_party/WebKit/public/web/WebPluginAction.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 using blink::WebDataSource; | 214 using blink::WebDataSource; |
214 using blink::WebDocument; | 215 using blink::WebDocument; |
215 using blink::WebDragData; | 216 using blink::WebDragData; |
216 using blink::WebDragOperation; | 217 using blink::WebDragOperation; |
217 using blink::WebDragOperationsMask; | 218 using blink::WebDragOperationsMask; |
218 using blink::WebElement; | 219 using blink::WebElement; |
219 using blink::WebFileChooserCompletion; | 220 using blink::WebFileChooserCompletion; |
220 using blink::WebFormControlElement; | 221 using blink::WebFormControlElement; |
221 using blink::WebFormElement; | 222 using blink::WebFormElement; |
222 using blink::WebFrame; | 223 using blink::WebFrame; |
| 224 using blink::WebFrameContentDumper; |
223 using blink::WebGestureEvent; | 225 using blink::WebGestureEvent; |
224 using blink::WebHistoryItem; | 226 using blink::WebHistoryItem; |
225 using blink::WebHTTPBody; | 227 using blink::WebHTTPBody; |
226 using blink::WebIconURL; | 228 using blink::WebIconURL; |
227 using blink::WebImage; | 229 using blink::WebImage; |
228 using blink::WebInputElement; | 230 using blink::WebInputElement; |
229 using blink::WebInputEvent; | 231 using blink::WebInputEvent; |
230 using blink::WebLocalFrame; | 232 using blink::WebLocalFrame; |
231 using blink::WebMediaPlayerAction; | 233 using blink::WebMediaPlayerAction; |
232 using blink::WebMouseEvent; | 234 using blink::WebMouseEvent; |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 #endif | 1232 #endif |
1231 | 1233 |
1232 #if defined(OS_MACOSX) | 1234 #if defined(OS_MACOSX) |
1233 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { | 1235 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { |
1234 Send(new ViewHostMsg_PluginFocusChanged(routing_id(), focused, plugin_id)); | 1236 Send(new ViewHostMsg_PluginFocusChanged(routing_id(), focused, plugin_id)); |
1235 } | 1237 } |
1236 | 1238 |
1237 void RenderViewImpl::OnGetRenderedText() { | 1239 void RenderViewImpl::OnGetRenderedText() { |
1238 if (!webview()) | 1240 if (!webview()) |
1239 return; | 1241 return; |
| 1242 |
| 1243 if (!webview()->mainFrame()->isWebLocalFrame()) |
| 1244 return; |
| 1245 |
1240 // Get rendered text from WebLocalFrame. | 1246 // Get rendered text from WebLocalFrame. |
1241 // TODO: Currently IPC truncates any data that has a | 1247 // TODO: Currently IPC truncates any data that has a |
1242 // size > kMaximumMessageSize. May be split the text into smaller chunks and | 1248 // size > kMaximumMessageSize. May be split the text into smaller chunks and |
1243 // send back using multiple IPC. See http://crbug.com/393444. | 1249 // send back using multiple IPC. See http://crbug.com/393444. |
1244 static const size_t kMaximumMessageSize = 8 * 1024 * 1024; | 1250 static const size_t kMaximumMessageSize = 8 * 1024 * 1024; |
1245 std::string text = webview()->mainFrame()->contentAsText( | 1251 // TODO(dglazkov): Using this API is wrong. It's not OOPIF-compatible and |
1246 kMaximumMessageSize).utf8(); | 1252 // sends text in the wrong order. See http://crbug.com/584798. |
| 1253 // TODO(dglazkov): WebFrameContentDumper should only be used for |
| 1254 // testing purposes. See http://crbug.com/585164. |
| 1255 std::string text = |
| 1256 WebFrameContentDumper::dumpFrameTreeAsText( |
| 1257 webview()->mainFrame()->toWebLocalFrame(), kMaximumMessageSize) |
| 1258 .utf8(); |
1247 | 1259 |
1248 Send(new ViewMsg_GetRenderedTextCompleted(routing_id(), text)); | 1260 Send(new ViewMsg_GetRenderedTextCompleted(routing_id(), text)); |
1249 } | 1261 } |
1250 | 1262 |
1251 void RenderViewImpl::StartPluginIme() { | 1263 void RenderViewImpl::StartPluginIme() { |
1252 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id()); | 1264 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id()); |
1253 // This message can be sent during event-handling, and needs to be delivered | 1265 // This message can be sent during event-handling, and needs to be delivered |
1254 // within that context. | 1266 // within that context. |
1255 msg->set_unblock(true); | 1267 msg->set_unblock(true); |
1256 Send(msg); | 1268 Send(msg); |
(...skipping 2263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3520 if (IsUseZoomForDSFEnabled()) { | 3532 if (IsUseZoomForDSFEnabled()) { |
3521 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3533 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
3522 } else { | 3534 } else { |
3523 webview()->setDeviceScaleFactor(device_scale_factor_); | 3535 webview()->setDeviceScaleFactor(device_scale_factor_); |
3524 } | 3536 } |
3525 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3537 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3526 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3538 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3527 } | 3539 } |
3528 | 3540 |
3529 } // namespace content | 3541 } // namespace content |
OLD | NEW |