| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 } | 447 } |
| 448 | 448 |
| 449 void ChromeClientImpl::SetResizable(bool value) { | 449 void ChromeClientImpl::SetResizable(bool value) { |
| 450 window_features_.resizable = value; | 450 window_features_.resizable = value; |
| 451 } | 451 } |
| 452 | 452 |
| 453 bool ChromeClientImpl::ShouldReportDetailedMessageForSource( | 453 bool ChromeClientImpl::ShouldReportDetailedMessageForSource( |
| 454 LocalFrame& local_frame, | 454 LocalFrame& local_frame, |
| 455 const String& url) { | 455 const String& url) { |
| 456 WebLocalFrameImpl* webframe = | 456 WebLocalFrameImpl* webframe = |
| 457 WebLocalFrameImpl::FromFrame(local_frame.LocalFrameRoot()); | 457 WebLocalFrameImpl::FromFrame(&local_frame.LocalFrameRoot()); |
| 458 return webframe && webframe->Client() && | 458 return webframe && webframe->Client() && |
| 459 webframe->Client()->ShouldReportDetailedMessageForSource(url); | 459 webframe->Client()->ShouldReportDetailedMessageForSource(url); |
| 460 } | 460 } |
| 461 | 461 |
| 462 void ChromeClientImpl::AddMessageToConsole(LocalFrame* local_frame, | 462 void ChromeClientImpl::AddMessageToConsole(LocalFrame* local_frame, |
| 463 MessageSource source, | 463 MessageSource source, |
| 464 MessageLevel level, | 464 MessageLevel level, |
| 465 const String& message, | 465 const String& message, |
| 466 unsigned line_number, | 466 unsigned line_number, |
| 467 const String& source_id, | 467 const String& source_id, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 bool ChromeClientImpl::TabsToLinks() { | 548 bool ChromeClientImpl::TabsToLinks() { |
| 549 return web_view_->TabsToLinks(); | 549 return web_view_->TabsToLinks(); |
| 550 } | 550 } |
| 551 | 551 |
| 552 void ChromeClientImpl::InvalidateRect(const IntRect& update_rect) { | 552 void ChromeClientImpl::InvalidateRect(const IntRect& update_rect) { |
| 553 if (!update_rect.IsEmpty()) | 553 if (!update_rect.IsEmpty()) |
| 554 web_view_->InvalidateRect(update_rect); | 554 web_view_->InvalidateRect(update_rect); |
| 555 } | 555 } |
| 556 | 556 |
| 557 void ChromeClientImpl::ScheduleAnimation(LocalFrame* frame) { | 557 void ChromeClientImpl::ScheduleAnimation(LocalFrame* frame) { |
| 558 frame = frame->LocalFrameRoot(); | 558 frame = &frame->LocalFrameRoot(); |
| 559 // If the frame is still being created, it might not yet have a WebWidget. | 559 // If the frame is still being created, it might not yet have a WebWidget. |
| 560 // FIXME: Is this the right thing to do? Is there a way to avoid having | 560 // FIXME: Is this the right thing to do? Is there a way to avoid having |
| 561 // a local frame root that doesn't have a WebWidget? During initialization | 561 // a local frame root that doesn't have a WebWidget? During initialization |
| 562 // there is no content to draw so this call serves no purpose. | 562 // there is no content to draw so this call serves no purpose. |
| 563 if (WebLocalFrameImpl::FromFrame(frame) && | 563 if (WebLocalFrameImpl::FromFrame(frame) && |
| 564 WebLocalFrameImpl::FromFrame(frame)->FrameWidget()) | 564 WebLocalFrameImpl::FromFrame(frame)->FrameWidget()) |
| 565 WebLocalFrameImpl::FromFrame(frame)->FrameWidget()->ScheduleAnimation(); | 565 WebLocalFrameImpl::FromFrame(frame)->FrameWidget()->ScheduleAnimation(); |
| 566 } | 566 } |
| 567 | 567 |
| 568 IntRect ChromeClientImpl::ViewportToScreen( | 568 IntRect ChromeClientImpl::ViewportToScreen( |
| 569 const IntRect& rect_in_viewport, | 569 const IntRect& rect_in_viewport, |
| 570 const FrameViewBase* frame_view_base) const { | 570 const FrameViewBase* frame_view_base) const { |
| 571 WebRect screen_rect(rect_in_viewport); | 571 WebRect screen_rect(rect_in_viewport); |
| 572 | 572 |
| 573 DCHECK(frame_view_base->IsFrameView()); | 573 DCHECK(frame_view_base->IsFrameView()); |
| 574 const FrameView* view = ToFrameView(frame_view_base); | 574 const FrameView* view = ToFrameView(frame_view_base); |
| 575 LocalFrame* frame = view->GetFrame().LocalFrameRoot(); | 575 LocalFrame& frame = view->GetFrame().LocalFrameRoot(); |
| 576 | 576 |
| 577 WebWidgetClient* client = | 577 WebWidgetClient* client = |
| 578 WebLocalFrameImpl::FromFrame(frame)->FrameWidget()->Client(); | 578 WebLocalFrameImpl::FromFrame(&frame)->FrameWidget()->Client(); |
| 579 | 579 |
| 580 if (client) { | 580 if (client) { |
| 581 client->ConvertViewportToWindow(&screen_rect); | 581 client->ConvertViewportToWindow(&screen_rect); |
| 582 WebRect view_rect = client->ViewRect(); | 582 WebRect view_rect = client->ViewRect(); |
| 583 screen_rect.x += view_rect.x; | 583 screen_rect.x += view_rect.x; |
| 584 screen_rect.y += view_rect.y; | 584 screen_rect.y += view_rect.y; |
| 585 } | 585 } |
| 586 | 586 |
| 587 return screen_rect; | 587 return screen_rect; |
| 588 } | 588 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 if (cursor_overridden_) | 774 if (cursor_overridden_) |
| 775 return; | 775 return; |
| 776 | 776 |
| 777 #if OS(MACOSX) | 777 #if OS(MACOSX) |
| 778 // On Mac the mousemove event propagates to both the popup and main window. | 778 // On Mac the mousemove event propagates to both the popup and main window. |
| 779 // If a popup is open we don't want the main window to change the cursor. | 779 // If a popup is open we don't want the main window to change the cursor. |
| 780 if (web_view_->HasOpenedPopup()) | 780 if (web_view_->HasOpenedPopup()) |
| 781 return; | 781 return; |
| 782 #endif | 782 #endif |
| 783 | 783 |
| 784 LocalFrame* local_root = local_frame->LocalFrameRoot(); | 784 LocalFrame& local_root = local_frame->LocalFrameRoot(); |
| 785 if (WebFrameWidgetBase* widget = | 785 if (WebFrameWidgetBase* widget = |
| 786 WebLocalFrameImpl::FromFrame(local_root)->FrameWidget()) | 786 WebLocalFrameImpl::FromFrame(&local_root)->FrameWidget()) |
| 787 widget->Client()->DidChangeCursor(cursor); | 787 widget->Client()->DidChangeCursor(cursor); |
| 788 } | 788 } |
| 789 | 789 |
| 790 void ChromeClientImpl::SetCursorForPlugin(const WebCursorInfo& cursor, | 790 void ChromeClientImpl::SetCursorForPlugin(const WebCursorInfo& cursor, |
| 791 LocalFrame* local_frame) { | 791 LocalFrame* local_frame) { |
| 792 SetCursor(cursor, local_frame); | 792 SetCursor(cursor, local_frame); |
| 793 } | 793 } |
| 794 | 794 |
| 795 void ChromeClientImpl::SetCursorOverridden(bool overridden) { | 795 void ChromeClientImpl::SetCursorOverridden(bool overridden) { |
| 796 cursor_overridden_ = overridden; | 796 cursor_overridden_ = overridden; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 void ChromeClientImpl::ExitFullscreen(LocalFrame& frame) { | 871 void ChromeClientImpl::ExitFullscreen(LocalFrame& frame) { |
| 872 web_view_->ExitFullscreen(frame); | 872 web_view_->ExitFullscreen(frame); |
| 873 } | 873 } |
| 874 | 874 |
| 875 void ChromeClientImpl::FullscreenElementChanged(Element* from_element, | 875 void ChromeClientImpl::FullscreenElementChanged(Element* from_element, |
| 876 Element* to_element) { | 876 Element* to_element) { |
| 877 web_view_->FullscreenElementChanged(from_element, to_element); | 877 web_view_->FullscreenElementChanged(from_element, to_element); |
| 878 } | 878 } |
| 879 | 879 |
| 880 void ChromeClientImpl::ClearCompositedSelection(LocalFrame* frame) { | 880 void ChromeClientImpl::ClearCompositedSelection(LocalFrame* frame) { |
| 881 LocalFrame* local_root = frame->LocalFrameRoot(); | 881 LocalFrame& local_root = frame->LocalFrameRoot(); |
| 882 WebFrameWidgetBase* widget = | 882 WebFrameWidgetBase* widget = |
| 883 WebLocalFrameImpl::FromFrame(local_root)->FrameWidget(); | 883 WebLocalFrameImpl::FromFrame(&local_root)->FrameWidget(); |
| 884 WebWidgetClient* client = widget->Client(); | 884 WebWidgetClient* client = widget->Client(); |
| 885 if (!client) | 885 if (!client) |
| 886 return; | 886 return; |
| 887 | 887 |
| 888 if (WebLayerTreeView* layer_tree_view = widget->GetLayerTreeView()) | 888 if (WebLayerTreeView* layer_tree_view = widget->GetLayerTreeView()) |
| 889 layer_tree_view->ClearSelection(); | 889 layer_tree_view->ClearSelection(); |
| 890 } | 890 } |
| 891 | 891 |
| 892 void ChromeClientImpl::UpdateCompositedSelection( | 892 void ChromeClientImpl::UpdateCompositedSelection( |
| 893 LocalFrame* frame, | 893 LocalFrame* frame, |
| 894 const CompositedSelection& selection) { | 894 const CompositedSelection& selection) { |
| 895 LocalFrame* local_root = frame->LocalFrameRoot(); | 895 LocalFrame& local_root = frame->LocalFrameRoot(); |
| 896 WebFrameWidgetBase* widget = | 896 WebFrameWidgetBase* widget = |
| 897 WebLocalFrameImpl::FromFrame(local_root)->FrameWidget(); | 897 WebLocalFrameImpl::FromFrame(&local_root)->FrameWidget(); |
| 898 WebWidgetClient* client = widget->Client(); | 898 WebWidgetClient* client = widget->Client(); |
| 899 if (!client) | 899 if (!client) |
| 900 return; | 900 return; |
| 901 | 901 |
| 902 if (WebLayerTreeView* layer_tree_view = widget->GetLayerTreeView()) | 902 if (WebLayerTreeView* layer_tree_view = widget->GetLayerTreeView()) |
| 903 layer_tree_view->RegisterSelection(WebSelection(selection)); | 903 layer_tree_view->RegisterSelection(WebSelection(selection)); |
| 904 } | 904 } |
| 905 | 905 |
| 906 bool ChromeClientImpl::HasOpenedPopup() const { | 906 bool ChromeClientImpl::HasOpenedPopup() const { |
| 907 return web_view_->HasOpenedPopup(); | 907 return web_view_->HasOpenedPopup(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 WebLocalFrameImpl* web_frame = WebLocalFrameImpl::FromFrame(frame); | 1048 WebLocalFrameImpl* web_frame = WebLocalFrameImpl::FromFrame(frame); |
| 1049 WebFrameWidgetBase* widget = web_frame->LocalRoot()->FrameWidget(); | 1049 WebFrameWidgetBase* widget = web_frame->LocalRoot()->FrameWidget(); |
| 1050 if (!widget) | 1050 if (!widget) |
| 1051 return; | 1051 return; |
| 1052 | 1052 |
| 1053 if (WebWidgetClient* client = widget->Client()) | 1053 if (WebWidgetClient* client = widget->Client()) |
| 1054 client->SetTouchAction(static_cast<WebTouchAction>(touch_action)); | 1054 client->SetTouchAction(static_cast<WebTouchAction>(touch_action)); |
| 1055 } | 1055 } |
| 1056 | 1056 |
| 1057 bool ChromeClientImpl::RequestPointerLock(LocalFrame* frame) { | 1057 bool ChromeClientImpl::RequestPointerLock(LocalFrame* frame) { |
| 1058 LocalFrame* local_root = frame->LocalFrameRoot(); | 1058 LocalFrame& local_root = frame->LocalFrameRoot(); |
| 1059 return WebLocalFrameImpl::FromFrame(local_root) | 1059 return WebLocalFrameImpl::FromFrame(&local_root) |
| 1060 ->FrameWidget() | 1060 ->FrameWidget() |
| 1061 ->Client() | 1061 ->Client() |
| 1062 ->RequestPointerLock(); | 1062 ->RequestPointerLock(); |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 void ChromeClientImpl::RequestPointerUnlock(LocalFrame* frame) { | 1065 void ChromeClientImpl::RequestPointerUnlock(LocalFrame* frame) { |
| 1066 LocalFrame* local_root = frame->LocalFrameRoot(); | 1066 LocalFrame& local_root = frame->LocalFrameRoot(); |
| 1067 return WebLocalFrameImpl::FromFrame(local_root) | 1067 return WebLocalFrameImpl::FromFrame(&local_root) |
| 1068 ->FrameWidget() | 1068 ->FrameWidget() |
| 1069 ->Client() | 1069 ->Client() |
| 1070 ->RequestPointerUnlock(); | 1070 ->RequestPointerUnlock(); |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 void ChromeClientImpl::AnnotatedRegionsChanged() { | 1073 void ChromeClientImpl::AnnotatedRegionsChanged() { |
| 1074 if (WebViewClient* client = web_view_->Client()) | 1074 if (WebViewClient* client = web_view_->Client()) |
| 1075 client->DraggableRegionsChanged(); | 1075 client->DraggableRegionsChanged(); |
| 1076 } | 1076 } |
| 1077 | 1077 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 if (RuntimeEnabledFeatures::presentationEnabled()) | 1239 if (RuntimeEnabledFeatures::presentationEnabled()) |
| 1240 PresentationController::ProvideTo(frame, client->PresentationClient()); | 1240 PresentationController::ProvideTo(frame, client->PresentationClient()); |
| 1241 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) { | 1241 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) { |
| 1242 ProvideAudioOutputDeviceClientTo(frame, | 1242 ProvideAudioOutputDeviceClientTo(frame, |
| 1243 new AudioOutputDeviceClientImpl(frame)); | 1243 new AudioOutputDeviceClientImpl(frame)); |
| 1244 } | 1244 } |
| 1245 InstalledAppController::ProvideTo(frame, client->GetRelatedAppsFetcher()); | 1245 InstalledAppController::ProvideTo(frame, client->GetRelatedAppsFetcher()); |
| 1246 } | 1246 } |
| 1247 | 1247 |
| 1248 } // namespace blink | 1248 } // namespace blink |
| OLD | NEW |