OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 21 matching lines...) Expand all Loading... |
32 #define ExternalPopupMenu_h | 32 #define ExternalPopupMenu_h |
33 | 33 |
34 #include "platform/PopupMenu.h" | 34 #include "platform/PopupMenu.h" |
35 #include "platform/Timer.h" | 35 #include "platform/Timer.h" |
36 #include "public/platform/WebCanvas.h" | 36 #include "public/platform/WebCanvas.h" |
37 #include "public/platform/WebScrollbar.h" | 37 #include "public/platform/WebScrollbar.h" |
38 #include "public/web/WebExternalPopupMenuClient.h" | 38 #include "public/web/WebExternalPopupMenuClient.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class FloatQuad; | |
43 class HTMLSelectElement; | 42 class HTMLSelectElement; |
44 class IntSize; | |
45 class LocalFrame; | 43 class LocalFrame; |
46 class WebExternalPopupMenu; | 44 class WebExternalPopupMenu; |
47 class WebMouseEvent; | 45 class WebMouseEvent; |
48 class WebViewImpl; | 46 class WebViewImpl; |
49 struct WebPopupMenuInfo; | 47 struct WebPopupMenuInfo; |
50 | 48 |
51 // The ExternalPopupMenu connects the actual implementation of the popup menu | 49 // The ExternalPopupMenu connects the actual implementation of the popup menu |
52 // to the WebCore popup menu. | 50 // to the WebCore popup menu. |
53 class ExternalPopupMenu final : public PopupMenu, public WebExternalPopupMenuCli
ent { | 51 class ExternalPopupMenu final : public PopupMenu, public WebExternalPopupMenuCli
ent { |
54 public: | 52 public: |
55 ExternalPopupMenu(LocalFrame&, HTMLSelectElement&, WebViewImpl&); | 53 ExternalPopupMenu(LocalFrame&, HTMLSelectElement&, WebViewImpl&); |
56 ~ExternalPopupMenu() override; | 54 ~ExternalPopupMenu() override; |
57 | 55 |
58 // Fills |info| with the popup menu information contained in the | 56 // Fills |info| with the popup menu information contained in the |
59 // PopupMenuClient associated with this ExternalPopupMenu. | 57 // PopupMenuClient associated with this ExternalPopupMenu. |
60 // FIXME: public only for test access. Need to revert once gtest | 58 // FIXME: public only for test access. Need to revert once gtest |
61 // helpers from chromium are available for blink. | 59 // helpers from chromium are available for blink. |
62 static void getPopupMenuInfo(WebPopupMenuInfo&, HTMLSelectElement&); | 60 static void getPopupMenuInfo(WebPopupMenuInfo&, HTMLSelectElement&); |
63 static int toPopupMenuItemIndex(int index, HTMLSelectElement&); | 61 static int toPopupMenuItemIndex(int index, HTMLSelectElement&); |
64 static int toExternalPopupMenuItemIndex(int index, HTMLSelectElement&); | 62 static int toExternalPopupMenuItemIndex(int index, HTMLSelectElement&); |
65 | 63 |
66 DECLARE_VIRTUAL_TRACE(); | 64 DECLARE_VIRTUAL_TRACE(); |
67 | 65 |
68 private: | 66 private: |
69 // PopupMenu methods: | 67 // PopupMenu methods: |
70 void show(const FloatQuad& controlPosition, const IntSize&, int index) overr
ide; | 68 void show() override; |
71 void hide() override; | 69 void hide() override; |
72 void updateFromElement() override; | 70 void updateFromElement() override; |
73 void disconnectClient() override; | 71 void disconnectClient() override; |
74 | 72 |
75 // WebExternalPopupClient methods: | 73 // WebExternalPopupClient methods: |
76 void didChangeSelection(int index) override; | 74 void didChangeSelection(int index) override; |
77 void didAcceptIndex(int index) override; | 75 void didAcceptIndex(int index) override; |
78 void didAcceptIndices(const WebVector<int>& indices) override; | 76 void didAcceptIndices(const WebVector<int>& indices) override; |
79 void didCancel() override; | 77 void didCancel() override; |
80 | 78 |
81 bool showInternal(); | 79 bool showInternal(); |
82 void dispatchEvent(Timer<ExternalPopupMenu>*); | 80 void dispatchEvent(Timer<ExternalPopupMenu>*); |
83 void update(); | 81 void update(); |
84 | 82 |
85 RawPtrWillBeMember<HTMLSelectElement> m_ownerElement; | 83 RawPtrWillBeMember<HTMLSelectElement> m_ownerElement; |
86 RefPtrWillBeMember<LocalFrame> m_localFrame; | 84 RefPtrWillBeMember<LocalFrame> m_localFrame; |
87 WebViewImpl& m_webView; | 85 WebViewImpl& m_webView; |
88 OwnPtr<WebMouseEvent> m_syntheticEvent; | 86 OwnPtr<WebMouseEvent> m_syntheticEvent; |
89 Timer<ExternalPopupMenu> m_dispatchEventTimer; | 87 Timer<ExternalPopupMenu> m_dispatchEventTimer; |
90 // The actual implementor of the show menu. | 88 // The actual implementor of the show menu. |
91 WebExternalPopupMenu* m_webExternalPopupMenu; | 89 WebExternalPopupMenu* m_webExternalPopupMenu; |
92 bool m_needsUpdate = false; | 90 bool m_needsUpdate = false; |
93 }; | 91 }; |
94 | 92 |
95 } // namespace blink | 93 } // namespace blink |
96 | 94 |
97 #endif // ExternalPopupMenu_h | 95 #endif // ExternalPopupMenu_h |
OLD | NEW |