Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / web / PopupMenuImpl.h
blobb428f77f2301865da0169785eda0f7659d474eb4
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.
5 #ifndef PopupMenuImpl_h
6 #define PopupMenuImpl_h
8 #include "core/page/PagePopupClient.h"
9 #include "platform/PopupMenu.h"
11 namespace blink {
13 class ChromeClientImpl;
14 class PagePopup;
15 class HTMLElement;
16 class HTMLHRElement;
17 class HTMLOptGroupElement;
18 class HTMLOptionElement;
19 class HTMLSelectElement;
21 class PopupMenuImpl final : public PopupMenu, public PagePopupClient {
22 public:
23 static PassRefPtrWillBeRawPtr<PopupMenuImpl> create(ChromeClientImpl*, HTMLSelectElement&);
24 ~PopupMenuImpl() override;
25 DECLARE_VIRTUAL_TRACE();
27 void update();
29 void dispose();
31 private:
32 PopupMenuImpl(ChromeClientImpl*, HTMLSelectElement&);
34 class ItemIterationContext;
35 void addOption(ItemIterationContext&, HTMLOptionElement&);
36 void addOptGroup(ItemIterationContext&, HTMLOptGroupElement&);
37 void addSeparator(ItemIterationContext&, HTMLHRElement&);
38 void addElementStyle(ItemIterationContext&, HTMLElement&);
40 // PopupMenu functions:
41 void show(const FloatQuad& controlPosition, const IntSize& controlSize, int index) override;
42 void hide() override;
43 void disconnectClient() override;
44 void updateFromElement() override;
46 // PagePopupClient functions:
47 IntSize contentSize() override;
48 void writeDocument(SharedBuffer*) override;
49 void selectFontsFromOwnerDocument(Document&) override;
50 void setValueAndClosePopup(int, const String&) override;
51 void setValue(const String&) override;
52 void closePopup() override;
53 Element& ownerElement() override;
54 Locale& locale() override;
55 void didClosePopup() override;
57 ChromeClientImpl* m_chromeClient;
58 RawPtrWillBeMember<HTMLSelectElement> m_ownerElement;
59 PagePopup* m_popup;
60 bool m_needsUpdate;
65 #endif // PopupMenuImpl_h