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