+WebExternalPopupMenu* RenderFrameImpl::createExternalPopupMenu(
+ const WebPopupMenuInfo& popup_menu_info,
+ WebExternalPopupMenuClient* popup_menu_client) {
+#if defined(OS_MACOSX) || defined(OS_ANDROID)
+ // An IPC message is sent to the browser to build and display the actual
+ // popup. The user could have time to click a different select by the time
+ // the popup is shown. In that case external_popup_menu_ is non NULL.
+ // By returning NULL in that case, we instruct Blink to cancel that new
+ // popup. So from the user perspective, only the first one will show, and
+ // will have to close the first one before another one can be shown.
+ if (external_popup_menu_)
+ return NULL;
+ external_popup_menu_.reset(
+ new ExternalPopupMenu(this, popup_menu_info, popup_menu_client));
+ if (render_view_->screen_metrics_emulator_) {
+ render_view_->SetExternalPopupOriginAdjustmentsForEmulation(
+ external_popup_menu_.get(),
+ render_view_->screen_metrics_emulator_.get());
+ }
+ return external_popup_menu_.get();
+#else
+ return NULL;
+#endif
+}
+