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