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"
13 class ChromeClientImpl
;
17 class HTMLOptGroupElement
;
18 class HTMLOptionElement
;
19 class HTMLSelectElement
;
21 class PopupMenuImpl final
: public PopupMenu
, public PagePopupClient
{
23 static PassRefPtrWillBeRawPtr
<PopupMenuImpl
> create(ChromeClientImpl
*, HTMLSelectElement
&);
24 ~PopupMenuImpl() override
;
25 DECLARE_VIRTUAL_TRACE();
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
;
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
;
65 #endif // PopupMenuImpl_h