Chromium Code Reviews| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 | 111 |
| 112 // Converts a AXObjectCache::AXNotification to a WebAXEvent | 112 // Converts a AXObjectCache::AXNotification to a WebAXEvent |
| 113 static WebAXEvent toWebAXEvent(AXObjectCache::AXNotification notification) | 113 static WebAXEvent toWebAXEvent(AXObjectCache::AXNotification notification) |
| 114 { | 114 { |
| 115 // These enums have the same values; enforced in AssertMatchingEnums.cpp. | 115 // These enums have the same values; enforced in AssertMatchingEnums.cpp. |
| 116 return static_cast<WebAXEvent>(notification); | 116 return static_cast<WebAXEvent>(notification); |
| 117 } | 117 } |
| 118 | 118 |
| 119 ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView) | 119 ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView) |
| 120 : m_webView(webView) | 120 : m_webView(webView) |
| 121 , m_overrideCursor(nullptr) | |
| 121 { | 122 { |
| 122 } | 123 } |
| 123 | 124 |
| 124 ChromeClientImpl::~ChromeClientImpl() | 125 ChromeClientImpl::~ChromeClientImpl() |
| 125 { | 126 { |
| 126 } | 127 } |
| 127 | 128 |
| 128 PassOwnPtrWillBeRawPtr<ChromeClientImpl> ChromeClientImpl::create(WebViewImpl* w ebView) | 129 PassOwnPtrWillBeRawPtr<ChromeClientImpl> ChromeClientImpl::create(WebViewImpl* w ebView) |
| 129 { | 130 { |
| 130 return adoptPtrWillBeNoop(new ChromeClientImpl(webView)); | 131 return adoptPtrWillBeNoop(new ChromeClientImpl(webView)); |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 653 } | 654 } |
| 654 | 655 |
| 655 Cursor ChromeClientImpl::lastSetCursorForTesting() const | 656 Cursor ChromeClientImpl::lastSetCursorForTesting() const |
| 656 { | 657 { |
| 657 return m_lastSetMouseCursorForTesting; | 658 return m_lastSetMouseCursorForTesting; |
| 658 } | 659 } |
| 659 | 660 |
| 660 void ChromeClientImpl::setCursor(const Cursor& cursor) | 661 void ChromeClientImpl::setCursor(const Cursor& cursor) |
| 661 { | 662 { |
| 662 m_lastSetMouseCursorForTesting = cursor; | 663 m_lastSetMouseCursorForTesting = cursor; |
| 663 setCursor(WebCursorInfo(cursor)); | 664 if (!m_overrideCursor) |
| 665 setCursor(WebCursorInfo(cursor)); | |
| 664 } | 666 } |
| 665 | 667 |
| 666 void ChromeClientImpl::setCursor(const WebCursorInfo& cursor) | 668 void ChromeClientImpl::setCursor(const WebCursorInfo& cursor) |
| 667 { | 669 { |
| 668 #if OS(MACOSX) | 670 #if OS(MACOSX) |
| 669 // On Mac the mousemove event propagates to both the popup and main window. | 671 // On Mac the mousemove event propagates to both the popup and main window. |
| 670 // If a popup is open we don't want the main window to change the cursor. | 672 // If a popup is open we don't want the main window to change the cursor. |
| 671 if (m_webView->hasOpenedPopup()) | 673 if (m_webView->hasOpenedPopup()) |
| 672 return; | 674 return; |
| 673 #endif | 675 #endif |
| 674 if (m_webView->client()) | 676 if (m_webView->client()) |
| 675 m_webView->client()->didChangeCursor(cursor); | 677 m_webView->client()->didChangeCursor(cursor); |
| 676 } | 678 } |
| 677 | 679 |
| 678 void ChromeClientImpl::setCursorForPlugin(const WebCursorInfo& cursor) | 680 void ChromeClientImpl::setCursorForPlugin(const WebCursorInfo& cursor) |
| 679 { | 681 { |
| 680 setCursor(cursor); | 682 setCursor(cursor); |
| 681 } | 683 } |
| 682 | 684 |
| 685 void ChromeClientImpl::setCursorOverride(PassOwnPtr<Cursor> cursor) | |
| 686 { | |
| 687 m_overrideCursor = cursor; | |
| 688 if (m_overrideCursor) | |
|
pfeldman
2015/08/26 21:08:42
Why is this here? You should have stored exiting c
| |
| 689 setCursor(WebCursorInfo(*m_overrideCursor.get())); | |
| 690 else | |
| 691 setCursor(WebCursorInfo(pointerCursor())); | |
| 692 } | |
| 693 | |
| 683 void ChromeClientImpl::postAccessibilityNotification(AXObject* obj, AXObjectCach e::AXNotification notification) | 694 void ChromeClientImpl::postAccessibilityNotification(AXObject* obj, AXObjectCach e::AXNotification notification) |
| 684 { | 695 { |
| 685 // Alert assistive technology about the accessibility object notification. | 696 // Alert assistive technology about the accessibility object notification. |
| 686 if (!obj || !obj->document()) | 697 if (!obj || !obj->document()) |
| 687 return; | 698 return; |
| 688 | 699 |
| 689 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(obj->document()-> axObjectCacheOwner().frame()); | 700 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(obj->document()-> axObjectCacheOwner().frame()); |
| 690 if (webframe && webframe->client()) | 701 if (webframe && webframe->client()) |
| 691 webframe->client()->postAccessibilityEvent(WebAXObject(obj), toWebAXEven t(notification)); | 702 webframe->client()->postAccessibilityEvent(WebAXObject(obj), toWebAXEven t(notification)); |
| 692 } | 703 } |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 988 for (const auto& observer : observers) | 999 for (const auto& observer : observers) |
| 989 observer->willOpenPopup(); | 1000 observer->willOpenPopup(); |
| 990 } | 1001 } |
| 991 | 1002 |
| 992 FloatSize ChromeClientImpl::elasticOverscroll() const | 1003 FloatSize ChromeClientImpl::elasticOverscroll() const |
| 993 { | 1004 { |
| 994 return m_webView->elasticOverscroll(); | 1005 return m_webView->elasticOverscroll(); |
| 995 } | 1006 } |
| 996 | 1007 |
| 997 } // namespace blink | 1008 } // namespace blink |
| OLD | NEW |