1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_VR_PLATFORM_INPUT_HANDLER_H_ 6 #define CHROME_BROWSER_VR_PLATFORM_INPUT_HANDLER_H_ 7 8 #include "base/callback.h" 9 #include "chrome/browser/vr/text_edit_action.h" 10 11 namespace vr { 12 13 class InputEvent; 14 15 typedef typename base::OnceCallback<void(const base::string16&)> 16 TextStateUpdateCallback; 17 18 // This class defines input related interfaces which each platform should 19 // implement its own. 20 class PlatformInputHandler { 21 public: ~PlatformInputHandler()22 virtual ~PlatformInputHandler() {} 23 virtual void ForwardEventToPlatformUi(std::unique_ptr<InputEvent> event) = 0; 24 virtual void ForwardEventToContent(std::unique_ptr<InputEvent> event, 25 int content_id) = 0; 26 27 // Text input specific. 28 virtual void ClearFocusedElement() = 0; 29 virtual void OnWebInputEdited(const TextEdits& edits) = 0; 30 virtual void SubmitWebInput() = 0; 31 virtual void RequestWebInputText(TextStateUpdateCallback callback) = 0; 32 }; 33 34 } // namespace vr 35 36 #endif // CHROME_BROWSER_VR_PLATFORM_INPUT_HANDLER_H_ 37