OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_ASH_ASH_KEYBOARD_CONTROLLER_PROXY_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_ASH_KEYBOARD_CONTROLLER_PROXY_H_ |
6 #define CHROME_BROWSER_UI_ASH_ASH_KEYBOARD_CONTROLLER_PROXY_H_ | 6 #define CHROME_BROWSER_UI_ASH_ASH_KEYBOARD_CONTROLLER_PROXY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
11 #include "extensions/browser/extension_function_dispatcher.h" | |
12 #include "ui/keyboard/keyboard_controller_proxy.h" | 11 #include "ui/keyboard/keyboard_controller_proxy.h" |
13 | 12 |
14 namespace content { | 13 namespace content { |
15 class BrowserContext; | 14 class BrowserContext; |
16 class WebContents; | 15 class WebContents; |
17 } | 16 } |
18 namespace extensions { | 17 namespace extensions { |
19 class ExtensionFunctionDispatcher; | 18 class ExtensionFunctionDispatcher; |
20 class WindowController; | 19 class WindowController; |
21 } | 20 } |
22 namespace gfx { | 21 namespace gfx { |
23 class Rect; | 22 class Rect; |
24 } | 23 } |
25 namespace keyboard { | 24 namespace keyboard { |
26 class KeyboardController; | 25 class KeyboardController; |
27 class KeyboardControllerObserver; | 26 class KeyboardControllerObserver; |
28 } | 27 } |
29 namespace ui { | 28 namespace ui { |
30 class InputMethod; | 29 class InputMethod; |
31 } | 30 } |
32 | 31 |
33 // Subclass of KeyboardControllerProxy. It is used by KeyboardController to get | 32 // Subclass of KeyboardControllerProxy. It is used by KeyboardController to get |
34 // access to the virtual keyboard window and setup Chrome extension functions. | 33 // access to the virtual keyboard window and setup Chrome extension functions. |
35 class AshKeyboardControllerProxy | 34 class AshKeyboardControllerProxy |
36 : public keyboard::KeyboardControllerProxy, | 35 : public keyboard::KeyboardControllerProxy, |
37 public content::WebContentsObserver, | 36 public content::WebContentsObserver { |
38 public extensions::ExtensionFunctionDispatcher::Delegate { | |
39 public: | 37 public: |
40 explicit AshKeyboardControllerProxy(content::BrowserContext* context); | 38 explicit AshKeyboardControllerProxy(content::BrowserContext* context); |
41 ~AshKeyboardControllerProxy() override; | 39 ~AshKeyboardControllerProxy() override; |
42 | 40 |
43 private: | 41 private: |
44 void OnRequest(const ExtensionHostMsg_Request_Params& params); | |
45 | |
46 // keyboard::KeyboardControllerProxy overrides | 42 // keyboard::KeyboardControllerProxy overrides |
47 ui::InputMethod* GetInputMethod() override; | 43 ui::InputMethod* GetInputMethod() override; |
48 void RequestAudioInput( | 44 void RequestAudioInput( |
49 content::WebContents* web_contents, | 45 content::WebContents* web_contents, |
50 const content::MediaStreamRequest& request, | 46 const content::MediaStreamRequest& request, |
51 const content::MediaResponseCallback& callback) override; | 47 const content::MediaResponseCallback& callback) override; |
52 void SetupWebContents(content::WebContents* contents) override; | 48 void SetupWebContents(content::WebContents* contents) override; |
53 void SetController(keyboard::KeyboardController* controller) override; | 49 void SetController(keyboard::KeyboardController* controller) override; |
54 void ShowKeyboardContainer(aura::Window* container) override; | 50 void ShowKeyboardContainer(aura::Window* container) override; |
55 | 51 |
56 // The overridden implementation dispatches | 52 // The overridden implementation dispatches |
57 // chrome.virtualKeyboardPrivate.onTextInputBoxFocused event to extension to | 53 // chrome.virtualKeyboardPrivate.onTextInputBoxFocused event to extension to |
58 // provide the input type information. Naturally, when the virtual keyboard | 54 // provide the input type information. Naturally, when the virtual keyboard |
59 // extension is used as an IME then chrome.input.ime.onFocus provides the | 55 // extension is used as an IME then chrome.input.ime.onFocus provides the |
60 // information, but not when the virtual keyboard is used in conjunction with | 56 // information, but not when the virtual keyboard is used in conjunction with |
61 // another IME. virtualKeyboardPrivate.onTextInputBoxFocused is the remedy in | 57 // another IME. virtualKeyboardPrivate.onTextInputBoxFocused is the remedy in |
62 // that case. | 58 // that case. |
63 void SetUpdateInputType(ui::TextInputType type) override; | 59 void SetUpdateInputType(ui::TextInputType type) override; |
64 | 60 |
65 // extensions::ExtensionFunctionDispatcher::Delegate overrides | |
66 extensions::WindowController* GetExtensionWindowController() const override; | |
67 content::WebContents* GetAssociatedWebContents() const override; | |
68 | |
69 // content::WebContentsObserver overrides | 61 // content::WebContentsObserver overrides |
70 bool OnMessageReceived(const IPC::Message& message) override; | |
71 void RenderViewCreated(content::RenderViewHost* render_view_host) override; | 62 void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
72 | 63 |
73 keyboard::KeyboardController* keyboard_controller_; | 64 keyboard::KeyboardController* keyboard_controller_; |
74 | 65 |
75 scoped_ptr<extensions::ExtensionFunctionDispatcher> | |
76 extension_function_dispatcher_; | |
77 scoped_ptr<keyboard::KeyboardControllerObserver> observer_; | 66 scoped_ptr<keyboard::KeyboardControllerObserver> observer_; |
78 | 67 |
79 DISALLOW_COPY_AND_ASSIGN(AshKeyboardControllerProxy); | 68 DISALLOW_COPY_AND_ASSIGN(AshKeyboardControllerProxy); |
80 }; | 69 }; |
81 | 70 |
82 #endif // CHROME_BROWSER_UI_ASH_ASH_KEYBOARD_CONTROLLER_PROXY_H_ | 71 #endif // CHROME_BROWSER_UI_ASH_ASH_KEYBOARD_CONTROLLER_PROXY_H_ |
OLD | NEW |