OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PopupMenuImpl_h |
| 6 #define PopupMenuImpl_h |
| 7 |
| 8 #include "core/html/forms/PopupMenuClient.h" |
| 9 #include "core/page/PagePopupClient.h" |
| 10 #include "platform/PopupMenu.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class ChromeClientImpl; |
| 15 class PagePopup; |
| 16 class HTMLElement; |
| 17 class HTMLHRElement; |
| 18 class HTMLOptGroupElement; |
| 19 class HTMLOptionElement; |
| 20 |
| 21 class PopupMenuImpl final : public PopupMenu, public PagePopupClient { |
| 22 public: |
| 23 static PassRefPtrWillBeRawPtr<PopupMenuImpl> create(ChromeClientImpl*, Popup
MenuClient*); |
| 24 virtual ~PopupMenuImpl(); |
| 25 |
| 26 void dispose(); |
| 27 |
| 28 private: |
| 29 PopupMenuImpl(ChromeClientImpl*, PopupMenuClient*); |
| 30 |
| 31 void addOption(HTMLOptionElement&, SharedBuffer*); |
| 32 void addOptGroup(HTMLOptGroupElement&, SharedBuffer*); |
| 33 void addSeparator(HTMLHRElement&, SharedBuffer*); |
| 34 void addElementStyle(HTMLElement&, SharedBuffer*); |
| 35 |
| 36 // PopupMenu functions: |
| 37 void show(const FloatQuad& controlPosition, const IntSize& controlSize, int
index) override; |
| 38 void hide() override; |
| 39 void updateFromElement() override; |
| 40 void disconnectClient() override; |
| 41 |
| 42 // PagePopupClient functions: |
| 43 IntSize contentSize() override; |
| 44 void writeDocument(SharedBuffer*) override; |
| 45 void didWriteDocument(Document&) override; |
| 46 void setValueAndClosePopup(int, const String&) override; |
| 47 void setValue(const String&) override; |
| 48 void closePopup() override; |
| 49 Element& ownerElement() override; |
| 50 Locale& locale() override; |
| 51 void didClosePopup() override; |
| 52 |
| 53 ChromeClientImpl* m_chromeClient; |
| 54 PopupMenuClient* m_client; |
| 55 PagePopup* m_popup; |
| 56 // If >= 0, this is the index we should accept when the popup closes. |
| 57 // This is used for keyboard navigation, where we want the |
| 58 // text to change immediately but set the value on close. |
| 59 int m_indexToSetOnClose; |
| 60 }; |
| 61 |
| 62 } |
| 63 |
| 64 #endif // PopupMenuImpl_h |
OLD | NEW |