| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_EXTERNAL_POPUP_MENU_H_ | 5 #ifndef CONTENT_RENDERER_EXTERNAL_POPUP_MENU_H_ |
| 6 #define CONTENT_RENDERER_EXTERNAL_POPUP_MENU_H_ | 6 #define CONTENT_RENDERER_EXTERNAL_POPUP_MENU_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 public: | 24 public: |
| 25 ExternalPopupMenu(RenderFrameImpl* render_frame, | 25 ExternalPopupMenu(RenderFrameImpl* render_frame, |
| 26 const blink::WebPopupMenuInfo& popup_menu_info, | 26 const blink::WebPopupMenuInfo& popup_menu_info, |
| 27 blink::WebExternalPopupMenuClient* popup_menu_client); | 27 blink::WebExternalPopupMenuClient* popup_menu_client); |
| 28 | 28 |
| 29 virtual ~ExternalPopupMenu() {} | 29 virtual ~ExternalPopupMenu() {} |
| 30 | 30 |
| 31 void SetOriginScaleAndOffsetForEmulation( | 31 void SetOriginScaleAndOffsetForEmulation( |
| 32 float scale, const gfx::PointF& offset); | 32 float scale, const gfx::PointF& offset); |
| 33 | 33 |
| 34 #if defined(USE_EXTERNAL_POPUP_MENU) |
| 34 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
| 35 // Called when the user has selected an item. |selected_item| is -1 if the | 36 // Called when the user has selected an item. |selected_item| is -1 if the |
| 36 // user canceled the popup. | 37 // user canceled the popup. |
| 37 void DidSelectItem(int selected_index); | 38 void DidSelectItem(int selected_index); |
| 38 #endif | 39 #else |
| 39 | |
| 40 #if defined(OS_ANDROID) | |
| 41 // Called when the user has selected items or canceled the popup. | 40 // Called when the user has selected items or canceled the popup. |
| 42 void DidSelectItems(bool canceled, const std::vector<int>& selected_indices); | 41 void DidSelectItems(bool canceled, const std::vector<int>& selected_indices); |
| 43 #endif | 42 #endif |
| 43 #endif |
| 44 | 44 |
| 45 // blink::WebExternalPopupMenu implementation: | 45 // blink::WebExternalPopupMenu implementation: |
| 46 void show(const blink::WebRect& bounds) override; | 46 void show(const blink::WebRect& bounds) override; |
| 47 void close() override; | 47 void close() override; |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 RenderFrameImpl* render_frame_; | 50 RenderFrameImpl* render_frame_; |
| 51 blink::WebPopupMenuInfo popup_menu_info_; | 51 blink::WebPopupMenuInfo popup_menu_info_; |
| 52 blink::WebExternalPopupMenuClient* popup_menu_client_; | 52 blink::WebExternalPopupMenuClient* popup_menu_client_; |
| 53 | 53 |
| 54 // Popups may be displaced when screen metrics emulation is enabled. | 54 // Popups may be displaced when screen metrics emulation is enabled. |
| 55 // These scale and offset are used to properly adjust popup position. | 55 // These scale and offset are used to properly adjust popup position. |
| 56 float origin_scale_for_emulation_; | 56 float origin_scale_for_emulation_; |
| 57 gfx::PointF origin_offset_for_emulation_; | 57 gfx::PointF origin_offset_for_emulation_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(ExternalPopupMenu); | 59 DISALLOW_COPY_AND_ASSIGN(ExternalPopupMenu); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace content | 62 } // namespace content |
| 63 | 63 |
| 64 #endif // CONTENT_RENDERER_EXTERNAL_POPUP_MENU_H_ | 64 #endif // CONTENT_RENDERER_EXTERNAL_POPUP_MENU_H_ |
| OLD | NEW |