| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 class WebExternalPopupMenu; | 46 class WebExternalPopupMenu; |
| 47 class WebMouseEvent; | 47 class WebMouseEvent; |
| 48 class WebViewImpl; | 48 class WebViewImpl; |
| 49 struct WebPopupMenuInfo; | 49 struct WebPopupMenuInfo; |
| 50 | 50 |
| 51 // The ExternalPopupMenu connects the actual implementation of the popup menu | 51 // The ExternalPopupMenu connects the actual implementation of the popup menu |
| 52 // to the WebCore popup menu. | 52 // to the WebCore popup menu. |
| 53 class ExternalPopupMenu final : public PopupMenu, public WebExternalPopupMenuCli
ent { | 53 class ExternalPopupMenu final : public PopupMenu, public WebExternalPopupMenuCli
ent { |
| 54 public: | 54 public: |
| 55 ExternalPopupMenu(LocalFrame&, PopupMenuClient*, WebViewImpl&); | 55 ExternalPopupMenu(LocalFrame&, PopupMenuClient*, WebViewImpl&); |
| 56 virtual ~ExternalPopupMenu(); | 56 ~ExternalPopupMenu() override; |
| 57 | 57 |
| 58 // Fills |info| with the popup menu information contained in the | 58 // Fills |info| with the popup menu information contained in the |
| 59 // PopupMenuClient associated with this ExternalPopupMenu. | 59 // PopupMenuClient associated with this ExternalPopupMenu. |
| 60 // FIXME: public only for test access. Need to revert once gtest | 60 // FIXME: public only for test access. Need to revert once gtest |
| 61 // helpers from chromium are available for blink. | 61 // helpers from chromium are available for blink. |
| 62 static void getPopupMenuInfo(WebPopupMenuInfo&, PopupMenuClient&); | 62 static void getPopupMenuInfo(WebPopupMenuInfo&, PopupMenuClient&); |
| 63 static int toPopupMenuItemIndex(int index, PopupMenuClient&); | 63 static int toPopupMenuItemIndex(int index, PopupMenuClient&); |
| 64 static int toExternalPopupMenuItemIndex(int index, PopupMenuClient&); | 64 static int toExternalPopupMenuItemIndex(int index, PopupMenuClient&); |
| 65 | 65 |
| 66 DECLARE_VIRTUAL_TRACE(); | 66 DECLARE_VIRTUAL_TRACE(); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 // PopupMenu methods: | 69 // PopupMenu methods: |
| 70 virtual void show(const FloatQuad& controlPosition, const IntSize&, int inde
x) override; | 70 void show(const FloatQuad& controlPosition, const IntSize&, int index) overr
ide; |
| 71 virtual void hide() override; | 71 void hide() override; |
| 72 virtual void updateFromElement() override; | 72 void updateFromElement() override; |
| 73 virtual void disconnectClient() override; | 73 void disconnectClient() override; |
| 74 | 74 |
| 75 // WebExternalPopupClient methods: | 75 // WebExternalPopupClient methods: |
| 76 virtual void didChangeSelection(int index) override; | 76 void didChangeSelection(int index) override; |
| 77 virtual void didAcceptIndex(int index) override; | 77 void didAcceptIndex(int index) override; |
| 78 virtual void didAcceptIndices(const WebVector<int>& indices) override; | 78 void didAcceptIndices(const WebVector<int>& indices) override; |
| 79 virtual void didCancel() override; | 79 void didCancel() override; |
| 80 | 80 |
| 81 void dispatchEvent(Timer<ExternalPopupMenu>*); | 81 void dispatchEvent(Timer<ExternalPopupMenu>*); |
| 82 | 82 |
| 83 PopupMenuClient* m_popupMenuClient; | 83 PopupMenuClient* m_popupMenuClient; |
| 84 RefPtrWillBeMember<LocalFrame> m_localFrame; | 84 RefPtrWillBeMember<LocalFrame> m_localFrame; |
| 85 WebViewImpl& m_webView; | 85 WebViewImpl& m_webView; |
| 86 OwnPtr<WebMouseEvent> m_syntheticEvent; | 86 OwnPtr<WebMouseEvent> m_syntheticEvent; |
| 87 Timer<ExternalPopupMenu> m_dispatchEventTimer; | 87 Timer<ExternalPopupMenu> m_dispatchEventTimer; |
| 88 // The actual implementor of the show menu. | 88 // The actual implementor of the show menu. |
| 89 WebExternalPopupMenu* m_webExternalPopupMenu; | 89 WebExternalPopupMenu* m_webExternalPopupMenu; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace blink | 92 } // namespace blink |
| 93 | 93 |
| 94 #endif // ExternalPopupMenu_h | 94 #endif // ExternalPopupMenu_h |
| OLD | NEW |