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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 248 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
249 #include "content/renderer/pepper/pepper_plugin_registry.h" | 249 #include "content/renderer/pepper/pepper_plugin_registry.h" |
250 #include "content/renderer/pepper/pepper_webplugin_impl.h" | 250 #include "content/renderer/pepper/pepper_webplugin_impl.h" |
251 #include "content/renderer/pepper/plugin_module.h" | 251 #include "content/renderer/pepper/plugin_module.h" |
252 #endif | 252 #endif |
253 | 253 |
254 #if defined(ENABLE_WEBRTC) | 254 #if defined(ENABLE_WEBRTC) |
255 #include "content/renderer/media/rtc_peer_connection_handler.h" | 255 #include "content/renderer/media/rtc_peer_connection_handler.h" |
256 #endif | 256 #endif |
257 | 257 |
258 using WebKit::WebAXObject; | 258 using blink::WebAXObject; |
259 using WebKit::WebApplicationCacheHost; | 259 using blink::WebApplicationCacheHost; |
260 using WebKit::WebApplicationCacheHostClient; | 260 using blink::WebApplicationCacheHostClient; |
261 using WebKit::WebCString; | 261 using blink::WebCString; |
262 using WebKit::WebColor; | 262 using blink::WebColor; |
263 using WebKit::WebColorName; | 263 using blink::WebColorName; |
264 using WebKit::WebConsoleMessage; | 264 using blink::WebConsoleMessage; |
265 using WebKit::WebContextMenuData; | 265 using blink::WebContextMenuData; |
266 using WebKit::WebCookieJar; | 266 using blink::WebCookieJar; |
267 using WebKit::WebData; | 267 using blink::WebData; |
268 using WebKit::WebDataSource; | 268 using blink::WebDataSource; |
269 using WebKit::WebDocument; | 269 using blink::WebDocument; |
270 using WebKit::WebDOMEvent; | 270 using blink::WebDOMEvent; |
271 using WebKit::WebDOMMessageEvent; | 271 using blink::WebDOMMessageEvent; |
272 using WebKit::WebDragData; | 272 using blink::WebDragData; |
273 using WebKit::WebDragOperation; | 273 using blink::WebDragOperation; |
274 using WebKit::WebDragOperationsMask; | 274 using blink::WebDragOperationsMask; |
275 using WebKit::WebElement; | 275 using blink::WebElement; |
276 using WebKit::WebExternalPopupMenu; | 276 using blink::WebExternalPopupMenu; |
277 using WebKit::WebExternalPopupMenuClient; | 277 using blink::WebExternalPopupMenuClient; |
278 using WebKit::WebFileChooserCompletion; | 278 using blink::WebFileChooserCompletion; |
279 using WebKit::WebFindOptions; | 279 using blink::WebFindOptions; |
280 using WebKit::WebFormControlElement; | 280 using blink::WebFormControlElement; |
281 using WebKit::WebFormElement; | 281 using blink::WebFormElement; |
282 using WebKit::WebFrame; | 282 using blink::WebFrame; |
283 using WebKit::WebGestureEvent; | 283 using blink::WebGestureEvent; |
284 using WebKit::WebHistoryItem; | 284 using blink::WebHistoryItem; |
285 using WebKit::WebHTTPBody; | 285 using blink::WebHTTPBody; |
286 using WebKit::WebIconURL; | 286 using blink::WebIconURL; |
287 using WebKit::WebImage; | 287 using blink::WebImage; |
288 using WebKit::WebInputElement; | 288 using blink::WebInputElement; |
289 using WebKit::WebInputEvent; | 289 using blink::WebInputEvent; |
290 using WebKit::WebMediaPlayer; | 290 using blink::WebMediaPlayer; |
291 using WebKit::WebMediaPlayerAction; | 291 using blink::WebMediaPlayerAction; |
292 using WebKit::WebMediaPlayerClient; | 292 using blink::WebMediaPlayerClient; |
293 using WebKit::WebMouseEvent; | 293 using blink::WebMouseEvent; |
294 using WebKit::WebNavigationPolicy; | 294 using blink::WebNavigationPolicy; |
295 using WebKit::WebNavigationType; | 295 using blink::WebNavigationType; |
296 using WebKit::WebNode; | 296 using blink::WebNode; |
297 using WebKit::WebPageSerializer; | 297 using blink::WebPageSerializer; |
298 using WebKit::WebPageSerializerClient; | 298 using blink::WebPageSerializerClient; |
299 using WebKit::WebPeerConnection00Handler; | 299 using blink::WebPeerConnection00Handler; |
300 using WebKit::WebPeerConnection00HandlerClient; | 300 using blink::WebPeerConnection00HandlerClient; |
301 using WebKit::WebPeerConnectionHandler; | 301 using blink::WebPeerConnectionHandler; |
302 using WebKit::WebPeerConnectionHandlerClient; | 302 using blink::WebPeerConnectionHandlerClient; |
303 using WebKit::WebPluginAction; | 303 using blink::WebPluginAction; |
304 using WebKit::WebPluginContainer; | 304 using blink::WebPluginContainer; |
305 using WebKit::WebPluginDocument; | 305 using blink::WebPluginDocument; |
306 using WebKit::WebPluginParams; | 306 using blink::WebPluginParams; |
307 using WebKit::WebPoint; | 307 using blink::WebPoint; |
308 using WebKit::WebPopupMenuInfo; | 308 using blink::WebPopupMenuInfo; |
309 using WebKit::WebRange; | 309 using blink::WebRange; |
310 using WebKit::WebRect; | 310 using blink::WebRect; |
311 using WebKit::WebReferrerPolicy; | 311 using blink::WebReferrerPolicy; |
312 using WebKit::WebRuntimeFeatures; | 312 using blink::WebRuntimeFeatures; |
313 using WebKit::WebScriptSource; | 313 using blink::WebScriptSource; |
314 using WebKit::WebSearchableFormData; | 314 using blink::WebSearchableFormData; |
315 using WebKit::WebSecurityOrigin; | 315 using blink::WebSecurityOrigin; |
316 using WebKit::WebSecurityPolicy; | 316 using blink::WebSecurityPolicy; |
317 using WebKit::WebSerializedScriptValue; | 317 using blink::WebSerializedScriptValue; |
318 using WebKit::WebSettings; | 318 using blink::WebSettings; |
319 using WebKit::WebSize; | 319 using blink::WebSize; |
320 using WebKit::WebSocketStreamHandle; | 320 using blink::WebSocketStreamHandle; |
321 using WebKit::WebStorageNamespace; | 321 using blink::WebStorageNamespace; |
322 using WebKit::WebStorageQuotaCallbacks; | 322 using blink::WebStorageQuotaCallbacks; |
323 using WebKit::WebStorageQuotaError; | 323 using blink::WebStorageQuotaError; |
324 using WebKit::WebStorageQuotaType; | 324 using blink::WebStorageQuotaType; |
325 using WebKit::WebString; | 325 using blink::WebString; |
326 using WebKit::WebTextAffinity; | 326 using blink::WebTextAffinity; |
327 using WebKit::WebTextDirection; | 327 using blink::WebTextDirection; |
328 using WebKit::WebTouchEvent; | 328 using blink::WebTouchEvent; |
329 using WebKit::WebURL; | 329 using blink::WebURL; |
330 using WebKit::WebURLError; | 330 using blink::WebURLError; |
331 using WebKit::WebURLRequest; | 331 using blink::WebURLRequest; |
332 using WebKit::WebURLResponse; | 332 using blink::WebURLResponse; |
333 using WebKit::WebUserGestureIndicator; | 333 using blink::WebUserGestureIndicator; |
334 using WebKit::WebVector; | 334 using blink::WebVector; |
335 using WebKit::WebView; | 335 using blink::WebView; |
336 using WebKit::WebWidget; | 336 using blink::WebWidget; |
337 using WebKit::WebWindowFeatures; | 337 using blink::WebWindowFeatures; |
338 using base::Time; | 338 using base::Time; |
339 using base::TimeDelta; | 339 using base::TimeDelta; |
340 using webkit_glue::WebURLResponseExtraDataImpl; | 340 using webkit_glue::WebURLResponseExtraDataImpl; |
341 | 341 |
342 #if defined(OS_ANDROID) | 342 #if defined(OS_ANDROID) |
343 using WebKit::WebContentDetectionResult; | 343 using blink::WebContentDetectionResult; |
344 using WebKit::WebFloatPoint; | 344 using blink::WebFloatPoint; |
345 using WebKit::WebFloatRect; | 345 using blink::WebFloatRect; |
346 using WebKit::WebHitTestResult; | 346 using blink::WebHitTestResult; |
347 #endif | 347 #endif |
348 | 348 |
349 namespace content { | 349 namespace content { |
350 | 350 |
351 //----------------------------------------------------------------------------- | 351 //----------------------------------------------------------------------------- |
352 | 352 |
353 typedef std::map<WebKit::WebView*, RenderViewImpl*> ViewMap; | 353 typedef std::map<blink::WebView*, RenderViewImpl*> ViewMap; |
354 static base::LazyInstance<ViewMap> g_view_map = LAZY_INSTANCE_INITIALIZER; | 354 static base::LazyInstance<ViewMap> g_view_map = LAZY_INSTANCE_INITIALIZER; |
355 typedef std::map<int32, RenderViewImpl*> RoutingIDViewMap; | 355 typedef std::map<int32, RenderViewImpl*> RoutingIDViewMap; |
356 static base::LazyInstance<RoutingIDViewMap> g_routing_id_view_map = | 356 static base::LazyInstance<RoutingIDViewMap> g_routing_id_view_map = |
357 LAZY_INSTANCE_INITIALIZER; | 357 LAZY_INSTANCE_INITIALIZER; |
358 | 358 |
359 // Time, in seconds, we delay before sending content state changes (such as form | 359 // Time, in seconds, we delay before sending content state changes (such as form |
360 // state and scroll position) to the browser. We delay sending changes to avoid | 360 // state and scroll position) to the browser. We delay sending changes to avoid |
361 // spamming the browser. | 361 // spamming the browser. |
362 // To avoid having tab/session restore require sending a message to get the | 362 // To avoid having tab/session restore require sending a message to get the |
363 // current content state during tab closing we use a shorter timeout for the | 363 // current content state during tab closing we use a shorter timeout for the |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 | 513 |
514 // Navigations initiated within Webkit are not sent out to the external host | 514 // Navigations initiated within Webkit are not sent out to the external host |
515 // in the following cases. | 515 // in the following cases. |
516 // 1. The url scheme is not http/https | 516 // 1. The url scheme is not http/https |
517 // 2. The origin of the url and the opener is the same in which case the | 517 // 2. The origin of the url and the opener is the same in which case the |
518 // opener relationship is maintained. | 518 // opener relationship is maintained. |
519 // 3. Reloads/form submits/back forward navigations | 519 // 3. Reloads/form submits/back forward navigations |
520 if (!url.SchemeIs(kHttpScheme) && !url.SchemeIs(kHttpsScheme)) | 520 if (!url.SchemeIs(kHttpScheme) && !url.SchemeIs(kHttpsScheme)) |
521 return false; | 521 return false; |
522 | 522 |
523 if (type != WebKit::WebNavigationTypeReload && | 523 if (type != blink::WebNavigationTypeReload && |
524 type != WebKit::WebNavigationTypeBackForward && !is_form_post) { | 524 type != blink::WebNavigationTypeBackForward && !is_form_post) { |
525 // The opener relationship between the new window and the parent allows the | 525 // The opener relationship between the new window and the parent allows the |
526 // new window to script the parent and vice versa. This is not allowed if | 526 // new window to script the parent and vice versa. This is not allowed if |
527 // the origins of the two domains are different. This can be treated as a | 527 // the origins of the two domains are different. This can be treated as a |
528 // top level navigation and routed back to the host. | 528 // top level navigation and routed back to the host. |
529 WebKit::WebFrame* opener = frame->opener(); | 529 blink::WebFrame* opener = frame->opener(); |
530 if (!opener) | 530 if (!opener) |
531 return true; | 531 return true; |
532 | 532 |
533 if (url.GetOrigin() != GURL(opener->document().url()).GetOrigin()) | 533 if (url.GetOrigin() != GURL(opener->document().url()).GetOrigin()) |
534 return true; | 534 return true; |
535 } | 535 } |
536 return false; | 536 return false; |
537 } | 537 } |
538 | 538 |
539 static void NotifyTimezoneChange(WebKit::WebFrame* frame) { | 539 static void NotifyTimezoneChange(blink::WebFrame* frame) { |
540 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 540 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
541 v8::Context::Scope context_scope(frame->mainWorldScriptContext()); | 541 v8::Context::Scope context_scope(frame->mainWorldScriptContext()); |
542 v8::Date::DateTimeConfigurationChangeNotification(); | 542 v8::Date::DateTimeConfigurationChangeNotification(); |
543 WebKit::WebFrame* child = frame->firstChild(); | 543 blink::WebFrame* child = frame->firstChild(); |
544 for (; child; child = child->nextSibling()) | 544 for (; child; child = child->nextSibling()) |
545 NotifyTimezoneChange(child); | 545 NotifyTimezoneChange(child); |
546 } | 546 } |
547 | 547 |
548 static WindowOpenDisposition NavigationPolicyToDisposition( | 548 static WindowOpenDisposition NavigationPolicyToDisposition( |
549 WebNavigationPolicy policy) { | 549 WebNavigationPolicy policy) { |
550 switch (policy) { | 550 switch (policy) { |
551 case WebKit::WebNavigationPolicyIgnore: | 551 case blink::WebNavigationPolicyIgnore: |
552 return IGNORE_ACTION; | 552 return IGNORE_ACTION; |
553 case WebKit::WebNavigationPolicyDownload: | 553 case blink::WebNavigationPolicyDownload: |
554 return SAVE_TO_DISK; | 554 return SAVE_TO_DISK; |
555 case WebKit::WebNavigationPolicyCurrentTab: | 555 case blink::WebNavigationPolicyCurrentTab: |
556 return CURRENT_TAB; | 556 return CURRENT_TAB; |
557 case WebKit::WebNavigationPolicyNewBackgroundTab: | 557 case blink::WebNavigationPolicyNewBackgroundTab: |
558 return NEW_BACKGROUND_TAB; | 558 return NEW_BACKGROUND_TAB; |
559 case WebKit::WebNavigationPolicyNewForegroundTab: | 559 case blink::WebNavigationPolicyNewForegroundTab: |
560 return NEW_FOREGROUND_TAB; | 560 return NEW_FOREGROUND_TAB; |
561 case WebKit::WebNavigationPolicyNewWindow: | 561 case blink::WebNavigationPolicyNewWindow: |
562 return NEW_WINDOW; | 562 return NEW_WINDOW; |
563 case WebKit::WebNavigationPolicyNewPopup: | 563 case blink::WebNavigationPolicyNewPopup: |
564 return NEW_POPUP; | 564 return NEW_POPUP; |
565 default: | 565 default: |
566 NOTREACHED() << "Unexpected WebNavigationPolicy"; | 566 NOTREACHED() << "Unexpected WebNavigationPolicy"; |
567 return IGNORE_ACTION; | 567 return IGNORE_ACTION; |
568 } | 568 } |
569 } | 569 } |
570 | 570 |
571 // Returns true if the device scale is high enough that losing subpixel | 571 // Returns true if the device scale is high enough that losing subpixel |
572 // antialiasing won't have a noticeable effect on text quality. | 572 // antialiasing won't have a noticeable effect on text quality. |
573 static bool DeviceScaleEnsuresTextQuality(float device_scale_factor) { | 573 static bool DeviceScaleEnsuresTextQuality(float device_scale_factor) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 | 673 |
674 if (command_line.HasSwitch(switches::kDisableAcceleratedFixedRootBackground)) | 674 if (command_line.HasSwitch(switches::kDisableAcceleratedFixedRootBackground)) |
675 return false; | 675 return false; |
676 | 676 |
677 if (command_line.HasSwitch(switches::kEnableAcceleratedFixedRootBackground)) | 677 if (command_line.HasSwitch(switches::kEnableAcceleratedFixedRootBackground)) |
678 return true; | 678 return true; |
679 | 679 |
680 return DeviceScaleEnsuresTextQuality(device_scale_factor); | 680 return DeviceScaleEnsuresTextQuality(device_scale_factor); |
681 } | 681 } |
682 | 682 |
683 static FaviconURL::IconType ToFaviconType(WebKit::WebIconURL::Type type) { | 683 static FaviconURL::IconType ToFaviconType(blink::WebIconURL::Type type) { |
684 switch (type) { | 684 switch (type) { |
685 case WebKit::WebIconURL::TypeFavicon: | 685 case blink::WebIconURL::TypeFavicon: |
686 return FaviconURL::FAVICON; | 686 return FaviconURL::FAVICON; |
687 case WebKit::WebIconURL::TypeTouch: | 687 case blink::WebIconURL::TypeTouch: |
688 return FaviconURL::TOUCH_ICON; | 688 return FaviconURL::TOUCH_ICON; |
689 case WebKit::WebIconURL::TypeTouchPrecomposed: | 689 case blink::WebIconURL::TypeTouchPrecomposed: |
690 return FaviconURL::TOUCH_PRECOMPOSED_ICON; | 690 return FaviconURL::TOUCH_PRECOMPOSED_ICON; |
691 case WebKit::WebIconURL::TypeInvalid: | 691 case blink::WebIconURL::TypeInvalid: |
692 return FaviconURL::INVALID_ICON; | 692 return FaviconURL::INVALID_ICON; |
693 } | 693 } |
694 return FaviconURL::INVALID_ICON; | 694 return FaviconURL::INVALID_ICON; |
695 } | 695 } |
696 | 696 |
697 /////////////////////////////////////////////////////////////////////////////// | 697 /////////////////////////////////////////////////////////////////////////////// |
698 | 698 |
699 struct RenderViewImpl::PendingFileChooser { | 699 struct RenderViewImpl::PendingFileChooser { |
700 PendingFileChooser(const FileChooserParams& p, WebFileChooserCompletion* c) | 700 PendingFileChooser(const FileChooserParams& p, WebFileChooserCompletion* c) |
701 : params(p), | 701 : params(p), |
702 completion(c) { | 702 completion(c) { |
703 } | 703 } |
704 FileChooserParams params; | 704 FileChooserParams params; |
705 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. | 705 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. |
706 }; | 706 }; |
707 | 707 |
708 namespace { | 708 namespace { |
709 | 709 |
710 class WebWidgetLockTarget : public MouseLockDispatcher::LockTarget { | 710 class WebWidgetLockTarget : public MouseLockDispatcher::LockTarget { |
711 public: | 711 public: |
712 explicit WebWidgetLockTarget(WebKit::WebWidget* webwidget) | 712 explicit WebWidgetLockTarget(blink::WebWidget* webwidget) |
713 : webwidget_(webwidget) {} | 713 : webwidget_(webwidget) {} |
714 | 714 |
715 virtual void OnLockMouseACK(bool succeeded) OVERRIDE { | 715 virtual void OnLockMouseACK(bool succeeded) OVERRIDE { |
716 if (succeeded) | 716 if (succeeded) |
717 webwidget_->didAcquirePointerLock(); | 717 webwidget_->didAcquirePointerLock(); |
718 else | 718 else |
719 webwidget_->didNotAcquirePointerLock(); | 719 webwidget_->didNotAcquirePointerLock(); |
720 } | 720 } |
721 | 721 |
722 virtual void OnMouseLockLost() OVERRIDE { | 722 virtual void OnMouseLockLost() OVERRIDE { |
723 webwidget_->didLosePointerLock(); | 723 webwidget_->didLosePointerLock(); |
724 } | 724 } |
725 | 725 |
726 virtual bool HandleMouseLockedInputEvent( | 726 virtual bool HandleMouseLockedInputEvent( |
727 const WebKit::WebMouseEvent &event) OVERRIDE { | 727 const blink::WebMouseEvent &event) OVERRIDE { |
728 // The WebWidget handles mouse lock in WebKit's handleInputEvent(). | 728 // The WebWidget handles mouse lock in WebKit's handleInputEvent(). |
729 return false; | 729 return false; |
730 } | 730 } |
731 | 731 |
732 private: | 732 private: |
733 WebKit::WebWidget* webwidget_; | 733 blink::WebWidget* webwidget_; |
734 }; | 734 }; |
735 | 735 |
736 int64 ExtractPostId(const WebHistoryItem& item) { | 736 int64 ExtractPostId(const WebHistoryItem& item) { |
737 if (item.isNull()) | 737 if (item.isNull()) |
738 return -1; | 738 return -1; |
739 | 739 |
740 if (item.httpBody().isNull()) | 740 if (item.httpBody().isNull()) |
741 return -1; | 741 return -1; |
742 | 742 |
743 return item.httpBody().identifier(); | 743 return item.httpBody().identifier(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 WebDragData result; | 813 WebDragData result; |
814 result.initialize(); | 814 result.initialize(); |
815 result.setItems(item_list); | 815 result.setItems(item_list); |
816 result.setFilesystemId(drop_data.filesystem_id); | 816 result.setFilesystemId(drop_data.filesystem_id); |
817 return result; | 817 return result; |
818 } | 818 } |
819 | 819 |
820 } // namespace | 820 } // namespace |
821 | 821 |
822 RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) | 822 RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) |
823 : RenderWidget(WebKit::WebPopupTypeNone, | 823 : RenderWidget(blink::WebPopupTypeNone, |
824 params->screen_info, | 824 params->screen_info, |
825 params->swapped_out, | 825 params->swapped_out, |
826 params->hidden), | 826 params->hidden), |
827 webkit_preferences_(params->webkit_prefs), | 827 webkit_preferences_(params->webkit_prefs), |
828 send_content_state_immediately_(false), | 828 send_content_state_immediately_(false), |
829 enabled_bindings_(0), | 829 enabled_bindings_(0), |
830 send_preferred_size_changes_(false), | 830 send_preferred_size_changes_(false), |
831 is_loading_(false), | 831 is_loading_(false), |
832 navigation_gesture_(NavigationGestureUnknown), | 832 navigation_gesture_(NavigationGestureUnknown), |
833 opened_by_user_gesture_(true), | 833 opened_by_user_gesture_(true), |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 } | 1066 } |
1067 | 1067 |
1068 /*static*/ | 1068 /*static*/ |
1069 RenderViewImpl* RenderViewImpl::FromWebView(WebView* webview) { | 1069 RenderViewImpl* RenderViewImpl::FromWebView(WebView* webview) { |
1070 ViewMap* views = g_view_map.Pointer(); | 1070 ViewMap* views = g_view_map.Pointer(); |
1071 ViewMap::iterator it = views->find(webview); | 1071 ViewMap::iterator it = views->find(webview); |
1072 return it == views->end() ? NULL : it->second; | 1072 return it == views->end() ? NULL : it->second; |
1073 } | 1073 } |
1074 | 1074 |
1075 /*static*/ | 1075 /*static*/ |
1076 RenderView* RenderView::FromWebView(WebKit::WebView* webview) { | 1076 RenderView* RenderView::FromWebView(blink::WebView* webview) { |
1077 return RenderViewImpl::FromWebView(webview); | 1077 return RenderViewImpl::FromWebView(webview); |
1078 } | 1078 } |
1079 | 1079 |
1080 /*static*/ | 1080 /*static*/ |
1081 RenderViewImpl* RenderViewImpl::FromRoutingID(int32 routing_id) { | 1081 RenderViewImpl* RenderViewImpl::FromRoutingID(int32 routing_id) { |
1082 RoutingIDViewMap* views = g_routing_id_view_map.Pointer(); | 1082 RoutingIDViewMap* views = g_routing_id_view_map.Pointer(); |
1083 RoutingIDViewMap::iterator it = views->find(routing_id); | 1083 RoutingIDViewMap::iterator it = views->find(routing_id); |
1084 return it == views->end() ? NULL : it->second; | 1084 return it == views->end() ? NULL : it->second; |
1085 } | 1085 } |
1086 | 1086 |
(...skipping 18 matching lines...) Expand all Loading... |
1105 const WebPreferences& webkit_prefs, | 1105 const WebPreferences& webkit_prefs, |
1106 int32 routing_id, | 1106 int32 routing_id, |
1107 int32 main_frame_routing_id, | 1107 int32 main_frame_routing_id, |
1108 int32 surface_id, | 1108 int32 surface_id, |
1109 int64 session_storage_namespace_id, | 1109 int64 session_storage_namespace_id, |
1110 const string16& frame_name, | 1110 const string16& frame_name, |
1111 bool is_renderer_created, | 1111 bool is_renderer_created, |
1112 bool swapped_out, | 1112 bool swapped_out, |
1113 bool hidden, | 1113 bool hidden, |
1114 int32 next_page_id, | 1114 int32 next_page_id, |
1115 const WebKit::WebScreenInfo& screen_info, | 1115 const blink::WebScreenInfo& screen_info, |
1116 AccessibilityMode accessibility_mode, | 1116 AccessibilityMode accessibility_mode, |
1117 bool allow_partial_swap) { | 1117 bool allow_partial_swap) { |
1118 DCHECK(routing_id != MSG_ROUTING_NONE); | 1118 DCHECK(routing_id != MSG_ROUTING_NONE); |
1119 RenderViewImplParams params( | 1119 RenderViewImplParams params( |
1120 opener_id, | 1120 opener_id, |
1121 renderer_prefs, | 1121 renderer_prefs, |
1122 webkit_prefs, | 1122 webkit_prefs, |
1123 routing_id, | 1123 routing_id, |
1124 main_frame_routing_id, | 1124 main_frame_routing_id, |
1125 surface_id, | 1125 surface_id, |
(...skipping 24 matching lines...) Expand all Loading... |
1150 | 1150 |
1151 void RenderViewImpl::AddObserver(RenderViewObserver* observer) { | 1151 void RenderViewImpl::AddObserver(RenderViewObserver* observer) { |
1152 observers_.AddObserver(observer); | 1152 observers_.AddObserver(observer); |
1153 } | 1153 } |
1154 | 1154 |
1155 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { | 1155 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { |
1156 observer->RenderViewGone(); | 1156 observer->RenderViewGone(); |
1157 observers_.RemoveObserver(observer); | 1157 observers_.RemoveObserver(observer); |
1158 } | 1158 } |
1159 | 1159 |
1160 WebKit::WebView* RenderViewImpl::webview() const { | 1160 blink::WebView* RenderViewImpl::webview() const { |
1161 return static_cast<WebKit::WebView*>(webwidget()); | 1161 return static_cast<blink::WebView*>(webwidget()); |
1162 } | 1162 } |
1163 | 1163 |
1164 #if defined(ENABLE_PLUGINS) | 1164 #if defined(ENABLE_PLUGINS) |
1165 void RenderViewImpl::PepperInstanceCreated(PepperPluginInstanceImpl* instance) { | 1165 void RenderViewImpl::PepperInstanceCreated(PepperPluginInstanceImpl* instance) { |
1166 active_pepper_instances_.insert(instance); | 1166 active_pepper_instances_.insert(instance); |
1167 } | 1167 } |
1168 | 1168 |
1169 void RenderViewImpl::PepperInstanceDeleted(PepperPluginInstanceImpl* instance) { | 1169 void RenderViewImpl::PepperInstanceDeleted(PepperPluginInstanceImpl* instance) { |
1170 active_pepper_instances_.erase(instance); | 1170 active_pepper_instances_.erase(instance); |
1171 | 1171 |
1172 if (pepper_last_mouse_event_target_ == instance) | 1172 if (pepper_last_mouse_event_target_ == instance) |
1173 pepper_last_mouse_event_target_ = NULL; | 1173 pepper_last_mouse_event_target_ = NULL; |
1174 if (focused_pepper_plugin_ == instance) | 1174 if (focused_pepper_plugin_ == instance) |
1175 PepperFocusChanged(instance, false); | 1175 PepperFocusChanged(instance, false); |
1176 } | 1176 } |
1177 | 1177 |
1178 void RenderViewImpl::PepperDidChangeCursor( | 1178 void RenderViewImpl::PepperDidChangeCursor( |
1179 PepperPluginInstanceImpl* instance, | 1179 PepperPluginInstanceImpl* instance, |
1180 const WebKit::WebCursorInfo& cursor) { | 1180 const blink::WebCursorInfo& cursor) { |
1181 // Update the cursor appearance immediately if the requesting plugin is the | 1181 // Update the cursor appearance immediately if the requesting plugin is the |
1182 // one which receives the last mouse event. Otherwise, the new cursor won't be | 1182 // one which receives the last mouse event. Otherwise, the new cursor won't be |
1183 // picked up until the plugin gets the next input event. That is bad if, e.g., | 1183 // picked up until the plugin gets the next input event. That is bad if, e.g., |
1184 // the plugin would like to set an invisible cursor when there isn't any user | 1184 // the plugin would like to set an invisible cursor when there isn't any user |
1185 // input for a while. | 1185 // input for a while. |
1186 if (instance == pepper_last_mouse_event_target_) | 1186 if (instance == pepper_last_mouse_event_target_) |
1187 didChangeCursor(cursor); | 1187 didChangeCursor(cursor); |
1188 } | 1188 } |
1189 | 1189 |
1190 void RenderViewImpl::PepperDidReceiveMouseEvent( | 1190 void RenderViewImpl::PepperDidReceiveMouseEvent( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 SyncSelectionIfRequired(); | 1237 SyncSelectionIfRequired(); |
1238 } | 1238 } |
1239 | 1239 |
1240 RenderWidgetFullscreenPepper* RenderViewImpl::CreatePepperFullscreenContainer( | 1240 RenderWidgetFullscreenPepper* RenderViewImpl::CreatePepperFullscreenContainer( |
1241 PepperPluginInstanceImpl* plugin) { | 1241 PepperPluginInstanceImpl* plugin) { |
1242 GURL active_url; | 1242 GURL active_url; |
1243 if (webview() && webview()->mainFrame()) | 1243 if (webview() && webview()->mainFrame()) |
1244 active_url = GURL(webview()->mainFrame()->document().url()); | 1244 active_url = GURL(webview()->mainFrame()->document().url()); |
1245 RenderWidgetFullscreenPepper* widget = RenderWidgetFullscreenPepper::Create( | 1245 RenderWidgetFullscreenPepper* widget = RenderWidgetFullscreenPepper::Create( |
1246 routing_id_, plugin, active_url, screen_info_); | 1246 routing_id_, plugin, active_url, screen_info_); |
1247 widget->show(WebKit::WebNavigationPolicyIgnore); | 1247 widget->show(blink::WebNavigationPolicyIgnore); |
1248 return widget; | 1248 return widget; |
1249 } | 1249 } |
1250 | 1250 |
1251 void RenderViewImpl::PepperPluginCreated(RendererPpapiHost* host) { | 1251 void RenderViewImpl::PepperPluginCreated(RendererPpapiHost* host) { |
1252 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 1252 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
1253 DidCreatePepperPlugin(host)); | 1253 DidCreatePepperPlugin(host)); |
1254 } | 1254 } |
1255 | 1255 |
1256 bool RenderViewImpl::GetPepperCaretBounds(gfx::Rect* rect) { | 1256 bool RenderViewImpl::GetPepperCaretBounds(gfx::Rect* rect) { |
1257 if (!focused_pepper_plugin_) | 1257 if (!focused_pepper_plugin_) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 std::string* actual_mime_type) { | 1299 std::string* actual_mime_type) { |
1300 bool found = false; | 1300 bool found = false; |
1301 Send(new ViewHostMsg_GetPluginInfo( | 1301 Send(new ViewHostMsg_GetPluginInfo( |
1302 routing_id_, url, page_url, mime_type, &found, plugin_info, | 1302 routing_id_, url, page_url, mime_type, &found, plugin_info, |
1303 actual_mime_type)); | 1303 actual_mime_type)); |
1304 return found; | 1304 return found; |
1305 } | 1305 } |
1306 | 1306 |
1307 void RenderViewImpl::SimulateImeSetComposition( | 1307 void RenderViewImpl::SimulateImeSetComposition( |
1308 const string16& text, | 1308 const string16& text, |
1309 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 1309 const std::vector<blink::WebCompositionUnderline>& underlines, |
1310 int selection_start, | 1310 int selection_start, |
1311 int selection_end) { | 1311 int selection_end) { |
1312 OnImeSetComposition(text, underlines, selection_start, selection_end); | 1312 OnImeSetComposition(text, underlines, selection_start, selection_end); |
1313 } | 1313 } |
1314 | 1314 |
1315 void RenderViewImpl::SimulateImeConfirmComposition( | 1315 void RenderViewImpl::SimulateImeConfirmComposition( |
1316 const string16& text, | 1316 const string16& text, |
1317 const gfx::Range& replacement_range) { | 1317 const gfx::Range& replacement_range) { |
1318 OnImeConfirmComposition(text, replacement_range, false); | 1318 OnImeConfirmComposition(text, replacement_range, false); |
1319 } | 1319 } |
(...skipping 17 matching lines...) Expand all Loading... |
1337 // This message can be sent during event-handling, and needs to be delivered | 1337 // This message can be sent during event-handling, and needs to be delivered |
1338 // within that context. | 1338 // within that context. |
1339 msg->set_unblock(true); | 1339 msg->set_unblock(true); |
1340 Send(msg); | 1340 Send(msg); |
1341 } | 1341 } |
1342 #endif // defined(OS_MACOSX) | 1342 #endif // defined(OS_MACOSX) |
1343 | 1343 |
1344 #endif // ENABLE_PLUGINS | 1344 #endif // ENABLE_PLUGINS |
1345 | 1345 |
1346 void RenderViewImpl::TransferActiveWheelFlingAnimation( | 1346 void RenderViewImpl::TransferActiveWheelFlingAnimation( |
1347 const WebKit::WebActiveWheelFlingParameters& params) { | 1347 const blink::WebActiveWheelFlingParameters& params) { |
1348 if (webview()) | 1348 if (webview()) |
1349 webview()->transferActiveWheelFlingAnimation(params); | 1349 webview()->transferActiveWheelFlingAnimation(params); |
1350 } | 1350 } |
1351 | 1351 |
1352 bool RenderViewImpl::HasIMETextFocus() { | 1352 bool RenderViewImpl::HasIMETextFocus() { |
1353 return GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; | 1353 return GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; |
1354 } | 1354 } |
1355 | 1355 |
1356 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { | 1356 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
1357 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 1357 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 | 1833 |
1834 WebFrame* frame = webview()->focusedFrame(); | 1834 WebFrame* frame = webview()->focusedFrame(); |
1835 if (!frame->hasSelection()) | 1835 if (!frame->hasSelection()) |
1836 return; | 1836 return; |
1837 | 1837 |
1838 frame->replaceMisspelledRange(text); | 1838 frame->replaceMisspelledRange(text); |
1839 } | 1839 } |
1840 | 1840 |
1841 void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect( | 1841 void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect( |
1842 const gfx::Rect& rect) { | 1842 const gfx::Rect& rect) { |
1843 WebKit::WebNode node = GetFocusedNode(); | 1843 blink::WebNode node = GetFocusedNode(); |
1844 if (!node.isNull()) { | 1844 if (!node.isNull()) { |
1845 if (IsEditableNode(node)) { | 1845 if (IsEditableNode(node)) { |
1846 webview()->saveScrollAndScaleState(); | 1846 webview()->saveScrollAndScaleState(); |
1847 webview()->scrollFocusedNodeIntoRect(rect); | 1847 webview()->scrollFocusedNodeIntoRect(rect); |
1848 } | 1848 } |
1849 } | 1849 } |
1850 } | 1850 } |
1851 | 1851 |
1852 void RenderViewImpl::OnSelectAll() { | 1852 void RenderViewImpl::OnSelectAll() { |
1853 if (!webview()) | 1853 if (!webview()) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 void RenderViewImpl::OnSetEditableSelectionOffsets(int start, int end) { | 1917 void RenderViewImpl::OnSetEditableSelectionOffsets(int start, int end) { |
1918 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1918 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
1919 if (!ShouldHandleImeEvent()) | 1919 if (!ShouldHandleImeEvent()) |
1920 return; | 1920 return; |
1921 ImeEventGuard guard(this); | 1921 ImeEventGuard guard(this); |
1922 webview()->setEditableSelectionOffsets(start, end); | 1922 webview()->setEditableSelectionOffsets(start, end); |
1923 } | 1923 } |
1924 | 1924 |
1925 void RenderViewImpl::OnSetCompositionFromExistingText( | 1925 void RenderViewImpl::OnSetCompositionFromExistingText( |
1926 int start, int end, | 1926 int start, int end, |
1927 const std::vector<WebKit::WebCompositionUnderline>& underlines) { | 1927 const std::vector<blink::WebCompositionUnderline>& underlines) { |
1928 if (!ShouldHandleImeEvent()) | 1928 if (!ShouldHandleImeEvent()) |
1929 return; | 1929 return; |
1930 ImeEventGuard guard(this); | 1930 ImeEventGuard guard(this); |
1931 webview()->setCompositionFromExistingText(start, end, underlines); | 1931 webview()->setCompositionFromExistingText(start, end, underlines); |
1932 } | 1932 } |
1933 | 1933 |
1934 void RenderViewImpl::OnExtendSelectionAndDelete(int before, int after) { | 1934 void RenderViewImpl::OnExtendSelectionAndDelete(int before, int after) { |
1935 if (!ShouldHandleImeEvent()) | 1935 if (!ShouldHandleImeEvent()) |
1936 return; | 1936 return; |
1937 ImeEventGuard guard(this); | 1937 ImeEventGuard guard(this); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 params.original_request_url = params.redirects.at(0); | 2126 params.original_request_url = params.redirects.at(0); |
2127 else | 2127 else |
2128 params.original_request_url = original_request.url(); | 2128 params.original_request_url = original_request.url(); |
2129 | 2129 |
2130 params.history_list_was_cleared = | 2130 params.history_list_was_cleared = |
2131 navigation_state->history_list_was_cleared(); | 2131 navigation_state->history_list_was_cleared(); |
2132 | 2132 |
2133 // Save some histogram data so we can compute the average memory used per | 2133 // Save some histogram data so we can compute the average memory used per |
2134 // page load of the glyphs. | 2134 // page load of the glyphs. |
2135 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", | 2135 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", |
2136 WebKit::WebGlyphCache::pageCount()); | 2136 blink::WebGlyphCache::pageCount()); |
2137 | 2137 |
2138 // This message needs to be sent before any of allowScripts(), | 2138 // This message needs to be sent before any of allowScripts(), |
2139 // allowImages(), allowPlugins() is called for the new page, so that when | 2139 // allowImages(), allowPlugins() is called for the new page, so that when |
2140 // these functions send a ViewHostMsg_ContentBlocked message, it arrives | 2140 // these functions send a ViewHostMsg_ContentBlocked message, it arrives |
2141 // after the ViewHostMsg_FrameNavigate message. | 2141 // after the ViewHostMsg_FrameNavigate message. |
2142 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); | 2142 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); |
2143 } else { | 2143 } else { |
2144 // Subframe navigation: the type depends on whether this navigation | 2144 // Subframe navigation: the type depends on whether this navigation |
2145 // generated a new session history entry. When they do generate a session | 2145 // generated a new session history entry. When they do generate a session |
2146 // history entry, it means the user initiated the navigation and we should | 2146 // history entry, it means the user initiated the navigation and we should |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2232 WebDataSource* ds = frame->provisionalDataSource(); | 2232 WebDataSource* ds = frame->provisionalDataSource(); |
2233 if (ds) { | 2233 if (ds) { |
2234 params.should_replace_current_entry = ds->replacesCurrentHistoryItem(); | 2234 params.should_replace_current_entry = ds->replacesCurrentHistoryItem(); |
2235 } else { | 2235 } else { |
2236 params.should_replace_current_entry = false; | 2236 params.should_replace_current_entry = false; |
2237 } | 2237 } |
2238 params.user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); | 2238 params.user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); |
2239 if (GetContentClient()->renderer()->AllowPopup()) | 2239 if (GetContentClient()->renderer()->AllowPopup()) |
2240 params.user_gesture = true; | 2240 params.user_gesture = true; |
2241 | 2241 |
2242 if (policy == WebKit::WebNavigationPolicyNewBackgroundTab || | 2242 if (policy == blink::WebNavigationPolicyNewBackgroundTab || |
2243 policy == WebKit::WebNavigationPolicyNewForegroundTab || | 2243 policy == blink::WebNavigationPolicyNewForegroundTab || |
2244 policy == WebKit::WebNavigationPolicyNewWindow || | 2244 policy == blink::WebNavigationPolicyNewWindow || |
2245 policy == WebKit::WebNavigationPolicyNewPopup) { | 2245 policy == blink::WebNavigationPolicyNewPopup) { |
2246 WebUserGestureIndicator::consumeUserGesture(); | 2246 WebUserGestureIndicator::consumeUserGesture(); |
2247 } | 2247 } |
2248 | 2248 |
2249 Send(new ViewHostMsg_OpenURL(routing_id_, params)); | 2249 Send(new ViewHostMsg_OpenURL(routing_id_, params)); |
2250 } | 2250 } |
2251 | 2251 |
2252 // WebViewDelegate ------------------------------------------------------------ | 2252 // WebViewDelegate ------------------------------------------------------------ |
2253 | 2253 |
2254 void RenderViewImpl::LoadNavigationErrorPage( | 2254 void RenderViewImpl::LoadNavigationErrorPage( |
2255 WebFrame* frame, | 2255 WebFrame* frame, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2331 while(it != pending_snapshots_.end()) { | 2331 while(it != pending_snapshots_.end()) { |
2332 if (it->first <= snapshot_id) { | 2332 if (it->first <= snapshot_id) { |
2333 it->second.Run(size, png); | 2333 it->second.Run(size, png); |
2334 pending_snapshots_.erase(it++); | 2334 pending_snapshots_.erase(it++); |
2335 } else { | 2335 } else { |
2336 ++it; | 2336 ++it; |
2337 } | 2337 } |
2338 } | 2338 } |
2339 } | 2339 } |
2340 | 2340 |
2341 // WebKit::WebViewClient ------------------------------------------------------ | 2341 // blink::WebViewClient ------------------------------------------------------ |
2342 | 2342 |
2343 WebView* RenderViewImpl::createView( | 2343 WebView* RenderViewImpl::createView( |
2344 WebFrame* creator, | 2344 WebFrame* creator, |
2345 const WebURLRequest& request, | 2345 const WebURLRequest& request, |
2346 const WebWindowFeatures& features, | 2346 const WebWindowFeatures& features, |
2347 const WebString& frame_name, | 2347 const WebString& frame_name, |
2348 WebNavigationPolicy policy) { | 2348 WebNavigationPolicy policy) { |
2349 return createView(creator, request, features, frame_name, policy, | 2349 return createView(creator, request, features, frame_name, policy, |
2350 creator->willSuppressOpenerInNewFrame()); | 2350 creator->willSuppressOpenerInNewFrame()); |
2351 } | 2351 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2437 // Record whether the creator frame is trying to suppress the opener field. | 2437 // Record whether the creator frame is trying to suppress the opener field. |
2438 view->opener_suppressed_ = params.opener_suppressed; | 2438 view->opener_suppressed_ = params.opener_suppressed; |
2439 | 2439 |
2440 // Copy over the alternate error page URL so we can have alt error pages in | 2440 // Copy over the alternate error page URL so we can have alt error pages in |
2441 // the new render view (we don't need the browser to send the URL back down). | 2441 // the new render view (we don't need the browser to send the URL back down). |
2442 view->alternate_error_page_url_ = alternate_error_page_url_; | 2442 view->alternate_error_page_url_ = alternate_error_page_url_; |
2443 | 2443 |
2444 return view->webview(); | 2444 return view->webview(); |
2445 } | 2445 } |
2446 | 2446 |
2447 WebWidget* RenderViewImpl::createPopupMenu(WebKit::WebPopupType popup_type) { | 2447 WebWidget* RenderViewImpl::createPopupMenu(blink::WebPopupType popup_type) { |
2448 RenderWidget* widget = | 2448 RenderWidget* widget = |
2449 RenderWidget::Create(routing_id_, popup_type, screen_info_); | 2449 RenderWidget::Create(routing_id_, popup_type, screen_info_); |
2450 if (screen_metrics_emulator_) { | 2450 if (screen_metrics_emulator_) { |
2451 widget->SetPopupOriginAdjustmentsForEmulation( | 2451 widget->SetPopupOriginAdjustmentsForEmulation( |
2452 screen_metrics_emulator_.get()); | 2452 screen_metrics_emulator_.get()); |
2453 } | 2453 } |
2454 return widget->webwidget(); | 2454 return widget->webwidget(); |
2455 } | 2455 } |
2456 | 2456 |
2457 WebExternalPopupMenu* RenderViewImpl::createExternalPopupMenu( | 2457 WebExternalPopupMenu* RenderViewImpl::createExternalPopupMenu( |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2523 message.text, | 2523 message.text, |
2524 static_cast<int32>(source_line), | 2524 static_cast<int32>(source_line), |
2525 source_name)); | 2525 source_name)); |
2526 } | 2526 } |
2527 | 2527 |
2528 void RenderViewImpl::printPage(WebFrame* frame) { | 2528 void RenderViewImpl::printPage(WebFrame* frame) { |
2529 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2529 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
2530 PrintPage(frame, handling_input_event_)); | 2530 PrintPage(frame, handling_input_event_)); |
2531 } | 2531 } |
2532 | 2532 |
2533 WebKit::WebNotificationPresenter* RenderViewImpl::notificationPresenter() { | 2533 blink::WebNotificationPresenter* RenderViewImpl::notificationPresenter() { |
2534 return notification_provider_; | 2534 return notification_provider_; |
2535 } | 2535 } |
2536 | 2536 |
2537 bool RenderViewImpl::enumerateChosenDirectory( | 2537 bool RenderViewImpl::enumerateChosenDirectory( |
2538 const WebString& path, | 2538 const WebString& path, |
2539 WebFileChooserCompletion* chooser_completion) { | 2539 WebFileChooserCompletion* chooser_completion) { |
2540 int id = enumeration_completion_id_++; | 2540 int id = enumeration_completion_id_++; |
2541 enumeration_completions_[id] = chooser_completion; | 2541 enumeration_completions_[id] = chooser_completion; |
2542 return Send(new ViewHostMsg_EnumerateDirectory( | 2542 return Send(new ViewHostMsg_EnumerateDirectory( |
2543 routing_id_, | 2543 routing_id_, |
2544 id, | 2544 id, |
2545 base::FilePath::FromUTF16Unsafe(path))); | 2545 base::FilePath::FromUTF16Unsafe(path))); |
2546 } | 2546 } |
2547 | 2547 |
2548 void RenderViewImpl::initializeHelperPluginWebFrame( | 2548 void RenderViewImpl::initializeHelperPluginWebFrame( |
2549 WebKit::WebHelperPlugin* plugin) { | 2549 blink::WebHelperPlugin* plugin) { |
2550 plugin->initializeFrame(main_render_frame_.get()); | 2550 plugin->initializeFrame(main_render_frame_.get()); |
2551 } | 2551 } |
2552 | 2552 |
2553 void RenderViewImpl::didStartLoading() { | 2553 void RenderViewImpl::didStartLoading() { |
2554 if (is_loading_) { | 2554 if (is_loading_) { |
2555 DVLOG(1) << "didStartLoading called while loading"; | 2555 DVLOG(1) << "didStartLoading called while loading"; |
2556 return; | 2556 return; |
2557 } | 2557 } |
2558 | 2558 |
2559 is_loading_ = true; | 2559 is_loading_ = true; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2638 if (!frame->executeCommand(WebString::fromUTF8(it->name), | 2638 if (!frame->executeCommand(WebString::fromUTF8(it->name), |
2639 WebString::fromUTF8(it->value), | 2639 WebString::fromUTF8(it->value), |
2640 GetFocusedNode())) | 2640 GetFocusedNode())) |
2641 break; | 2641 break; |
2642 did_execute_command = true; | 2642 did_execute_command = true; |
2643 } | 2643 } |
2644 | 2644 |
2645 return did_execute_command; | 2645 return did_execute_command; |
2646 } | 2646 } |
2647 | 2647 |
2648 WebKit::WebColorChooser* RenderViewImpl::createColorChooser( | 2648 blink::WebColorChooser* RenderViewImpl::createColorChooser( |
2649 WebKit::WebColorChooserClient* client, | 2649 blink::WebColorChooserClient* client, |
2650 const WebKit::WebColor& initial_color) { | 2650 const blink::WebColor& initial_color) { |
2651 RendererWebColorChooserImpl* color_chooser = | 2651 RendererWebColorChooserImpl* color_chooser = |
2652 new RendererWebColorChooserImpl(this, client); | 2652 new RendererWebColorChooserImpl(this, client); |
2653 color_chooser->Open(static_cast<SkColor>(initial_color)); | 2653 color_chooser->Open(static_cast<SkColor>(initial_color)); |
2654 return color_chooser; | 2654 return color_chooser; |
2655 } | 2655 } |
2656 | 2656 |
2657 bool RenderViewImpl::runFileChooser( | 2657 bool RenderViewImpl::runFileChooser( |
2658 const WebKit::WebFileChooserParams& params, | 2658 const blink::WebFileChooserParams& params, |
2659 WebFileChooserCompletion* chooser_completion) { | 2659 WebFileChooserCompletion* chooser_completion) { |
2660 // Do not open the file dialog in a hidden RenderView. | 2660 // Do not open the file dialog in a hidden RenderView. |
2661 if (is_hidden()) | 2661 if (is_hidden()) |
2662 return false; | 2662 return false; |
2663 FileChooserParams ipc_params; | 2663 FileChooserParams ipc_params; |
2664 if (params.directory) | 2664 if (params.directory) |
2665 ipc_params.mode = FileChooserParams::UploadFolder; | 2665 ipc_params.mode = FileChooserParams::UploadFolder; |
2666 else if (params.multiSelect) | 2666 else if (params.multiSelect) |
2667 ipc_params.mode = FileChooserParams::OpenMultiple; | 2667 ipc_params.mode = FileChooserParams::OpenMultiple; |
2668 else if (params.saveAs) | 2668 else if (params.saveAs) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2713 if (ok) | 2713 if (ok) |
2714 actual_value->assign(result); | 2714 actual_value->assign(result); |
2715 return ok; | 2715 return ok; |
2716 } | 2716 } |
2717 | 2717 |
2718 bool RenderViewImpl::runModalBeforeUnloadDialog( | 2718 bool RenderViewImpl::runModalBeforeUnloadDialog( |
2719 WebFrame* frame, const WebString& message) { | 2719 WebFrame* frame, const WebString& message) { |
2720 bool is_reload = false; | 2720 bool is_reload = false; |
2721 WebDataSource* ds = frame->provisionalDataSource(); | 2721 WebDataSource* ds = frame->provisionalDataSource(); |
2722 if (ds) | 2722 if (ds) |
2723 is_reload = (ds->navigationType() == WebKit::WebNavigationTypeReload); | 2723 is_reload = (ds->navigationType() == blink::WebNavigationTypeReload); |
2724 return runModalBeforeUnloadDialog(frame, is_reload, message); | 2724 return runModalBeforeUnloadDialog(frame, is_reload, message); |
2725 } | 2725 } |
2726 | 2726 |
2727 bool RenderViewImpl::runModalBeforeUnloadDialog( | 2727 bool RenderViewImpl::runModalBeforeUnloadDialog( |
2728 WebFrame* frame, bool is_reload, const WebString& message) { | 2728 WebFrame* frame, bool is_reload, const WebString& message) { |
2729 // If we are swapping out, we have already run the beforeunload handler. | 2729 // If we are swapping out, we have already run the beforeunload handler. |
2730 // TODO(creis): Fix OnSwapOut to clear the frame without running beforeunload | 2730 // TODO(creis): Fix OnSwapOut to clear the frame without running beforeunload |
2731 // at all, to avoid running it twice. | 2731 // at all, to avoid running it twice. |
2732 if (is_swapped_out_) | 2732 if (is_swapped_out_) |
2733 return true; | 2733 return true; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2944 | 2944 |
2945 int RenderViewImpl::historyBackListCount() { | 2945 int RenderViewImpl::historyBackListCount() { |
2946 return history_list_offset_ < 0 ? 0 : history_list_offset_; | 2946 return history_list_offset_ < 0 ? 0 : history_list_offset_; |
2947 } | 2947 } |
2948 | 2948 |
2949 int RenderViewImpl::historyForwardListCount() { | 2949 int RenderViewImpl::historyForwardListCount() { |
2950 return history_list_length_ - historyBackListCount() - 1; | 2950 return history_list_length_ - historyBackListCount() - 1; |
2951 } | 2951 } |
2952 | 2952 |
2953 void RenderViewImpl::postAccessibilityEvent( | 2953 void RenderViewImpl::postAccessibilityEvent( |
2954 const WebAXObject& obj, WebKit::WebAXEvent event) { | 2954 const WebAXObject& obj, blink::WebAXEvent event) { |
2955 if (renderer_accessibility_) { | 2955 if (renderer_accessibility_) { |
2956 renderer_accessibility_->HandleWebAccessibilityEvent(obj, event); | 2956 renderer_accessibility_->HandleWebAccessibilityEvent(obj, event); |
2957 } | 2957 } |
2958 } | 2958 } |
2959 | 2959 |
2960 void RenderViewImpl::didUpdateInspectorSetting(const WebString& key, | 2960 void RenderViewImpl::didUpdateInspectorSetting(const WebString& key, |
2961 const WebString& value) { | 2961 const WebString& value) { |
2962 Send(new ViewHostMsg_UpdateInspectorSetting(routing_id_, | 2962 Send(new ViewHostMsg_UpdateInspectorSetting(routing_id_, |
2963 key.utf8(), | 2963 key.utf8(), |
2964 value.utf8())); | 2964 value.utf8())); |
2965 } | 2965 } |
2966 | 2966 |
2967 // WebKit::WebWidgetClient ---------------------------------------------------- | 2967 // blink::WebWidgetClient ---------------------------------------------------- |
2968 | 2968 |
2969 void RenderViewImpl::didFocus() { | 2969 void RenderViewImpl::didFocus() { |
2970 // TODO(jcivelli): when https://bugs.webkit.org/show_bug.cgi?id=33389 is fixed | 2970 // TODO(jcivelli): when https://bugs.webkit.org/show_bug.cgi?id=33389 is fixed |
2971 // we won't have to test for user gesture anymore and we can | 2971 // we won't have to test for user gesture anymore and we can |
2972 // move that code back to render_widget.cc | 2972 // move that code back to render_widget.cc |
2973 if (WebUserGestureIndicator::isProcessingUserGesture() && | 2973 if (WebUserGestureIndicator::isProcessingUserGesture() && |
2974 !RenderThreadImpl::current()->layout_test_mode()) { | 2974 !RenderThreadImpl::current()->layout_test_mode()) { |
2975 Send(new ViewHostMsg_Focus(routing_id_)); | 2975 Send(new ViewHostMsg_Focus(routing_id_)); |
2976 } | 2976 } |
2977 } | 2977 } |
(...skipping 23 matching lines...) Expand all Loading... |
3001 } | 3001 } |
3002 did_show_ = true; | 3002 did_show_ = true; |
3003 | 3003 |
3004 DCHECK(opener_id_ != MSG_ROUTING_NONE); | 3004 DCHECK(opener_id_ != MSG_ROUTING_NONE); |
3005 | 3005 |
3006 // Force new windows to a popup if they were not opened with a user gesture. | 3006 // Force new windows to a popup if they were not opened with a user gesture. |
3007 if (!opened_by_user_gesture_) { | 3007 if (!opened_by_user_gesture_) { |
3008 // We exempt background tabs for compat with older versions of Chrome. | 3008 // We exempt background tabs for compat with older versions of Chrome. |
3009 // TODO(darin): This seems bogus. These should have a user gesture, so | 3009 // TODO(darin): This seems bogus. These should have a user gesture, so |
3010 // we probably don't need this check. | 3010 // we probably don't need this check. |
3011 if (policy != WebKit::WebNavigationPolicyNewBackgroundTab) | 3011 if (policy != blink::WebNavigationPolicyNewBackgroundTab) |
3012 policy = WebKit::WebNavigationPolicyNewPopup; | 3012 policy = blink::WebNavigationPolicyNewPopup; |
3013 } | 3013 } |
3014 | 3014 |
3015 // NOTE: initial_pos_ may still have its default values at this point, but | 3015 // NOTE: initial_pos_ may still have its default values at this point, but |
3016 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the | 3016 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the |
3017 // browser process will impose a default position otherwise. | 3017 // browser process will impose a default position otherwise. |
3018 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, | 3018 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, |
3019 NavigationPolicyToDisposition(policy), initial_pos_, | 3019 NavigationPolicyToDisposition(policy), initial_pos_, |
3020 opened_by_user_gesture_)); | 3020 opened_by_user_gesture_)); |
3021 SetPendingWindowRect(initial_pos_); | 3021 SetPendingWindowRect(initial_pos_); |
3022 } | 3022 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3089 } | 3089 } |
3090 | 3090 |
3091 void RenderViewImpl::initializeLayerTreeView() { | 3091 void RenderViewImpl::initializeLayerTreeView() { |
3092 RenderWidget::initializeLayerTreeView(); | 3092 RenderWidget::initializeLayerTreeView(); |
3093 RenderWidgetCompositor* rwc = compositor(); | 3093 RenderWidgetCompositor* rwc = compositor(); |
3094 if (!rwc || !webview() || !webview()->devToolsAgent()) | 3094 if (!rwc || !webview() || !webview()->devToolsAgent()) |
3095 return; | 3095 return; |
3096 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); | 3096 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); |
3097 } | 3097 } |
3098 | 3098 |
3099 // WebKit::WebFrameClient ----------------------------------------------------- | 3099 // blink::WebFrameClient ----------------------------------------------------- |
3100 | 3100 |
3101 WebMediaPlayer* RenderViewImpl::createMediaPlayer( | 3101 WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
3102 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { | 3102 WebFrame* frame, const blink::WebURL& url, WebMediaPlayerClient* client) { |
3103 FOR_EACH_OBSERVER( | 3103 FOR_EACH_OBSERVER( |
3104 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 3104 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
3105 | 3105 |
3106 WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(frame, url, | 3106 WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(frame, url, |
3107 client); | 3107 client); |
3108 if (player) | 3108 if (player) |
3109 return player; | 3109 return player; |
3110 | 3110 |
3111 #if defined(OS_ANDROID) | 3111 #if defined(OS_ANDROID) |
3112 return CreateAndroidWebMediaPlayer(frame, url, client); | 3112 return CreateAndroidWebMediaPlayer(frame, url, client); |
(...skipping 21 matching lines...) Expand all Loading... |
3134 return &cookie_jar_; | 3134 return &cookie_jar_; |
3135 } | 3135 } |
3136 | 3136 |
3137 void RenderViewImpl::didAccessInitialDocument(WebFrame* frame) { | 3137 void RenderViewImpl::didAccessInitialDocument(WebFrame* frame) { |
3138 // Notify the browser process that it is no longer safe to show the pending | 3138 // Notify the browser process that it is no longer safe to show the pending |
3139 // URL of the main frame, since a URL spoof is now possible. | 3139 // URL of the main frame, since a URL spoof is now possible. |
3140 if (!frame->parent() && page_id_ == -1) | 3140 if (!frame->parent() && page_id_ == -1) |
3141 Send(new ViewHostMsg_DidAccessInitialDocument(routing_id_)); | 3141 Send(new ViewHostMsg_DidAccessInitialDocument(routing_id_)); |
3142 } | 3142 } |
3143 | 3143 |
3144 void RenderViewImpl::didDisownOpener(WebKit::WebFrame* frame) { | 3144 void RenderViewImpl::didDisownOpener(blink::WebFrame* frame) { |
3145 // We only need to notify the browser if the active, top-level frame clears | 3145 // We only need to notify the browser if the active, top-level frame clears |
3146 // its opener. We can ignore cases where a swapped out frame clears its | 3146 // its opener. We can ignore cases where a swapped out frame clears its |
3147 // opener after hearing about it from the browser, and the browser does not | 3147 // opener after hearing about it from the browser, and the browser does not |
3148 // (yet) care about subframe openers. | 3148 // (yet) care about subframe openers. |
3149 if (is_swapped_out_ || frame->parent()) | 3149 if (is_swapped_out_ || frame->parent()) |
3150 return; | 3150 return; |
3151 | 3151 |
3152 // Notify WebContents and all its swapped out RenderViews. | 3152 // Notify WebContents and all its swapped out RenderViews. |
3153 Send(new ViewHostMsg_DidDisownOpener(routing_id_)); | 3153 Send(new ViewHostMsg_DidDisownOpener(routing_id_)); |
3154 } | 3154 } |
(...skipping 23 matching lines...) Expand all Loading... |
3178 const std::string& value) { | 3178 const std::string& value) { |
3179 EditCommands edit_commands; | 3179 EditCommands edit_commands; |
3180 edit_commands.push_back(EditCommand(name, value)); | 3180 edit_commands.push_back(EditCommand(name, value)); |
3181 OnSetEditCommandsForNextKeyEvent(edit_commands); | 3181 OnSetEditCommandsForNextKeyEvent(edit_commands); |
3182 } | 3182 } |
3183 | 3183 |
3184 void RenderViewImpl::ClearEditCommands() { | 3184 void RenderViewImpl::ClearEditCommands() { |
3185 edit_commands_.clear(); | 3185 edit_commands_.clear(); |
3186 } | 3186 } |
3187 | 3187 |
3188 SSLStatus RenderViewImpl::GetSSLStatusOfFrame(WebKit::WebFrame* frame) const { | 3188 SSLStatus RenderViewImpl::GetSSLStatusOfFrame(blink::WebFrame* frame) const { |
3189 std::string security_info; | 3189 std::string security_info; |
3190 if (frame && frame->dataSource()) | 3190 if (frame && frame->dataSource()) |
3191 security_info = frame->dataSource()->response().securityInfo(); | 3191 security_info = frame->dataSource()->response().securityInfo(); |
3192 | 3192 |
3193 SSLStatus ssl_status; | 3193 SSLStatus ssl_status; |
3194 DeserializeSecurityInfo(security_info, | 3194 DeserializeSecurityInfo(security_info, |
3195 &ssl_status.cert_id, | 3195 &ssl_status.cert_id, |
3196 &ssl_status.cert_status, | 3196 &ssl_status.cert_status, |
3197 &ssl_status.security_bits, | 3197 &ssl_status.security_bits, |
3198 &ssl_status.connection_status); | 3198 &ssl_status.connection_status); |
3199 return ssl_status; | 3199 return ssl_status; |
3200 } | 3200 } |
3201 | 3201 |
3202 const std::string& RenderViewImpl::GetAcceptLanguages() const { | 3202 const std::string& RenderViewImpl::GetAcceptLanguages() const { |
3203 return renderer_preferences_.accept_languages; | 3203 return renderer_preferences_.accept_languages; |
3204 } | 3204 } |
3205 | 3205 |
3206 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( | 3206 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( |
3207 WebFrame* frame, WebDataSource::ExtraData* extraData, | 3207 WebFrame* frame, WebDataSource::ExtraData* extraData, |
3208 const WebURLRequest& request, WebNavigationType type, | 3208 const WebURLRequest& request, WebNavigationType type, |
3209 WebNavigationPolicy default_policy, bool is_redirect) { | 3209 WebNavigationPolicy default_policy, bool is_redirect) { |
3210 if (request.url() != GURL(kSwappedOutURL) && | 3210 if (request.url() != GURL(kSwappedOutURL) && |
3211 GetContentClient()->renderer()->HandleNavigation(frame, request, type, | 3211 GetContentClient()->renderer()->HandleNavigation(frame, request, type, |
3212 default_policy, | 3212 default_policy, |
3213 is_redirect)) { | 3213 is_redirect)) { |
3214 return WebKit::WebNavigationPolicyIgnore; | 3214 return blink::WebNavigationPolicyIgnore; |
3215 } | 3215 } |
3216 | 3216 |
3217 Referrer referrer(GetReferrerFromRequest(frame, request)); | 3217 Referrer referrer(GetReferrerFromRequest(frame, request)); |
3218 | 3218 |
3219 if (is_swapped_out_) { | 3219 if (is_swapped_out_) { |
3220 if (request.url() != GURL(kSwappedOutURL)) { | 3220 if (request.url() != GURL(kSwappedOutURL)) { |
3221 // Targeted links may try to navigate a swapped out frame. Allow the | 3221 // Targeted links may try to navigate a swapped out frame. Allow the |
3222 // browser process to navigate the tab instead. Note that it is also | 3222 // browser process to navigate the tab instead. Note that it is also |
3223 // possible for non-targeted navigations (from this view) to arrive | 3223 // possible for non-targeted navigations (from this view) to arrive |
3224 // here just after we are swapped out. It's ok to send them to the | 3224 // here just after we are swapped out. It's ok to send them to the |
3225 // browser, as long as they're for the top level frame. | 3225 // browser, as long as they're for the top level frame. |
3226 // TODO(creis): Ensure this supports targeted form submissions when | 3226 // TODO(creis): Ensure this supports targeted form submissions when |
3227 // fixing http://crbug.com/101395. | 3227 // fixing http://crbug.com/101395. |
3228 if (frame->parent() == NULL) { | 3228 if (frame->parent() == NULL) { |
3229 OpenURL(frame, request.url(), referrer, default_policy); | 3229 OpenURL(frame, request.url(), referrer, default_policy); |
3230 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 3230 return blink::WebNavigationPolicyIgnore; // Suppress the load here. |
3231 } | 3231 } |
3232 | 3232 |
3233 // We should otherwise ignore in-process iframe navigations, if they | 3233 // We should otherwise ignore in-process iframe navigations, if they |
3234 // arrive just after we are swapped out. | 3234 // arrive just after we are swapped out. |
3235 return WebKit::WebNavigationPolicyIgnore; | 3235 return blink::WebNavigationPolicyIgnore; |
3236 } | 3236 } |
3237 | 3237 |
3238 // Allow kSwappedOutURL to complete. | 3238 // Allow kSwappedOutURL to complete. |
3239 return default_policy; | 3239 return default_policy; |
3240 } | 3240 } |
3241 | 3241 |
3242 // Webkit is asking whether to navigate to a new URL. | 3242 // Webkit is asking whether to navigate to a new URL. |
3243 // This is fine normally, except if we're showing UI from one security | 3243 // This is fine normally, except if we're showing UI from one security |
3244 // context and they're trying to navigate to a different context. | 3244 // context and they're trying to navigate to a different context. |
3245 const GURL& url = request.url(); | 3245 const GURL& url = request.url(); |
(...skipping 18 matching lines...) Expand all Loading... |
3264 GURL frame_url(origin_str.utf8().data()); | 3264 GURL frame_url(origin_str.utf8().data()); |
3265 // TODO(cevans): revisit whether this site check is still necessary once | 3265 // TODO(cevans): revisit whether this site check is still necessary once |
3266 // crbug.com/101395 is fixed. | 3266 // crbug.com/101395 is fixed. |
3267 bool same_domain_or_host = | 3267 bool same_domain_or_host = |
3268 net::registry_controlled_domains::SameDomainOrHost( | 3268 net::registry_controlled_domains::SameDomainOrHost( |
3269 frame_url, | 3269 frame_url, |
3270 url, | 3270 url, |
3271 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 3271 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
3272 if (!same_domain_or_host || frame_url.scheme() != url.scheme()) { | 3272 if (!same_domain_or_host || frame_url.scheme() != url.scheme()) { |
3273 OpenURL(frame, url, referrer, default_policy); | 3273 OpenURL(frame, url, referrer, default_policy); |
3274 return WebKit::WebNavigationPolicyIgnore; | 3274 return blink::WebNavigationPolicyIgnore; |
3275 } | 3275 } |
3276 } | 3276 } |
3277 | 3277 |
3278 // If the browser is interested, then give it a chance to look at the request. | 3278 // If the browser is interested, then give it a chance to look at the request. |
3279 if (is_content_initiated) { | 3279 if (is_content_initiated) { |
3280 bool is_form_post = ((type == WebKit::WebNavigationTypeFormSubmitted) || | 3280 bool is_form_post = ((type == blink::WebNavigationTypeFormSubmitted) || |
3281 (type == WebKit::WebNavigationTypeFormResubmitted)) && | 3281 (type == blink::WebNavigationTypeFormResubmitted)) && |
3282 EqualsASCII(request.httpMethod(), "POST"); | 3282 EqualsASCII(request.httpMethod(), "POST"); |
3283 bool browser_handles_request = | 3283 bool browser_handles_request = |
3284 renderer_preferences_.browser_handles_non_local_top_level_requests && | 3284 renderer_preferences_.browser_handles_non_local_top_level_requests && |
3285 IsNonLocalTopLevelNavigation(url, frame, type, is_form_post); | 3285 IsNonLocalTopLevelNavigation(url, frame, type, is_form_post); |
3286 if (!browser_handles_request) { | 3286 if (!browser_handles_request) { |
3287 browser_handles_request = | 3287 browser_handles_request = |
3288 renderer_preferences_.browser_handles_all_top_level_requests && | 3288 renderer_preferences_.browser_handles_all_top_level_requests && |
3289 IsTopLevelNavigation(frame); | 3289 IsTopLevelNavigation(frame); |
3290 } | 3290 } |
3291 | 3291 |
3292 if (browser_handles_request) { | 3292 if (browser_handles_request) { |
3293 // Reset these counters as the RenderView could be reused for the next | 3293 // Reset these counters as the RenderView could be reused for the next |
3294 // navigation. | 3294 // navigation. |
3295 page_id_ = -1; | 3295 page_id_ = -1; |
3296 last_page_id_sent_to_browser_ = -1; | 3296 last_page_id_sent_to_browser_ = -1; |
3297 OpenURL(frame, url, referrer, default_policy); | 3297 OpenURL(frame, url, referrer, default_policy); |
3298 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 3298 return blink::WebNavigationPolicyIgnore; // Suppress the load here. |
3299 } | 3299 } |
3300 } | 3300 } |
3301 | 3301 |
3302 // Use the frame's original request's URL rather than the document's URL for | 3302 // Use the frame's original request's URL rather than the document's URL for |
3303 // subsequent checks. For a popup, the document's URL may become the opener | 3303 // subsequent checks. For a popup, the document's URL may become the opener |
3304 // window's URL if the opener has called document.write(). | 3304 // window's URL if the opener has called document.write(). |
3305 // See http://crbug.com/93517. | 3305 // See http://crbug.com/93517. |
3306 GURL old_url(frame->dataSource()->request().url()); | 3306 GURL old_url(frame->dataSource()->request().url()); |
3307 | 3307 |
3308 // Detect when we're crossing a permission-based boundary (e.g. into or out of | 3308 // Detect when we're crossing a permission-based boundary (e.g. into or out of |
(...skipping 21 matching lines...) Expand all Loading... |
3330 // safe to leave within the renderer). | 3330 // safe to leave within the renderer). |
3331 // Lastly, access to file:// URLs from non-file:// URL pages must be | 3331 // Lastly, access to file:// URLs from non-file:// URL pages must be |
3332 // handled by the browser so that ordinary renderer processes don't get | 3332 // handled by the browser so that ordinary renderer processes don't get |
3333 // blessed with file permissions. | 3333 // blessed with file permissions. |
3334 int cumulative_bindings = RenderProcess::current()->GetEnabledBindings(); | 3334 int cumulative_bindings = RenderProcess::current()->GetEnabledBindings(); |
3335 bool is_initial_navigation = page_id_ == -1; | 3335 bool is_initial_navigation = page_id_ == -1; |
3336 bool should_fork = HasWebUIScheme(url) || HasWebUIScheme(old_url) || | 3336 bool should_fork = HasWebUIScheme(url) || HasWebUIScheme(old_url) || |
3337 (cumulative_bindings & BINDINGS_POLICY_WEB_UI) || | 3337 (cumulative_bindings & BINDINGS_POLICY_WEB_UI) || |
3338 url.SchemeIs(kViewSourceScheme) || | 3338 url.SchemeIs(kViewSourceScheme) || |
3339 (frame->isViewSourceModeEnabled() && | 3339 (frame->isViewSourceModeEnabled() && |
3340 type != WebKit::WebNavigationTypeReload); | 3340 type != blink::WebNavigationTypeReload); |
3341 | 3341 |
3342 if (!should_fork && url.SchemeIs(chrome::kFileScheme)) { | 3342 if (!should_fork && url.SchemeIs(chrome::kFileScheme)) { |
3343 // Fork non-file to file opens. Check the opener URL if this is the | 3343 // Fork non-file to file opens. Check the opener URL if this is the |
3344 // initial navigation in a newly opened window. | 3344 // initial navigation in a newly opened window. |
3345 GURL source_url(old_url); | 3345 GURL source_url(old_url); |
3346 if (is_initial_navigation && source_url.is_empty() && frame->opener()) | 3346 if (is_initial_navigation && source_url.is_empty() && frame->opener()) |
3347 source_url = frame->opener()->top()->document().url(); | 3347 source_url = frame->opener()->top()->document().url(); |
3348 DCHECK(!source_url.is_empty()); | 3348 DCHECK(!source_url.is_empty()); |
3349 should_fork = !source_url.SchemeIs(chrome::kFileScheme); | 3349 should_fork = !source_url.SchemeIs(chrome::kFileScheme); |
3350 } | 3350 } |
3351 | 3351 |
3352 if (!should_fork) { | 3352 if (!should_fork) { |
3353 // Give the embedder a chance. | 3353 // Give the embedder a chance. |
3354 should_fork = GetContentClient()->renderer()->ShouldFork( | 3354 should_fork = GetContentClient()->renderer()->ShouldFork( |
3355 frame, url, request.httpMethod().utf8(), is_initial_navigation, | 3355 frame, url, request.httpMethod().utf8(), is_initial_navigation, |
3356 is_redirect, &send_referrer); | 3356 is_redirect, &send_referrer); |
3357 } | 3357 } |
3358 | 3358 |
3359 if (should_fork) { | 3359 if (should_fork) { |
3360 OpenURL( | 3360 OpenURL( |
3361 frame, url, send_referrer ? referrer : Referrer(), default_policy); | 3361 frame, url, send_referrer ? referrer : Referrer(), default_policy); |
3362 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 3362 return blink::WebNavigationPolicyIgnore; // Suppress the load here. |
3363 } | 3363 } |
3364 } | 3364 } |
3365 | 3365 |
3366 // Detect when a page is "forking" a new tab that can be safely rendered in | 3366 // Detect when a page is "forking" a new tab that can be safely rendered in |
3367 // its own process. This is done by sites like Gmail that try to open links | 3367 // its own process. This is done by sites like Gmail that try to open links |
3368 // in new windows without script connections back to the original page. We | 3368 // in new windows without script connections back to the original page. We |
3369 // treat such cases as browser navigations (in which we will create a new | 3369 // treat such cases as browser navigations (in which we will create a new |
3370 // renderer for a cross-site navigation), rather than WebKit navigations. | 3370 // renderer for a cross-site navigation), rather than WebKit navigations. |
3371 // | 3371 // |
3372 // We use the following heuristic to decide whether to fork a new page in its | 3372 // We use the following heuristic to decide whether to fork a new page in its |
(...skipping 11 matching lines...) Expand all Loading... |
3384 historyBackListCount() < 1 && | 3384 historyBackListCount() < 1 && |
3385 historyForwardListCount() < 1 && | 3385 historyForwardListCount() < 1 && |
3386 // The parent page must have set the child's window.opener to null before | 3386 // The parent page must have set the child's window.opener to null before |
3387 // redirecting to the desired URL. | 3387 // redirecting to the desired URL. |
3388 frame->opener() == NULL && | 3388 frame->opener() == NULL && |
3389 // Must be a top-level frame. | 3389 // Must be a top-level frame. |
3390 frame->parent() == NULL && | 3390 frame->parent() == NULL && |
3391 // Must not have issued the request from this page. | 3391 // Must not have issued the request from this page. |
3392 is_content_initiated && | 3392 is_content_initiated && |
3393 // Must be targeted at the current tab. | 3393 // Must be targeted at the current tab. |
3394 default_policy == WebKit::WebNavigationPolicyCurrentTab && | 3394 default_policy == blink::WebNavigationPolicyCurrentTab && |
3395 // Must be a JavaScript navigation, which appears as "other". | 3395 // Must be a JavaScript navigation, which appears as "other". |
3396 type == WebKit::WebNavigationTypeOther; | 3396 type == blink::WebNavigationTypeOther; |
3397 | 3397 |
3398 if (is_fork) { | 3398 if (is_fork) { |
3399 // Open the URL via the browser, not via WebKit. | 3399 // Open the URL via the browser, not via WebKit. |
3400 OpenURL(frame, url, Referrer(), default_policy); | 3400 OpenURL(frame, url, Referrer(), default_policy); |
3401 return WebKit::WebNavigationPolicyIgnore; | 3401 return blink::WebNavigationPolicyIgnore; |
3402 } | 3402 } |
3403 | 3403 |
3404 return default_policy; | 3404 return default_policy; |
3405 } | 3405 } |
3406 | 3406 |
3407 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( | 3407 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( |
3408 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, | 3408 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, |
3409 WebNavigationPolicy default_policy, bool is_redirect) { | 3409 WebNavigationPolicy default_policy, bool is_redirect) { |
3410 return decidePolicyForNavigation(frame, | 3410 return decidePolicyForNavigation(frame, |
3411 frame->provisionalDataSource()->extraData(), | 3411 frame->provisionalDataSource()->extraData(), |
3412 request, type, default_policy, is_redirect); | 3412 request, type, default_policy, is_redirect); |
3413 } | 3413 } |
3414 | 3414 |
3415 void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, | 3415 void RenderViewImpl::willSendSubmitEvent(blink::WebFrame* frame, |
3416 const WebKit::WebFormElement& form) { | 3416 const blink::WebFormElement& form) { |
3417 FOR_EACH_OBSERVER( | 3417 FOR_EACH_OBSERVER( |
3418 RenderViewObserver, observers_, WillSendSubmitEvent(frame, form)); | 3418 RenderViewObserver, observers_, WillSendSubmitEvent(frame, form)); |
3419 } | 3419 } |
3420 | 3420 |
3421 void RenderViewImpl::willSubmitForm(WebFrame* frame, | 3421 void RenderViewImpl::willSubmitForm(WebFrame* frame, |
3422 const WebFormElement& form) { | 3422 const WebFormElement& form) { |
3423 FOR_EACH_OBSERVER( | 3423 FOR_EACH_OBSERVER( |
3424 RenderViewObserver, observers_, WillSubmitForm(frame, form)); | 3424 RenderViewObserver, observers_, WillSubmitForm(frame, form)); |
3425 } | 3425 } |
3426 | 3426 |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4147 void RenderViewImpl::didChangeScrollOffset(WebFrame* frame) { | 4147 void RenderViewImpl::didChangeScrollOffset(WebFrame* frame) { |
4148 StartNavStateSyncTimerIfNecessary(); | 4148 StartNavStateSyncTimerIfNecessary(); |
4149 | 4149 |
4150 if (webview()->mainFrame() == frame) | 4150 if (webview()->mainFrame() == frame) |
4151 UpdateScrollState(frame); | 4151 UpdateScrollState(frame); |
4152 | 4152 |
4153 FOR_EACH_OBSERVER( | 4153 FOR_EACH_OBSERVER( |
4154 RenderViewObserver, observers_, DidChangeScrollOffset(frame)); | 4154 RenderViewObserver, observers_, DidChangeScrollOffset(frame)); |
4155 } | 4155 } |
4156 | 4156 |
4157 void RenderViewImpl::willInsertBody(WebKit::WebFrame* frame) { | 4157 void RenderViewImpl::willInsertBody(blink::WebFrame* frame) { |
4158 NOTREACHED(); | 4158 NOTREACHED(); |
4159 } | 4159 } |
4160 | 4160 |
4161 void RenderViewImpl::didFirstVisuallyNonEmptyLayout(WebFrame* frame) { | 4161 void RenderViewImpl::didFirstVisuallyNonEmptyLayout(WebFrame* frame) { |
4162 if (frame != webview()->mainFrame()) | 4162 if (frame != webview()->mainFrame()) |
4163 return; | 4163 return; |
4164 | 4164 |
4165 InternalDocumentStateData* data = | 4165 InternalDocumentStateData* data = |
4166 InternalDocumentStateData::FromDataSource(frame->dataSource()); | 4166 InternalDocumentStateData::FromDataSource(frame->dataSource()); |
4167 data->set_did_first_visually_non_empty_layout(true); | 4167 data->set_did_first_visually_non_empty_layout(true); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4234 | 4234 |
4235 void RenderViewImpl::requestStorageQuota( | 4235 void RenderViewImpl::requestStorageQuota( |
4236 WebFrame* frame, | 4236 WebFrame* frame, |
4237 WebStorageQuotaType type, | 4237 WebStorageQuotaType type, |
4238 unsigned long long requested_size, | 4238 unsigned long long requested_size, |
4239 WebStorageQuotaCallbacks* callbacks) { | 4239 WebStorageQuotaCallbacks* callbacks) { |
4240 NOTREACHED(); | 4240 NOTREACHED(); |
4241 } | 4241 } |
4242 | 4242 |
4243 bool RenderViewImpl::willCheckAndDispatchMessageEvent( | 4243 bool RenderViewImpl::willCheckAndDispatchMessageEvent( |
4244 WebKit::WebFrame* sourceFrame, | 4244 blink::WebFrame* sourceFrame, |
4245 WebKit::WebFrame* targetFrame, | 4245 blink::WebFrame* targetFrame, |
4246 WebKit::WebSecurityOrigin target_origin, | 4246 blink::WebSecurityOrigin target_origin, |
4247 WebKit::WebDOMMessageEvent event) { | 4247 blink::WebDOMMessageEvent event) { |
4248 if (!is_swapped_out_) | 4248 if (!is_swapped_out_) |
4249 return false; | 4249 return false; |
4250 | 4250 |
4251 ViewMsg_PostMessage_Params params; | 4251 ViewMsg_PostMessage_Params params; |
4252 params.data = event.data().toString(); | 4252 params.data = event.data().toString(); |
4253 params.source_origin = event.origin(); | 4253 params.source_origin = event.origin(); |
4254 if (!target_origin.isNull()) | 4254 if (!target_origin.isNull()) |
4255 params.target_origin = target_origin.toString(); | 4255 params.target_origin = target_origin.toString(); |
4256 | 4256 |
4257 WebKit::WebMessagePortChannelArray channels = event.releaseChannels(); | 4257 blink::WebMessagePortChannelArray channels = event.releaseChannels(); |
4258 if (!channels.isEmpty()) { | 4258 if (!channels.isEmpty()) { |
4259 std::vector<int> message_port_ids(channels.size()); | 4259 std::vector<int> message_port_ids(channels.size()); |
4260 // Extract the port IDs from the channel array. | 4260 // Extract the port IDs from the channel array. |
4261 for (size_t i = 0; i < channels.size(); ++i) { | 4261 for (size_t i = 0; i < channels.size(); ++i) { |
4262 WebMessagePortChannelImpl* webchannel = | 4262 WebMessagePortChannelImpl* webchannel = |
4263 static_cast<WebMessagePortChannelImpl*>(channels[i]); | 4263 static_cast<WebMessagePortChannelImpl*>(channels[i]); |
4264 message_port_ids[i] = webchannel->message_port_id(); | 4264 message_port_ids[i] = webchannel->message_port_id(); |
4265 webchannel->QueueMessages(); | 4265 webchannel->QueueMessages(); |
4266 DCHECK_NE(message_port_ids[i], MSG_ROUTING_NONE); | 4266 DCHECK_NE(message_port_ids[i], MSG_ROUTING_NONE); |
4267 } | 4267 } |
(...skipping 13 matching lines...) Expand all Loading... |
4281 Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params)); | 4281 Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params)); |
4282 return true; | 4282 return true; |
4283 } | 4283 } |
4284 | 4284 |
4285 void RenderViewImpl::willOpenSocketStream( | 4285 void RenderViewImpl::willOpenSocketStream( |
4286 WebSocketStreamHandle* handle) { | 4286 WebSocketStreamHandle* handle) { |
4287 NOTREACHED(); | 4287 NOTREACHED(); |
4288 } | 4288 } |
4289 | 4289 |
4290 void RenderViewImpl::willStartUsingPeerConnectionHandler( | 4290 void RenderViewImpl::willStartUsingPeerConnectionHandler( |
4291 WebKit::WebFrame* frame, WebKit::WebRTCPeerConnectionHandler* handler) { | 4291 blink::WebFrame* frame, blink::WebRTCPeerConnectionHandler* handler) { |
4292 NOTREACHED(); | 4292 NOTREACHED(); |
4293 } | 4293 } |
4294 | 4294 |
4295 WebKit::WebString RenderViewImpl::acceptLanguages() { | 4295 blink::WebString RenderViewImpl::acceptLanguages() { |
4296 return WebString::fromUTF8(renderer_preferences_.accept_languages); | 4296 return WebString::fromUTF8(renderer_preferences_.accept_languages); |
4297 } | 4297 } |
4298 | 4298 |
4299 WebKit::WebString RenderViewImpl::userAgentOverride( | 4299 blink::WebString RenderViewImpl::userAgentOverride( |
4300 WebKit::WebFrame* frame, | 4300 blink::WebFrame* frame, |
4301 const WebKit::WebURL& url) { | 4301 const blink::WebURL& url) { |
4302 NOTREACHED(); | 4302 NOTREACHED(); |
4303 return WebKit::WebString(); | 4303 return blink::WebString(); |
4304 } | 4304 } |
4305 | 4305 |
4306 WebString RenderViewImpl::doNotTrackValue(WebFrame* frame) { | 4306 WebString RenderViewImpl::doNotTrackValue(WebFrame* frame) { |
4307 NOTREACHED(); | 4307 NOTREACHED(); |
4308 return WebKit::WebString(); | 4308 return blink::WebString(); |
4309 } | 4309 } |
4310 | 4310 |
4311 bool RenderViewImpl::allowWebGL(WebFrame* frame, bool default_value) { | 4311 bool RenderViewImpl::allowWebGL(WebFrame* frame, bool default_value) { |
4312 NOTREACHED(); | 4312 NOTREACHED(); |
4313 return false; | 4313 return false; |
4314 } | 4314 } |
4315 | 4315 |
4316 void RenderViewImpl::didLoseWebGLContext( | 4316 void RenderViewImpl::didLoseWebGLContext( |
4317 WebKit::WebFrame* frame, | 4317 blink::WebFrame* frame, |
4318 int arb_robustness_status_code) { | 4318 int arb_robustness_status_code) { |
4319 NOTREACHED(); | 4319 NOTREACHED(); |
4320 } | 4320 } |
4321 | 4321 |
4322 // WebKit::WebPageSerializerClient implementation ------------------------------ | 4322 // blink::WebPageSerializerClient implementation ------------------------------ |
4323 | 4323 |
4324 void RenderViewImpl::didSerializeDataForFrame( | 4324 void RenderViewImpl::didSerializeDataForFrame( |
4325 const WebURL& frame_url, | 4325 const WebURL& frame_url, |
4326 const WebCString& data, | 4326 const WebCString& data, |
4327 WebPageSerializerClient::PageSerializationStatus status) { | 4327 WebPageSerializerClient::PageSerializationStatus status) { |
4328 Send(new ViewHostMsg_SendSerializedHtmlData( | 4328 Send(new ViewHostMsg_SendSerializedHtmlData( |
4329 routing_id(), | 4329 routing_id(), |
4330 frame_url, | 4330 frame_url, |
4331 data.data(), | 4331 data.data(), |
4332 static_cast<int32>(status))); | 4332 static_cast<int32>(status))); |
(...skipping 18 matching lines...) Expand all Loading... |
4351 } | 4351 } |
4352 | 4352 |
4353 WebPreferences& RenderViewImpl::GetWebkitPreferences() { | 4353 WebPreferences& RenderViewImpl::GetWebkitPreferences() { |
4354 return webkit_preferences_; | 4354 return webkit_preferences_; |
4355 } | 4355 } |
4356 | 4356 |
4357 void RenderViewImpl::SetWebkitPreferences(const WebPreferences& preferences) { | 4357 void RenderViewImpl::SetWebkitPreferences(const WebPreferences& preferences) { |
4358 OnUpdateWebPreferences(preferences); | 4358 OnUpdateWebPreferences(preferences); |
4359 } | 4359 } |
4360 | 4360 |
4361 WebKit::WebView* RenderViewImpl::GetWebView() { | 4361 blink::WebView* RenderViewImpl::GetWebView() { |
4362 return webview(); | 4362 return webview(); |
4363 } | 4363 } |
4364 | 4364 |
4365 WebKit::WebNode RenderViewImpl::GetFocusedNode() const { | 4365 blink::WebNode RenderViewImpl::GetFocusedNode() const { |
4366 if (!webview()) | 4366 if (!webview()) |
4367 return WebNode(); | 4367 return WebNode(); |
4368 WebFrame* focused_frame = webview()->focusedFrame(); | 4368 WebFrame* focused_frame = webview()->focusedFrame(); |
4369 if (focused_frame) { | 4369 if (focused_frame) { |
4370 WebDocument doc = focused_frame->document(); | 4370 WebDocument doc = focused_frame->document(); |
4371 if (!doc.isNull()) | 4371 if (!doc.isNull()) |
4372 return doc.focusedNode(); | 4372 return doc.focusedNode(); |
4373 } | 4373 } |
4374 | 4374 |
4375 return WebNode(); | 4375 return WebNode(); |
4376 } | 4376 } |
4377 | 4377 |
4378 WebKit::WebNode RenderViewImpl::GetContextMenuNode() const { | 4378 blink::WebNode RenderViewImpl::GetContextMenuNode() const { |
4379 return context_menu_node_; | 4379 return context_menu_node_; |
4380 } | 4380 } |
4381 | 4381 |
4382 bool RenderViewImpl::IsEditableNode(const WebNode& node) const { | 4382 bool RenderViewImpl::IsEditableNode(const WebNode& node) const { |
4383 if (node.isNull()) | 4383 if (node.isNull()) |
4384 return false; | 4384 return false; |
4385 | 4385 |
4386 if (node.isContentEditable()) | 4386 if (node.isContentEditable()) |
4387 return true; | 4387 return true; |
4388 | 4388 |
4389 if (node.isElementNode()) { | 4389 if (node.isElementNode()) { |
4390 const WebElement& element = node.toConst<WebElement>(); | 4390 const WebElement& element = node.toConst<WebElement>(); |
4391 if (element.isTextFormControlElement()) | 4391 if (element.isTextFormControlElement()) |
4392 return true; | 4392 return true; |
4393 | 4393 |
4394 // Also return true if it has an ARIA role of 'textbox'. | 4394 // Also return true if it has an ARIA role of 'textbox'. |
4395 for (unsigned i = 0; i < element.attributeCount(); ++i) { | 4395 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
4396 if (LowerCaseEqualsASCII(element.attributeLocalName(i), "role")) { | 4396 if (LowerCaseEqualsASCII(element.attributeLocalName(i), "role")) { |
4397 if (LowerCaseEqualsASCII(element.attributeValue(i), "textbox")) | 4397 if (LowerCaseEqualsASCII(element.attributeValue(i), "textbox")) |
4398 return true; | 4398 return true; |
4399 break; | 4399 break; |
4400 } | 4400 } |
4401 } | 4401 } |
4402 } | 4402 } |
4403 | 4403 |
4404 return false; | 4404 return false; |
4405 } | 4405 } |
4406 | 4406 |
4407 WebKit::WebPlugin* RenderViewImpl::CreatePlugin( | 4407 blink::WebPlugin* RenderViewImpl::CreatePlugin( |
4408 WebKit::WebFrame* frame, | 4408 blink::WebFrame* frame, |
4409 const WebPluginInfo& info, | 4409 const WebPluginInfo& info, |
4410 const WebKit::WebPluginParams& params) { | 4410 const blink::WebPluginParams& params) { |
4411 #if defined(ENABLE_PLUGINS) | 4411 #if defined(ENABLE_PLUGINS) |
4412 bool pepper_plugin_was_registered = false; | 4412 bool pepper_plugin_was_registered = false; |
4413 scoped_refptr<PluginModule> pepper_module(PluginModule::Create( | 4413 scoped_refptr<PluginModule> pepper_module(PluginModule::Create( |
4414 this, info, &pepper_plugin_was_registered)); | 4414 this, info, &pepper_plugin_was_registered)); |
4415 if (pepper_plugin_was_registered) { | 4415 if (pepper_plugin_was_registered) { |
4416 if (pepper_module.get()) | 4416 if (pepper_module.get()) |
4417 return new PepperWebPluginImpl(pepper_module.get(), params, AsWeakPtr()); | 4417 return new PepperWebPluginImpl(pepper_module.get(), params, AsWeakPtr()); |
4418 } | 4418 } |
4419 | 4419 |
4420 return new WebPluginImpl(frame, params, info.path, AsWeakPtr()); | 4420 return new WebPluginImpl(frame, params, info.path, AsWeakPtr()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4474 our_params.custom_context.request_id = pending_context_menus_.Add(client); | 4474 our_params.custom_context.request_id = pending_context_menus_.Add(client); |
4475 Send(new ViewHostMsg_ContextMenu(routing_id_, our_params)); | 4475 Send(new ViewHostMsg_ContextMenu(routing_id_, our_params)); |
4476 return our_params.custom_context.request_id; | 4476 return our_params.custom_context.request_id; |
4477 } | 4477 } |
4478 | 4478 |
4479 void RenderViewImpl::CancelContextMenu(int request_id) { | 4479 void RenderViewImpl::CancelContextMenu(int request_id) { |
4480 DCHECK(pending_context_menus_.Lookup(request_id)); | 4480 DCHECK(pending_context_menus_.Lookup(request_id)); |
4481 pending_context_menus_.Remove(request_id); | 4481 pending_context_menus_.Remove(request_id); |
4482 } | 4482 } |
4483 | 4483 |
4484 WebKit::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const { | 4484 blink::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const { |
4485 return visibilityState(); | 4485 return visibilityState(); |
4486 } | 4486 } |
4487 | 4487 |
4488 void RenderViewImpl::RunModalAlertDialog(WebKit::WebFrame* frame, | 4488 void RenderViewImpl::RunModalAlertDialog(blink::WebFrame* frame, |
4489 const WebKit::WebString& message) { | 4489 const blink::WebString& message) { |
4490 return runModalAlertDialog(frame, message); | 4490 return runModalAlertDialog(frame, message); |
4491 } | 4491 } |
4492 | 4492 |
4493 void RenderViewImpl::LoadURLExternally( | 4493 void RenderViewImpl::LoadURLExternally( |
4494 WebKit::WebFrame* frame, | 4494 blink::WebFrame* frame, |
4495 const WebKit::WebURLRequest& request, | 4495 const blink::WebURLRequest& request, |
4496 WebKit::WebNavigationPolicy policy) { | 4496 blink::WebNavigationPolicy policy) { |
4497 main_render_frame_->loadURLExternally(frame, request, policy); | 4497 main_render_frame_->loadURLExternally(frame, request, policy); |
4498 } | 4498 } |
4499 | 4499 |
4500 void RenderViewImpl::DidStartLoading() { | 4500 void RenderViewImpl::DidStartLoading() { |
4501 didStartLoading(); | 4501 didStartLoading(); |
4502 } | 4502 } |
4503 | 4503 |
4504 void RenderViewImpl::DidStopLoading() { | 4504 void RenderViewImpl::DidStopLoading() { |
4505 didStopLoading(); | 4505 didStopLoading(); |
4506 } | 4506 } |
4507 | 4507 |
4508 void RenderViewImpl::DidPlay(WebKit::WebMediaPlayer* player) { | 4508 void RenderViewImpl::DidPlay(blink::WebMediaPlayer* player) { |
4509 Send(new ViewHostMsg_MediaNotification(routing_id_, | 4509 Send(new ViewHostMsg_MediaNotification(routing_id_, |
4510 reinterpret_cast<int64>(player), | 4510 reinterpret_cast<int64>(player), |
4511 player->hasVideo(), | 4511 player->hasVideo(), |
4512 player->hasAudio(), | 4512 player->hasAudio(), |
4513 true)); | 4513 true)); |
4514 } | 4514 } |
4515 | 4515 |
4516 void RenderViewImpl::DidPause(WebKit::WebMediaPlayer* player) { | 4516 void RenderViewImpl::DidPause(blink::WebMediaPlayer* player) { |
4517 Send(new ViewHostMsg_MediaNotification(routing_id_, | 4517 Send(new ViewHostMsg_MediaNotification(routing_id_, |
4518 reinterpret_cast<int64>(player), | 4518 reinterpret_cast<int64>(player), |
4519 player->hasVideo(), | 4519 player->hasVideo(), |
4520 player->hasAudio(), | 4520 player->hasAudio(), |
4521 false)); | 4521 false)); |
4522 } | 4522 } |
4523 | 4523 |
4524 void RenderViewImpl::PlayerGone(WebKit::WebMediaPlayer* player) { | 4524 void RenderViewImpl::PlayerGone(blink::WebMediaPlayer* player) { |
4525 DidPause(player); | 4525 DidPause(player); |
4526 } | 4526 } |
4527 | 4527 |
4528 void RenderViewImpl::SyncNavigationState() { | 4528 void RenderViewImpl::SyncNavigationState() { |
4529 if (!webview()) | 4529 if (!webview()) |
4530 return; | 4530 return; |
4531 | 4531 |
4532 const WebHistoryItem& item = webview()->mainFrame()->currentHistoryItem(); | 4532 const WebHistoryItem& item = webview()->mainFrame()->currentHistoryItem(); |
4533 SendUpdateState(item); | 4533 SendUpdateState(item); |
4534 } | 4534 } |
(...skipping 13 matching lines...) Expand all Loading... |
4548 // TODO(kinaba): cut as needed. | 4548 // TODO(kinaba): cut as needed. |
4549 } else | 4549 } else |
4550 #endif | 4550 #endif |
4551 { | 4551 { |
4552 size_t location, length; | 4552 size_t location, length; |
4553 if (!webview()->caretOrSelectionRange(&location, &length)) | 4553 if (!webview()->caretOrSelectionRange(&location, &length)) |
4554 return; | 4554 return; |
4555 | 4555 |
4556 range = gfx::Range(location, location + length); | 4556 range = gfx::Range(location, location + length); |
4557 | 4557 |
4558 if (webview()->textInputInfo().type != WebKit::WebTextInputTypeNone) { | 4558 if (webview()->textInputInfo().type != blink::WebTextInputTypeNone) { |
4559 // If current focused element is editable, we will send 100 more chars | 4559 // If current focused element is editable, we will send 100 more chars |
4560 // before and after selection. It is for input method surrounding text | 4560 // before and after selection. It is for input method surrounding text |
4561 // feature. | 4561 // feature. |
4562 if (location > kExtraCharsBeforeAndAfterSelection) | 4562 if (location > kExtraCharsBeforeAndAfterSelection) |
4563 offset = location - kExtraCharsBeforeAndAfterSelection; | 4563 offset = location - kExtraCharsBeforeAndAfterSelection; |
4564 else | 4564 else |
4565 offset = 0; | 4565 offset = 0; |
4566 length = location + length - offset + kExtraCharsBeforeAndAfterSelection; | 4566 length = location + length - offset + kExtraCharsBeforeAndAfterSelection; |
4567 WebRange webrange = WebRange::fromDocumentRange(frame, offset, length); | 4567 WebRange webrange = WebRange::fromDocumentRange(frame, offset, length); |
4568 if (!webrange.isNull()) | 4568 if (!webrange.isNull()) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4644 NOTREACHED() << "unknown ErrorPageType"; | 4644 NOTREACHED() << "unknown ErrorPageType"; |
4645 } | 4645 } |
4646 | 4646 |
4647 // OK, build the final url to return. | 4647 // OK, build the final url to return. |
4648 GURL::Replacements link_doctor_params; | 4648 GURL::Replacements link_doctor_params; |
4649 link_doctor_params.SetQueryStr(params); | 4649 link_doctor_params.SetQueryStr(params); |
4650 GURL url = alternate_error_page_url_.ReplaceComponents(link_doctor_params); | 4650 GURL url = alternate_error_page_url_.ReplaceComponents(link_doctor_params); |
4651 return url; | 4651 return url; |
4652 } | 4652 } |
4653 | 4653 |
4654 GURL RenderViewImpl::GetLoadingUrl(WebKit::WebFrame* frame) const { | 4654 GURL RenderViewImpl::GetLoadingUrl(blink::WebFrame* frame) const { |
4655 WebDataSource* ds = frame->dataSource(); | 4655 WebDataSource* ds = frame->dataSource(); |
4656 if (ds->hasUnreachableURL()) | 4656 if (ds->hasUnreachableURL()) |
4657 return ds->unreachableURL(); | 4657 return ds->unreachableURL(); |
4658 | 4658 |
4659 const WebURLRequest& request = ds->request(); | 4659 const WebURLRequest& request = ds->request(); |
4660 return request.url(); | 4660 return request.url(); |
4661 } | 4661 } |
4662 | 4662 |
4663 WebKit::WebPlugin* RenderViewImpl::GetWebPluginFromPluginDocument() { | 4663 blink::WebPlugin* RenderViewImpl::GetWebPluginFromPluginDocument() { |
4664 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); | 4664 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); |
4665 } | 4665 } |
4666 | 4666 |
4667 void RenderViewImpl::OnFind(int request_id, | 4667 void RenderViewImpl::OnFind(int request_id, |
4668 const string16& search_text, | 4668 const string16& search_text, |
4669 const WebFindOptions& options) { | 4669 const WebFindOptions& options) { |
4670 WebFrame* main_frame = webview()->mainFrame(); | 4670 WebFrame* main_frame = webview()->mainFrame(); |
4671 | 4671 |
4672 // Check if the plugin still exists in the document. | 4672 // Check if the plugin still exists in the document. |
4673 if (main_frame->document().isPluginDocument() && | 4673 if (main_frame->document().isPluginDocument() && |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4989 // Find the source frame if it exists. | 4989 // Find the source frame if it exists. |
4990 WebFrame* source_frame = NULL; | 4990 WebFrame* source_frame = NULL; |
4991 if (params.source_routing_id != MSG_ROUTING_NONE) { | 4991 if (params.source_routing_id != MSG_ROUTING_NONE) { |
4992 RenderViewImpl* source_view = FromRoutingID(params.source_routing_id); | 4992 RenderViewImpl* source_view = FromRoutingID(params.source_routing_id); |
4993 if (source_view) | 4993 if (source_view) |
4994 source_frame = source_view->webview()->mainFrame(); | 4994 source_frame = source_view->webview()->mainFrame(); |
4995 } | 4995 } |
4996 | 4996 |
4997 // If the message contained MessagePorts, create the corresponding endpoints. | 4997 // If the message contained MessagePorts, create the corresponding endpoints. |
4998 DCHECK_EQ(params.message_port_ids.size(), params.new_routing_ids.size()); | 4998 DCHECK_EQ(params.message_port_ids.size(), params.new_routing_ids.size()); |
4999 WebKit::WebMessagePortChannelArray channels(params.message_port_ids.size()); | 4999 blink::WebMessagePortChannelArray channels(params.message_port_ids.size()); |
5000 for (size_t i = 0; | 5000 for (size_t i = 0; |
5001 i < params.message_port_ids.size() && i < params.new_routing_ids.size(); | 5001 i < params.message_port_ids.size() && i < params.new_routing_ids.size(); |
5002 ++i) { | 5002 ++i) { |
5003 channels[i] = | 5003 channels[i] = |
5004 new WebMessagePortChannelImpl(params.new_routing_ids[i], | 5004 new WebMessagePortChannelImpl(params.new_routing_ids[i], |
5005 params.message_port_ids[i], | 5005 params.message_port_ids[i], |
5006 base::MessageLoopProxy::current().get()); | 5006 base::MessageLoopProxy::current().get()); |
5007 } | 5007 } |
5008 | 5008 |
5009 // Create an event with the message. The final parameter to initMessageEvent | 5009 // Create an event with the message. The final parameter to initMessageEvent |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5223 } | 5223 } |
5224 | 5224 |
5225 void RenderViewImpl::OnSetRendererPrefs( | 5225 void RenderViewImpl::OnSetRendererPrefs( |
5226 const RendererPreferences& renderer_prefs) { | 5226 const RendererPreferences& renderer_prefs) { |
5227 double old_zoom_level = renderer_preferences_.default_zoom_level; | 5227 double old_zoom_level = renderer_preferences_.default_zoom_level; |
5228 renderer_preferences_ = renderer_prefs; | 5228 renderer_preferences_ = renderer_prefs; |
5229 UpdateFontRenderingFromRendererPrefs(); | 5229 UpdateFontRenderingFromRendererPrefs(); |
5230 | 5230 |
5231 #if defined(USE_DEFAULT_RENDER_THEME) || defined(TOOLKIT_GTK) | 5231 #if defined(USE_DEFAULT_RENDER_THEME) || defined(TOOLKIT_GTK) |
5232 if (renderer_prefs.use_custom_colors) { | 5232 if (renderer_prefs.use_custom_colors) { |
5233 WebColorName name = WebKit::WebColorWebkitFocusRingColor; | 5233 WebColorName name = blink::WebColorWebkitFocusRingColor; |
5234 WebKit::setNamedColors(&name, &renderer_prefs.focus_ring_color, 1); | 5234 blink::setNamedColors(&name, &renderer_prefs.focus_ring_color, 1); |
5235 WebKit::setCaretBlinkInterval(renderer_prefs.caret_blink_interval); | 5235 blink::setCaretBlinkInterval(renderer_prefs.caret_blink_interval); |
5236 #if defined(TOOLKIT_GTK) | 5236 #if defined(TOOLKIT_GTK) |
5237 ui::NativeTheme::instance()->SetScrollbarColors( | 5237 ui::NativeTheme::instance()->SetScrollbarColors( |
5238 renderer_prefs.thumb_inactive_color, | 5238 renderer_prefs.thumb_inactive_color, |
5239 renderer_prefs.thumb_active_color, | 5239 renderer_prefs.thumb_active_color, |
5240 renderer_prefs.track_color); | 5240 renderer_prefs.track_color); |
5241 #endif // defined(TOOLKIT_GTK) | 5241 #endif // defined(TOOLKIT_GTK) |
5242 | 5242 |
5243 if (webview()) { | 5243 if (webview()) { |
5244 webview()->setSelectionColors( | 5244 webview()->setSelectionColors( |
5245 renderer_prefs.active_selection_bg_color, | 5245 renderer_prefs.active_selection_bg_color, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5285 const WebPluginAction& action) { | 5285 const WebPluginAction& action) { |
5286 if (webview()) | 5286 if (webview()) |
5287 webview()->performPluginAction(action, location); | 5287 webview()->performPluginAction(action, location); |
5288 } | 5288 } |
5289 | 5289 |
5290 void RenderViewImpl::OnGetAllSavableResourceLinksForCurrentPage( | 5290 void RenderViewImpl::OnGetAllSavableResourceLinksForCurrentPage( |
5291 const GURL& page_url) { | 5291 const GURL& page_url) { |
5292 // Prepare list to storage all savable resource links. | 5292 // Prepare list to storage all savable resource links. |
5293 std::vector<GURL> resources_list; | 5293 std::vector<GURL> resources_list; |
5294 std::vector<GURL> referrer_urls_list; | 5294 std::vector<GURL> referrer_urls_list; |
5295 std::vector<WebKit::WebReferrerPolicy> referrer_policies_list; | 5295 std::vector<blink::WebReferrerPolicy> referrer_policies_list; |
5296 std::vector<GURL> frames_list; | 5296 std::vector<GURL> frames_list; |
5297 SavableResourcesResult result(&resources_list, | 5297 SavableResourcesResult result(&resources_list, |
5298 &referrer_urls_list, | 5298 &referrer_urls_list, |
5299 &referrer_policies_list, | 5299 &referrer_policies_list, |
5300 &frames_list); | 5300 &frames_list); |
5301 | 5301 |
5302 // webkit/ doesn't know about Referrer. | 5302 // webkit/ doesn't know about Referrer. |
5303 if (!GetAllSavableResourceLinksForCurrentPage( | 5303 if (!GetAllSavableResourceLinksForCurrentPage( |
5304 webview(), | 5304 webview(), |
5305 page_url, | 5305 page_url, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5382 OnStop(); | 5382 OnStop(); |
5383 | 5383 |
5384 // Replace the page with a blank dummy URL. The unload handler will not be | 5384 // Replace the page with a blank dummy URL. The unload handler will not be |
5385 // run a second time, thanks to a check in FrameLoader::stopLoading. | 5385 // run a second time, thanks to a check in FrameLoader::stopLoading. |
5386 // TODO(creis): Need to add a better way to do this that avoids running the | 5386 // TODO(creis): Need to add a better way to do this that avoids running the |
5387 // beforeunload handler. For now, we just run it a second time silently. | 5387 // beforeunload handler. For now, we just run it a second time silently. |
5388 NavigateToSwappedOutURL(webview()->mainFrame()); | 5388 NavigateToSwappedOutURL(webview()->mainFrame()); |
5389 | 5389 |
5390 // Let WebKit know that this view is hidden so it can drop resources and | 5390 // Let WebKit know that this view is hidden so it can drop resources and |
5391 // stop compositing. | 5391 // stop compositing. |
5392 webview()->setVisibilityState(WebKit::WebPageVisibilityStateHidden, false); | 5392 webview()->setVisibilityState(blink::WebPageVisibilityStateHidden, false); |
5393 } | 5393 } |
5394 | 5394 |
5395 // It is now safe to show modal dialogs again. | 5395 // It is now safe to show modal dialogs again. |
5396 suppress_dialogs_until_swap_out_ = false; | 5396 suppress_dialogs_until_swap_out_ = false; |
5397 | 5397 |
5398 Send(new ViewHostMsg_SwapOut_ACK(routing_id_)); | 5398 Send(new ViewHostMsg_SwapOut_ACK(routing_id_)); |
5399 } | 5399 } |
5400 | 5400 |
5401 void RenderViewImpl::NavigateToSwappedOutURL(WebKit::WebFrame* frame) { | 5401 void RenderViewImpl::NavigateToSwappedOutURL(blink::WebFrame* frame) { |
5402 // We use loadRequest instead of loadHTMLString because the former commits | 5402 // We use loadRequest instead of loadHTMLString because the former commits |
5403 // synchronously. Otherwise a new navigation can interrupt the navigation | 5403 // synchronously. Otherwise a new navigation can interrupt the navigation |
5404 // to kSwappedOutURL. If that happens to be to the page we had been | 5404 // to kSwappedOutURL. If that happens to be to the page we had been |
5405 // showing, then WebKit will never send a commit and we'll be left spinning. | 5405 // showing, then WebKit will never send a commit and we'll be left spinning. |
5406 CHECK(is_swapped_out_); | 5406 CHECK(is_swapped_out_); |
5407 GURL swappedOutURL(kSwappedOutURL); | 5407 GURL swappedOutURL(kSwappedOutURL); |
5408 WebURLRequest request(swappedOutURL); | 5408 WebURLRequest request(swappedOutURL); |
5409 frame->loadRequest(request); | 5409 frame->loadRequest(request); |
5410 } | 5410 } |
5411 | 5411 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5701 WebView* doomed = webview(); | 5701 WebView* doomed = webview(); |
5702 RenderWidget::Close(); | 5702 RenderWidget::Close(); |
5703 g_view_map.Get().erase(doomed); | 5703 g_view_map.Get().erase(doomed); |
5704 g_routing_id_view_map.Get().erase(routing_id_); | 5704 g_routing_id_view_map.Get().erase(routing_id_); |
5705 } | 5705 } |
5706 | 5706 |
5707 void RenderViewImpl::DidHandleKeyEvent() { | 5707 void RenderViewImpl::DidHandleKeyEvent() { |
5708 ClearEditCommands(); | 5708 ClearEditCommands(); |
5709 } | 5709 } |
5710 | 5710 |
5711 bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 5711 bool RenderViewImpl::WillHandleMouseEvent(const blink::WebMouseEvent& event) { |
5712 context_menu_source_type_ = ui::MENU_SOURCE_MOUSE; | 5712 context_menu_source_type_ = ui::MENU_SOURCE_MOUSE; |
5713 possible_drag_event_info_.event_source = | 5713 possible_drag_event_info_.event_source = |
5714 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; | 5714 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; |
5715 possible_drag_event_info_.event_location = | 5715 possible_drag_event_info_.event_location = |
5716 gfx::Point(event.globalX, event.globalY); | 5716 gfx::Point(event.globalX, event.globalY); |
5717 | 5717 |
5718 #if defined(ENABLE_PLUGINS) | 5718 #if defined(ENABLE_PLUGINS) |
5719 // This method is called for every mouse event that the render view receives. | 5719 // This method is called for every mouse event that the render view receives. |
5720 // And then the mouse event is forwarded to WebKit, which dispatches it to the | 5720 // And then the mouse event is forwarded to WebKit, which dispatches it to the |
5721 // event target. Potentially a Pepper plugin will receive the event. | 5721 // event target. Potentially a Pepper plugin will receive the event. |
5722 // In order to tell whether a plugin gets the last mouse event and which it | 5722 // In order to tell whether a plugin gets the last mouse event and which it |
5723 // is, we set |pepper_last_mouse_event_target_| to NULL here. If a plugin gets | 5723 // is, we set |pepper_last_mouse_event_target_| to NULL here. If a plugin gets |
5724 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 5724 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
5725 // |pepper_last_mouse_event_target_|. | 5725 // |pepper_last_mouse_event_target_|. |
5726 pepper_last_mouse_event_target_ = NULL; | 5726 pepper_last_mouse_event_target_ = NULL; |
5727 #endif | 5727 #endif |
5728 | 5728 |
5729 // If the mouse is locked, only the current owner of the mouse lock can | 5729 // If the mouse is locked, only the current owner of the mouse lock can |
5730 // process mouse events. | 5730 // process mouse events. |
5731 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); | 5731 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); |
5732 } | 5732 } |
5733 | 5733 |
5734 bool RenderViewImpl::WillHandleKeyEvent(const WebKit::WebKeyboardEvent& event) { | 5734 bool RenderViewImpl::WillHandleKeyEvent(const blink::WebKeyboardEvent& event) { |
5735 context_menu_source_type_ = ui::MENU_SOURCE_KEYBOARD; | 5735 context_menu_source_type_ = ui::MENU_SOURCE_KEYBOARD; |
5736 return false; | 5736 return false; |
5737 } | 5737 } |
5738 | 5738 |
5739 bool RenderViewImpl::WillHandleGestureEvent( | 5739 bool RenderViewImpl::WillHandleGestureEvent( |
5740 const WebKit::WebGestureEvent& event) { | 5740 const blink::WebGestureEvent& event) { |
5741 context_menu_source_type_ = ui::MENU_SOURCE_TOUCH; | 5741 context_menu_source_type_ = ui::MENU_SOURCE_TOUCH; |
5742 possible_drag_event_info_.event_source = | 5742 possible_drag_event_info_.event_source = |
5743 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; | 5743 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; |
5744 possible_drag_event_info_.event_location = | 5744 possible_drag_event_info_.event_location = |
5745 gfx::Point(event.globalX, event.globalY); | 5745 gfx::Point(event.globalX, event.globalY); |
5746 return false; | 5746 return false; |
5747 } | 5747 } |
5748 | 5748 |
5749 void RenderViewImpl::DidHandleMouseEvent(const WebMouseEvent& event) { | 5749 void RenderViewImpl::DidHandleMouseEvent(const WebMouseEvent& event) { |
5750 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleMouseEvent(event)); | 5750 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleMouseEvent(event)); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5851 i != active_pepper_instances_.end(); ++i) | 5851 i != active_pepper_instances_.end(); ++i) |
5852 (*i)->SetContentAreaFocus(enable); | 5852 (*i)->SetContentAreaFocus(enable); |
5853 #endif | 5853 #endif |
5854 // Notify all BrowserPlugins of the RenderView's focus state. | 5854 // Notify all BrowserPlugins of the RenderView's focus state. |
5855 if (browser_plugin_manager_.get()) | 5855 if (browser_plugin_manager_.get()) |
5856 browser_plugin_manager_->UpdateFocusState(); | 5856 browser_plugin_manager_->UpdateFocusState(); |
5857 } | 5857 } |
5858 | 5858 |
5859 void RenderViewImpl::OnImeSetComposition( | 5859 void RenderViewImpl::OnImeSetComposition( |
5860 const string16& text, | 5860 const string16& text, |
5861 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 5861 const std::vector<blink::WebCompositionUnderline>& underlines, |
5862 int selection_start, | 5862 int selection_start, |
5863 int selection_end) { | 5863 int selection_end) { |
5864 #if defined(ENABLE_PLUGINS) | 5864 #if defined(ENABLE_PLUGINS) |
5865 if (focused_pepper_plugin_) { | 5865 if (focused_pepper_plugin_) { |
5866 // When a PPAPI plugin has focus, we bypass WebKit. | 5866 // When a PPAPI plugin has focus, we bypass WebKit. |
5867 if (!IsPepperAcceptingCompositionEvents()) { | 5867 if (!IsPepperAcceptingCompositionEvents()) { |
5868 pepper_composition_text_ = text; | 5868 pepper_composition_text_ = text; |
5869 } else { | 5869 } else { |
5870 // TODO(kinaba) currently all composition events are sent directly to | 5870 // TODO(kinaba) currently all composition events are sent directly to |
5871 // plugins. Use DOM event mechanism after WebKit is made aware about | 5871 // plugins. Use DOM event mechanism after WebKit is made aware about |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5935 | 5935 |
5936 // last_text is empty only when both text and pepper_composition_text_ is. | 5936 // last_text is empty only when both text and pepper_composition_text_ is. |
5937 // Ignore it. | 5937 // Ignore it. |
5938 if (last_text.empty()) | 5938 if (last_text.empty()) |
5939 return; | 5939 return; |
5940 | 5940 |
5941 if (!IsPepperAcceptingCompositionEvents()) { | 5941 if (!IsPepperAcceptingCompositionEvents()) { |
5942 base::i18n::UTF16CharIterator iterator(&last_text); | 5942 base::i18n::UTF16CharIterator iterator(&last_text); |
5943 int32 i = 0; | 5943 int32 i = 0; |
5944 while (iterator.Advance()) { | 5944 while (iterator.Advance()) { |
5945 WebKit::WebKeyboardEvent char_event; | 5945 blink::WebKeyboardEvent char_event; |
5946 char_event.type = WebKit::WebInputEvent::Char; | 5946 char_event.type = blink::WebInputEvent::Char; |
5947 char_event.timeStampSeconds = base::Time::Now().ToDoubleT(); | 5947 char_event.timeStampSeconds = base::Time::Now().ToDoubleT(); |
5948 char_event.modifiers = 0; | 5948 char_event.modifiers = 0; |
5949 char_event.windowsKeyCode = last_text[i]; | 5949 char_event.windowsKeyCode = last_text[i]; |
5950 char_event.nativeKeyCode = last_text[i]; | 5950 char_event.nativeKeyCode = last_text[i]; |
5951 | 5951 |
5952 const int32 char_start = i; | 5952 const int32 char_start = i; |
5953 for (; i < iterator.array_pos(); ++i) { | 5953 for (; i < iterator.array_pos(); ++i) { |
5954 char_event.text[i - char_start] = last_text[i]; | 5954 char_event.text[i - char_start] = last_text[i]; |
5955 char_event.unmodifiedText[i - char_start] = last_text[i]; | 5955 char_event.unmodifiedText[i - char_start] = last_text[i]; |
5956 } | 5956 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6061 | 6061 |
6062 if (!webview()) | 6062 if (!webview()) |
6063 return; | 6063 return; |
6064 size_t start_offset = 0; | 6064 size_t start_offset = 0; |
6065 size_t character_count = 0; | 6065 size_t character_count = 0; |
6066 if (!webview()->compositionRange(&start_offset, &character_count)) | 6066 if (!webview()->compositionRange(&start_offset, &character_count)) |
6067 return; | 6067 return; |
6068 if (character_count == 0) | 6068 if (character_count == 0) |
6069 return; | 6069 return; |
6070 | 6070 |
6071 WebKit::WebFrame* frame = webview()->focusedFrame(); | 6071 blink::WebFrame* frame = webview()->focusedFrame(); |
6072 if (!frame) | 6072 if (!frame) |
6073 return; | 6073 return; |
6074 | 6074 |
6075 bounds->reserve(character_count); | 6075 bounds->reserve(character_count); |
6076 WebKit::WebRect webrect; | 6076 blink::WebRect webrect; |
6077 for (size_t i = 0; i < character_count; ++i) { | 6077 for (size_t i = 0; i < character_count; ++i) { |
6078 if (!frame->firstRectForCharacterRange(start_offset + i, 1, webrect)) { | 6078 if (!frame->firstRectForCharacterRange(start_offset + i, 1, webrect)) { |
6079 DLOG(ERROR) << "Could not retrieve character rectangle at " << i; | 6079 DLOG(ERROR) << "Could not retrieve character rectangle at " << i; |
6080 bounds->clear(); | 6080 bounds->clear(); |
6081 return; | 6081 return; |
6082 } | 6082 } |
6083 bounds->push_back(webrect); | 6083 bounds->push_back(webrect); |
6084 } | 6084 } |
6085 } | 6085 } |
6086 | 6086 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6165 | 6165 |
6166 file_chooser_completions_.push_back(linked_ptr<PendingFileChooser>( | 6166 file_chooser_completions_.push_back(linked_ptr<PendingFileChooser>( |
6167 new PendingFileChooser(params, completion))); | 6167 new PendingFileChooser(params, completion))); |
6168 if (file_chooser_completions_.size() == 1) { | 6168 if (file_chooser_completions_.size() == 1) { |
6169 // Actually show the browse dialog when this is the first request. | 6169 // Actually show the browse dialog when this is the first request. |
6170 Send(new ViewHostMsg_RunFileChooser(routing_id_, params)); | 6170 Send(new ViewHostMsg_RunFileChooser(routing_id_, params)); |
6171 } | 6171 } |
6172 return true; | 6172 return true; |
6173 } | 6173 } |
6174 | 6174 |
6175 WebKit::WebGeolocationClient* RenderViewImpl::geolocationClient() { | 6175 blink::WebGeolocationClient* RenderViewImpl::geolocationClient() { |
6176 if (!geolocation_dispatcher_) | 6176 if (!geolocation_dispatcher_) |
6177 geolocation_dispatcher_ = new GeolocationDispatcher(this); | 6177 geolocation_dispatcher_ = new GeolocationDispatcher(this); |
6178 return geolocation_dispatcher_; | 6178 return geolocation_dispatcher_; |
6179 } | 6179 } |
6180 | 6180 |
6181 WebKit::WebSpeechInputController* RenderViewImpl::speechInputController( | 6181 blink::WebSpeechInputController* RenderViewImpl::speechInputController( |
6182 WebKit::WebSpeechInputListener* listener) { | 6182 blink::WebSpeechInputListener* listener) { |
6183 #if defined(ENABLE_INPUT_SPEECH) | 6183 #if defined(ENABLE_INPUT_SPEECH) |
6184 if (!input_tag_speech_dispatcher_) | 6184 if (!input_tag_speech_dispatcher_) |
6185 input_tag_speech_dispatcher_ = | 6185 input_tag_speech_dispatcher_ = |
6186 new InputTagSpeechDispatcher(this, listener); | 6186 new InputTagSpeechDispatcher(this, listener); |
6187 #endif | 6187 #endif |
6188 return input_tag_speech_dispatcher_; | 6188 return input_tag_speech_dispatcher_; |
6189 } | 6189 } |
6190 | 6190 |
6191 WebKit::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { | 6191 blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { |
6192 if (!speech_recognition_dispatcher_) | 6192 if (!speech_recognition_dispatcher_) |
6193 speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); | 6193 speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); |
6194 return speech_recognition_dispatcher_; | 6194 return speech_recognition_dispatcher_; |
6195 } | 6195 } |
6196 | 6196 |
6197 void RenderViewImpl::zoomLimitsChanged(double minimum_level, | 6197 void RenderViewImpl::zoomLimitsChanged(double minimum_level, |
6198 double maximum_level) { | 6198 double maximum_level) { |
6199 // For now, don't remember plugin zoom values. We don't want to mix them with | 6199 // For now, don't remember plugin zoom values. We don't want to mix them with |
6200 // normal web content (i.e. a fixed layout plugin would usually want them | 6200 // normal web content (i.e. a fixed layout plugin would usually want them |
6201 // different). | 6201 // different). |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6241 if (base.GetOrigin() != absolute_url.GetOrigin()) { | 6241 if (base.GetOrigin() != absolute_url.GetOrigin()) { |
6242 return; | 6242 return; |
6243 } | 6243 } |
6244 Send(new ViewHostMsg_RegisterProtocolHandler(routing_id_, | 6244 Send(new ViewHostMsg_RegisterProtocolHandler(routing_id_, |
6245 UTF16ToUTF8(scheme), | 6245 UTF16ToUTF8(scheme), |
6246 absolute_url, | 6246 absolute_url, |
6247 title, | 6247 title, |
6248 user_gesture)); | 6248 user_gesture)); |
6249 } | 6249 } |
6250 | 6250 |
6251 WebKit::WebPageVisibilityState RenderViewImpl::visibilityState() const { | 6251 blink::WebPageVisibilityState RenderViewImpl::visibilityState() const { |
6252 WebKit::WebPageVisibilityState current_state = is_hidden() ? | 6252 blink::WebPageVisibilityState current_state = is_hidden() ? |
6253 WebKit::WebPageVisibilityStateHidden : | 6253 blink::WebPageVisibilityStateHidden : |
6254 WebKit::WebPageVisibilityStateVisible; | 6254 blink::WebPageVisibilityStateVisible; |
6255 WebKit::WebPageVisibilityState override_state = current_state; | 6255 blink::WebPageVisibilityState override_state = current_state; |
6256 if (GetContentClient()->renderer()-> | 6256 if (GetContentClient()->renderer()-> |
6257 ShouldOverridePageVisibilityState(this, | 6257 ShouldOverridePageVisibilityState(this, |
6258 &override_state)) | 6258 &override_state)) |
6259 return override_state; | 6259 return override_state; |
6260 return current_state; | 6260 return current_state; |
6261 } | 6261 } |
6262 | 6262 |
6263 WebKit::WebUserMediaClient* RenderViewImpl::userMediaClient() { | 6263 blink::WebUserMediaClient* RenderViewImpl::userMediaClient() { |
6264 // This can happen in tests, in which case it's OK to return NULL. | 6264 // This can happen in tests, in which case it's OK to return NULL. |
6265 if (!InitializeMediaStreamClient()) | 6265 if (!InitializeMediaStreamClient()) |
6266 return NULL; | 6266 return NULL; |
6267 | 6267 |
6268 return web_user_media_client_; | 6268 return web_user_media_client_; |
6269 } | 6269 } |
6270 | 6270 |
6271 WebKit::WebMIDIClient* RenderViewImpl::webMIDIClient() { | 6271 blink::WebMIDIClient* RenderViewImpl::webMIDIClient() { |
6272 if (!midi_dispatcher_) | 6272 if (!midi_dispatcher_) |
6273 midi_dispatcher_ = new MIDIDispatcher(this); | 6273 midi_dispatcher_ = new MIDIDispatcher(this); |
6274 return midi_dispatcher_; | 6274 return midi_dispatcher_; |
6275 } | 6275 } |
6276 | 6276 |
6277 void RenderViewImpl::draggableRegionsChanged() { | 6277 void RenderViewImpl::draggableRegionsChanged() { |
6278 FOR_EACH_OBSERVER( | 6278 FOR_EACH_OBSERVER( |
6279 RenderViewObserver, | 6279 RenderViewObserver, |
6280 observers_, | 6280 observers_, |
6281 DraggableRegionsChanged(webview()->mainFrame())); | 6281 DraggableRegionsChanged(webview()->mainFrame())); |
6282 } | 6282 } |
6283 | 6283 |
6284 WebMediaPlayer* RenderViewImpl::CreateWebMediaPlayerForMediaStream( | 6284 WebMediaPlayer* RenderViewImpl::CreateWebMediaPlayerForMediaStream( |
6285 WebFrame* frame, | 6285 WebFrame* frame, |
6286 const WebKit::WebURL& url, | 6286 const blink::WebURL& url, |
6287 WebMediaPlayerClient* client) { | 6287 WebMediaPlayerClient* client) { |
6288 #if defined(ENABLE_WEBRTC) | 6288 #if defined(ENABLE_WEBRTC) |
6289 if (!InitializeMediaStreamClient()) { | 6289 if (!InitializeMediaStreamClient()) { |
6290 LOG(ERROR) << "Failed to initialize MediaStreamClient"; | 6290 LOG(ERROR) << "Failed to initialize MediaStreamClient"; |
6291 return NULL; | 6291 return NULL; |
6292 } | 6292 } |
6293 #if !defined(GOOGLE_TV) | 6293 #if !defined(GOOGLE_TV) |
6294 if (media_stream_client_->IsMediaStream(url)) { | 6294 if (media_stream_client_->IsMediaStream(url)) { |
6295 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 6295 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
6296 bool found_neon = | 6296 bool found_neon = |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6346 return; | 6346 return; |
6347 | 6347 |
6348 // Remove the content highlighting if any. | 6348 // Remove the content highlighting if any. |
6349 scheduleComposite(); | 6349 scheduleComposite(); |
6350 | 6350 |
6351 if (!intent.is_empty()) | 6351 if (!intent.is_empty()) |
6352 Send(new ViewHostMsg_StartContentIntent(routing_id_, intent)); | 6352 Send(new ViewHostMsg_StartContentIntent(routing_id_, intent)); |
6353 } | 6353 } |
6354 | 6354 |
6355 bool RenderViewImpl::openDateTimeChooser( | 6355 bool RenderViewImpl::openDateTimeChooser( |
6356 const WebKit::WebDateTimeChooserParams& params, | 6356 const blink::WebDateTimeChooserParams& params, |
6357 WebKit::WebDateTimeChooserCompletion* completion) { | 6357 blink::WebDateTimeChooserCompletion* completion) { |
6358 date_time_picker_client_.reset( | 6358 date_time_picker_client_.reset( |
6359 new RendererDateTimePicker(this, params, completion)); | 6359 new RendererDateTimePicker(this, params, completion)); |
6360 return date_time_picker_client_->Open(); | 6360 return date_time_picker_client_->Open(); |
6361 } | 6361 } |
6362 | 6362 |
6363 WebMediaPlayer* RenderViewImpl::CreateAndroidWebMediaPlayer( | 6363 WebMediaPlayer* RenderViewImpl::CreateAndroidWebMediaPlayer( |
6364 WebFrame* frame, | 6364 WebFrame* frame, |
6365 const WebKit::WebURL& url, | 6365 const blink::WebURL& url, |
6366 WebMediaPlayerClient* client) { | 6366 WebMediaPlayerClient* client) { |
6367 GpuChannelHost* gpu_channel_host = | 6367 GpuChannelHost* gpu_channel_host = |
6368 RenderThreadImpl::current()->EstablishGpuChannelSync( | 6368 RenderThreadImpl::current()->EstablishGpuChannelSync( |
6369 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); | 6369 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); |
6370 if (!gpu_channel_host) { | 6370 if (!gpu_channel_host) { |
6371 LOG(ERROR) << "Failed to establish GPU channel for media player"; | 6371 LOG(ERROR) << "Failed to establish GPU channel for media player"; |
6372 return NULL; | 6372 return NULL; |
6373 } | 6373 } |
6374 | 6374 |
6375 scoped_ptr<StreamTextureFactory> stream_texture_factory; | 6375 scoped_ptr<StreamTextureFactory> stream_texture_factory; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6488 if (!webview()) | 6488 if (!webview()) |
6489 return; | 6489 return; |
6490 | 6490 |
6491 WebFrame* main_frame = webview()->mainFrame(); | 6491 WebFrame* main_frame = webview()->mainFrame(); |
6492 if (main_frame && main_frame->opener()) | 6492 if (main_frame && main_frame->opener()) |
6493 main_frame->setOpener(NULL); | 6493 main_frame->setOpener(NULL); |
6494 } | 6494 } |
6495 | 6495 |
6496 #if defined(OS_ANDROID) | 6496 #if defined(OS_ANDROID) |
6497 bool RenderViewImpl::didTapMultipleTargets( | 6497 bool RenderViewImpl::didTapMultipleTargets( |
6498 const WebKit::WebGestureEvent& event, | 6498 const blink::WebGestureEvent& event, |
6499 const WebVector<WebRect>& target_rects) { | 6499 const WebVector<WebRect>& target_rects) { |
6500 // Never show a disambiguation popup when accessibility is enabled, | 6500 // Never show a disambiguation popup when accessibility is enabled, |
6501 // as this interferes with "touch exploration". | 6501 // as this interferes with "touch exploration". |
6502 if (accessibility_mode_ == AccessibilityModeComplete) | 6502 if (accessibility_mode_ == AccessibilityModeComplete) |
6503 return false; | 6503 return false; |
6504 | 6504 |
6505 gfx::Rect finger_rect( | 6505 gfx::Rect finger_rect( |
6506 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, | 6506 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, |
6507 event.data.tap.width, event.data.tap.height); | 6507 event.data.tap.width, event.data.tap.height); |
6508 gfx::Rect zoom_rect; | 6508 gfx::Rect zoom_rect; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6656 for (size_t i = 0; i < icon_urls.size(); i++) { | 6656 for (size_t i = 0; i < icon_urls.size(); i++) { |
6657 WebURL url = icon_urls[i].iconURL(); | 6657 WebURL url = icon_urls[i].iconURL(); |
6658 if (!url.isEmpty()) | 6658 if (!url.isEmpty()) |
6659 urls.push_back(FaviconURL(url, | 6659 urls.push_back(FaviconURL(url, |
6660 ToFaviconType(icon_urls[i].iconType()))); | 6660 ToFaviconType(icon_urls[i].iconType()))); |
6661 } | 6661 } |
6662 SendUpdateFaviconURL(urls); | 6662 SendUpdateFaviconURL(urls); |
6663 } | 6663 } |
6664 | 6664 |
6665 } // namespace content | 6665 } // namespace content |
OLD | NEW |