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