1 // Copyright (c) 2013 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.
5 #ifndef UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_
6 #define UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/public/common/media_stream_request.h"
10 #include "ui/base/ime/text_input_type.h"
11 #include "ui/keyboard/keyboard_export.h"
30 // A proxy used by the KeyboardController to get access to the virtual
32 class KEYBOARD_EXPORT KeyboardControllerProxy {
34 KeyboardControllerProxy();
35 virtual ~KeyboardControllerProxy();
37 // Gets the virtual keyboard window. Ownership of the returned Window remains
39 virtual aura::Window* GetKeyboardWindow();
41 // Gets the InputMethod that will provide notifications about changes in the
42 // text input context.
43 virtual ui::InputMethod* GetInputMethod() = 0;
45 // Requests the audio input from microphone for speech input.
46 virtual void RequestAudioInput(content::WebContents* web_contents,
47 const content::MediaStreamRequest& request,
48 const content::MediaResponseCallback& callback) = 0;
50 // Shows the container window of the keyboard. The default implementation
51 // simply shows the container. An overridden implementation can set up
52 // necessary animation, or delay the visibility change as it desires.
53 virtual void ShowKeyboardContainer(aura::Window* container);
55 // Hides the container window of the keyboard. The default implementation
56 // simply hides the container. An overridden implementation can set up
57 // necesasry animation, or delay the visibility change as it desires.
58 virtual void HideKeyboardContainer(aura::Window* container);
60 // Updates the type of the focused text input box. The default implementation
61 // calls OnTextInputBoxFocused javascript function through webui to update the
62 // type the of focused input box.
63 virtual void SetUpdateInputType(ui::TextInputType type);
66 // Gets the BrowserContext to use for creating the WebContents hosting the
68 virtual content::BrowserContext* GetBrowserContext() = 0;
70 // The implementation can choose to setup the WebContents before the virtual
71 // keyboard page is loaded (e.g. install a WebContentsObserver).
72 // SetupWebContents() is called right after creating the WebContents, before
73 // loading the keyboard page.
74 virtual void SetupWebContents(content::WebContents* contents);
77 scoped_ptr<content::WebContents> keyboard_contents_;
79 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerProxy);
82 } // namespace keyboard
84 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_