| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 #include "web/WebLocalFrameImpl.h" | 101 #include "web/WebLocalFrameImpl.h" |
| 102 #include "web/WebPluginContainerImpl.h" | 102 #include "web/WebPluginContainerImpl.h" |
| 103 #include "web/WebPopupMenuImpl.h" | 103 #include "web/WebPopupMenuImpl.h" |
| 104 #include "web/WebSettingsImpl.h" | 104 #include "web/WebSettingsImpl.h" |
| 105 #include "web/WebViewImpl.h" | 105 #include "web/WebViewImpl.h" |
| 106 #include "wtf/text/CString.h" | 106 #include "wtf/text/CString.h" |
| 107 #include "wtf/text/StringBuilder.h" | 107 #include "wtf/text/StringBuilder.h" |
| 108 #include "wtf/text/StringConcatenate.h" | 108 #include "wtf/text/StringConcatenate.h" |
| 109 #include "wtf/unicode/CharacterNames.h" | 109 #include "wtf/unicode/CharacterNames.h" |
| 110 | 110 |
| 111 using namespace WebCore; | 111 using namespace blink; |
| 112 | 112 |
| 113 namespace blink { | 113 namespace blink { |
| 114 | 114 |
| 115 // Converts a WebCore::AXObjectCache::AXNotification to a blink::WebAXEvent | 115 // Converts a blink::AXObjectCache::AXNotification to a blink::WebAXEvent |
| 116 static WebAXEvent toWebAXEvent(AXObjectCache::AXNotification notification) | 116 static WebAXEvent toWebAXEvent(AXObjectCache::AXNotification notification) |
| 117 { | 117 { |
| 118 // These enums have the same values; enforced in AssertMatchingEnums.cpp. | 118 // These enums have the same values; enforced in AssertMatchingEnums.cpp. |
| 119 return static_cast<WebAXEvent>(notification); | 119 return static_cast<WebAXEvent>(notification); |
| 120 } | 120 } |
| 121 | 121 |
| 122 ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView) | 122 ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView) |
| 123 : m_webView(webView) | 123 : m_webView(webView) |
| 124 , m_toolbarsVisible(true) | 124 , m_toolbarsVisible(true) |
| 125 , m_statusbarVisible(true) | 125 , m_statusbarVisible(true) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 void ChromeClientImpl::focusedNodeChanged(Node* node) | 199 void ChromeClientImpl::focusedNodeChanged(Node* node) |
| 200 { | 200 { |
| 201 m_webView->client()->focusedNodeChanged(WebNode(node)); | 201 m_webView->client()->focusedNodeChanged(WebNode(node)); |
| 202 | 202 |
| 203 WebURL focusURL; | 203 WebURL focusURL; |
| 204 if (node && node->isElementNode() && toElement(node)->isLiveLink()) | 204 if (node && node->isElementNode() && toElement(node)->isLiveLink()) |
| 205 focusURL = toElement(node)->hrefURL(); | 205 focusURL = toElement(node)->hrefURL(); |
| 206 m_webView->client()->setKeyboardFocusURL(focusURL); | 206 m_webView->client()->setKeyboardFocusURL(focusURL); |
| 207 } | 207 } |
| 208 | 208 |
| 209 void ChromeClientImpl::focusedFrameChanged(WebCore::LocalFrame* frame) | 209 void ChromeClientImpl::focusedFrameChanged(blink::LocalFrame* frame) |
| 210 { | 210 { |
| 211 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame); | 211 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame); |
| 212 if (webframe && webframe->client()) | 212 if (webframe && webframe->client()) |
| 213 webframe->client()->frameFocused(); | 213 webframe->client()->frameFocused(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 Page* ChromeClientImpl::createWindow(LocalFrame* frame, const FrameLoadRequest&
r, const WindowFeatures& features, | 216 Page* ChromeClientImpl::createWindow(LocalFrame* frame, const FrameLoadRequest&
r, const WindowFeatures& features, |
| 217 NavigationPolicy navigationPolicy, ShouldSendReferrer shouldSendReferrer) | 217 NavigationPolicy navigationPolicy, ShouldSendReferrer shouldSendReferrer) |
| 218 { | 218 { |
| 219 if (!m_webView->client()) | 219 if (!m_webView->client()) |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 WebFileChooserCompletionImpl* chooserCompletion = | 632 WebFileChooserCompletionImpl* chooserCompletion = |
| 633 new WebFileChooserCompletionImpl(fileChooser); | 633 new WebFileChooserCompletionImpl(fileChooser); |
| 634 | 634 |
| 635 ASSERT(fileChooser && fileChooser->settings().selectedFiles.size()); | 635 ASSERT(fileChooser && fileChooser->settings().selectedFiles.size()); |
| 636 | 636 |
| 637 // If the enumeration can't happen, call the callback with an empty list. | 637 // If the enumeration can't happen, call the callback with an empty list. |
| 638 if (!client->enumerateChosenDirectory(fileChooser->settings().selectedFiles[
0], chooserCompletion)) | 638 if (!client->enumerateChosenDirectory(fileChooser->settings().selectedFiles[
0], chooserCompletion)) |
| 639 chooserCompletion->didChooseFile(WebVector<WebString>()); | 639 chooserCompletion->didChooseFile(WebVector<WebString>()); |
| 640 } | 640 } |
| 641 | 641 |
| 642 void ChromeClientImpl::setCursor(const WebCore::Cursor& cursor) | 642 void ChromeClientImpl::setCursor(const blink::Cursor& cursor) |
| 643 { | 643 { |
| 644 setCursor(WebCursorInfo(cursor)); | 644 setCursor(WebCursorInfo(cursor)); |
| 645 } | 645 } |
| 646 | 646 |
| 647 void ChromeClientImpl::setCursor(const WebCursorInfo& cursor) | 647 void ChromeClientImpl::setCursor(const WebCursorInfo& cursor) |
| 648 { | 648 { |
| 649 #if OS(MACOSX) | 649 #if OS(MACOSX) |
| 650 // On Mac the mousemove event propagates to both the popup and main window. | 650 // On Mac the mousemove event propagates to both the popup and main window. |
| 651 // If a popup is open we don't want the main window to change the cursor. | 651 // If a popup is open we don't want the main window to change the cursor. |
| 652 if (m_webView->hasOpenedPopup()) | 652 if (m_webView->hasOpenedPopup()) |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 void ChromeClientImpl::handleKeyboardEventOnTextField(HTMLInputElement& inputEle
ment, KeyboardEvent& event) | 826 void ChromeClientImpl::handleKeyboardEventOnTextField(HTMLInputElement& inputEle
ment, KeyboardEvent& event) |
| 827 { | 827 { |
| 828 if (!m_webView->autofillClient()) | 828 if (!m_webView->autofillClient()) |
| 829 return; | 829 return; |
| 830 m_webView->autofillClient()->textFieldDidReceiveKeyDown(WebInputElement(&inp
utElement), WebKeyboardEventBuilder(event)); | 830 m_webView->autofillClient()->textFieldDidReceiveKeyDown(WebInputElement(&inp
utElement), WebKeyboardEventBuilder(event)); |
| 831 } | 831 } |
| 832 | 832 |
| 833 // FIXME: Remove this code once we have input routing in the browser | 833 // FIXME: Remove this code once we have input routing in the browser |
| 834 // process. See http://crbug.com/339659. | 834 // process. See http://crbug.com/339659. |
| 835 void ChromeClientImpl::forwardInputEvent( | 835 void ChromeClientImpl::forwardInputEvent( |
| 836 WebCore::Frame* frame, WebCore::Event* event) | 836 blink::Frame* frame, blink::Event* event) |
| 837 { | 837 { |
| 838 // FIXME: Input event forwarding to out-of-process frames is broken until | 838 // FIXME: Input event forwarding to out-of-process frames is broken until |
| 839 // WebRemoteFrameImpl has a WebFrameClient. | 839 // WebRemoteFrameImpl has a WebFrameClient. |
| 840 if (frame->isRemoteFrame()) | 840 if (frame->isRemoteFrame()) |
| 841 return; | 841 return; |
| 842 | 842 |
| 843 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(toLocalFrame(fram
e)); | 843 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(toLocalFrame(fram
e)); |
| 844 | 844 |
| 845 // This is only called when we have out-of-process iframes, which | 845 // This is only called when we have out-of-process iframes, which |
| 846 // need to forward input events across processes. | 846 // need to forward input events across processes. |
| 847 // FIXME: Add a check for out-of-process iframes enabled. | 847 // FIXME: Add a check for out-of-process iframes enabled. |
| 848 if (event->isKeyboardEvent()) { | 848 if (event->isKeyboardEvent()) { |
| 849 WebKeyboardEventBuilder webEvent(*static_cast<WebCore::KeyboardEvent*>(e
vent)); | 849 WebKeyboardEventBuilder webEvent(*static_cast<blink::KeyboardEvent*>(eve
nt)); |
| 850 webFrame->client()->forwardInputEvent(&webEvent); | 850 webFrame->client()->forwardInputEvent(&webEvent); |
| 851 } else if (event->isMouseEvent()) { | 851 } else if (event->isMouseEvent()) { |
| 852 WebMouseEventBuilder webEvent(webFrame->frameView(), frame->ownerRendere
r(), *static_cast<WebCore::MouseEvent*>(event)); | 852 WebMouseEventBuilder webEvent(webFrame->frameView(), frame->ownerRendere
r(), *static_cast<blink::MouseEvent*>(event)); |
| 853 // Internal Blink events should not be forwarded. | 853 // Internal Blink events should not be forwarded. |
| 854 if (webEvent.type == WebInputEvent::Undefined) | 854 if (webEvent.type == WebInputEvent::Undefined) |
| 855 return; | 855 return; |
| 856 | 856 |
| 857 webFrame->client()->forwardInputEvent(&webEvent); | 857 webFrame->client()->forwardInputEvent(&webEvent); |
| 858 } else if (event->isWheelEvent()) { | 858 } else if (event->isWheelEvent()) { |
| 859 WebMouseWheelEventBuilder webEvent(webFrame->frameView(), frame->ownerRe
nderer(), *static_cast<WebCore::WheelEvent*>(event)); | 859 WebMouseWheelEventBuilder webEvent(webFrame->frameView(), frame->ownerRe
nderer(), *static_cast<blink::WheelEvent*>(event)); |
| 860 if (webEvent.type == WebInputEvent::Undefined) | 860 if (webEvent.type == WebInputEvent::Undefined) |
| 861 return; | 861 return; |
| 862 webFrame->client()->forwardInputEvent(&webEvent); | 862 webFrame->client()->forwardInputEvent(&webEvent); |
| 863 } | 863 } |
| 864 } | 864 } |
| 865 | 865 |
| 866 void ChromeClientImpl::didChangeValueInTextField(HTMLFormControlElement& element
) | 866 void ChromeClientImpl::didChangeValueInTextField(HTMLFormControlElement& element
) |
| 867 { | 867 { |
| 868 if (!m_webView->autofillClient()) | 868 if (!m_webView->autofillClient()) |
| 869 return; | 869 return; |
| 870 m_webView->autofillClient()->textFieldDidChange(WebFormControlElement(&eleme
nt)); | 870 m_webView->autofillClient()->textFieldDidChange(WebFormControlElement(&eleme
nt)); |
| 871 } | 871 } |
| 872 | 872 |
| 873 void ChromeClientImpl::didEndEditingOnTextField(HTMLInputElement& inputElement) | 873 void ChromeClientImpl::didEndEditingOnTextField(HTMLInputElement& inputElement) |
| 874 { | 874 { |
| 875 if (m_webView->autofillClient()) | 875 if (m_webView->autofillClient()) |
| 876 m_webView->autofillClient()->textFieldDidEndEditing(WebInputElement(&inp
utElement)); | 876 m_webView->autofillClient()->textFieldDidEndEditing(WebInputElement(&inp
utElement)); |
| 877 } | 877 } |
| 878 | 878 |
| 879 void ChromeClientImpl::openTextDataListChooser(HTMLInputElement& input) | 879 void ChromeClientImpl::openTextDataListChooser(HTMLInputElement& input) |
| 880 { | 880 { |
| 881 if (m_webView->autofillClient()) | 881 if (m_webView->autofillClient()) |
| 882 m_webView->autofillClient()->openTextDataListChooser(WebInputElement(&in
put)); | 882 m_webView->autofillClient()->openTextDataListChooser(WebInputElement(&in
put)); |
| 883 } | 883 } |
| 884 | 884 |
| 885 } // namespace blink | 885 } // namespace blink |
| OLD | NEW |