Implement nacl_irt_memory for non-sfi mode.
[chromium-blink-merge.git] / ui / keyboard / keyboard_controller_proxy.h
blobc028b74ddcba4518b9a65e31208404e7e8d2593c
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"
13 namespace aura {
14 class Window;
16 namespace content {
17 class BrowserContext;
18 class SiteInstance;
19 class WebContents;
21 namespace gfx {
22 class Rect;
24 namespace ui {
25 class InputMethod;
28 namespace keyboard {
30 // A proxy used by the KeyboardController to get access to the virtual
31 // keyboard window.
32 class KEYBOARD_EXPORT KeyboardControllerProxy {
33 public:
34 KeyboardControllerProxy();
35 virtual ~KeyboardControllerProxy();
37 // Gets the virtual keyboard window. Ownership of the returned Window remains
38 // with the proxy.
39 virtual aura::Window* GetKeyboardWindow();
41 // Sets the override content url.
42 void SetOverrideContentUrl(const GURL& url);
44 // Whether the keyboard window is resizing from its web contents.
45 bool resizing_from_contents() const { return resizing_from_contents_; }
47 // Sets the flag of whether the keyboard window is resizing from
48 // its web contents.
49 void set_resizing_from_contents(bool resizing) {
50 resizing_from_contents_ = resizing;
53 // Gets the InputMethod that will provide notifications about changes in the
54 // text input context.
55 virtual ui::InputMethod* GetInputMethod() = 0;
57 // Requests the audio input from microphone for speech input.
58 virtual void RequestAudioInput(content::WebContents* web_contents,
59 const content::MediaStreamRequest& request,
60 const content::MediaResponseCallback& callback) = 0;
62 // Shows the container window of the keyboard. The default implementation
63 // simply shows the container. An overridden implementation can set up
64 // necessary animation, or delay the visibility change as it desires.
65 virtual void ShowKeyboardContainer(aura::Window* container);
67 // Hides the container window of the keyboard. The default implementation
68 // simply hides the container. An overridden implementation can set up
69 // necesasry animation, or delay the visibility change as it desires.
70 virtual void HideKeyboardContainer(aura::Window* container);
72 // Updates the type of the focused text input box. The default implementation
73 // calls OnTextInputBoxFocused javascript function through webui to update the
74 // type the of focused input box.
75 virtual void SetUpdateInputType(ui::TextInputType type);
77 protected:
78 // Gets the BrowserContext to use for creating the WebContents hosting the
79 // keyboard.
80 virtual content::BrowserContext* GetBrowserContext() = 0;
82 // The implementation can choose to setup the WebContents before the virtual
83 // keyboard page is loaded (e.g. install a WebContentsObserver).
84 // SetupWebContents() is called right after creating the WebContents, before
85 // loading the keyboard page.
86 virtual void SetupWebContents(content::WebContents* contents);
88 private:
89 // Reloads the web contents to the valid url from GetValidUrl().
90 void ReloadContents();
92 // Gets the valid url from default url or override url.
93 const GURL& GetValidUrl();
95 const GURL default_url_;
96 GURL override_url_;
98 scoped_ptr<content::WebContents> keyboard_contents_;
100 // Whether the current keyboard window is resizing from its web content.
101 bool resizing_from_contents_;
103 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerProxy);
106 } // namespace keyboard
108 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_