Prepare VR UI for move into DFM

This change yields two different VR UI factories - one for APKs and one
for bundles (when a GN arg for native VR modularization is enabled).

The bundle factory opens the DFM-delivered VR UI library, uses dlsym()
to fish out a factory method, and uses it to create a UI.  The regular
factory just creates a UI instance.

The implementation of the factory is a dependency of the main library,
rather than part of the VR dependency tree, because we need to know at
build time which one to include.

This change also moves headers that were in the UI's implementation, but
used outside the UI.

BUG=921663

Change-Id: I11d541c241155b85d8b66f80e83d4a3c30946702
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1481891
Commit-Queue: Christopher Grant <[email protected]>
Reviewed-by: Christopher Grant <[email protected]>
Reviewed-by: Bill Orr <[email protected]>
Reviewed-by: Andrew Grieve <[email protected]>
Reviewed-by: Tibor Goldschwendt <[email protected]>
Cr-Commit-Position: refs/heads/master@{#637458}
diff --git a/chrome/browser/vr/ui_interface.h b/chrome/browser/vr/ui_interface.h
index dec99a7..e9218880 100644
--- a/chrome/browser/vr/ui_interface.h
+++ b/chrome/browser/vr/ui_interface.h
@@ -22,13 +22,19 @@
 
 namespace vr {
 
+class AudioDelegate;
 class BrowserUiInterface;
 class InputEvent;
+class KeyboardDelegate;
+class PlatformInputHandler;
 class PlatformUiInputDelegate;
 class SchedulerUiInterface;
+class TextInputDelegate;
+class UiBrowserInterface;
 struct ControllerModel;
 struct RenderInfo;
 struct ReticleModel;
+struct UiInitialState;
 enum class UserFriendlyElementName;
 
 using InputEventList = std::vector<std::unique_ptr<InputEvent>>;
@@ -115,6 +121,17 @@
       float z_near) = 0;
 };
 
+// After obtaining a void pointer to CreateUi() via dlsym, the resulting pointer
+// should be cast to this type.  Hence, the arguments in this type must exactly
+// match the actual CreateUi method.
+typedef UiInterface* CreateUiFunction(
+    UiBrowserInterface* browser,
+    PlatformInputHandler* content_input_forwarder,
+    std::unique_ptr<KeyboardDelegate> keyboard_delegate,
+    std::unique_ptr<TextInputDelegate> text_input_delegate,
+    std::unique_ptr<AudioDelegate> audio_delegate,
+    const UiInitialState& ui_initial_state);
+
 }  // namespace vr
 
 #endif  // CHROME_BROWSER_VR_UI_INTERFACE_H_