| 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 UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ | 5 #ifndef UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ |
| 6 #define UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ | 6 #define UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/public/common/media_stream_request.h" | 9 #include "content/public/common/media_stream_request.h" |
| 10 #include "ui/aura/window_observer.h" |
| 10 #include "ui/base/ime/text_input_type.h" | 11 #include "ui/base/ime/text_input_type.h" |
| 11 #include "ui/keyboard/keyboard_export.h" | 12 #include "ui/keyboard/keyboard_export.h" |
| 12 | 13 |
| 13 namespace aura { | 14 namespace aura { |
| 14 class Window; | 15 class Window; |
| 15 } | 16 } |
| 16 namespace content { | 17 namespace content { |
| 17 class BrowserContext; | 18 class BrowserContext; |
| 18 class SiteInstance; | 19 class SiteInstance; |
| 19 class WebContents; | 20 class WebContents; |
| 20 } | 21 } |
| 21 namespace gfx { | 22 namespace gfx { |
| 22 class Rect; | 23 class Rect; |
| 23 } | 24 } |
| 24 namespace ui { | 25 namespace ui { |
| 25 class InputMethod; | 26 class InputMethod; |
| 26 } | 27 } |
| 28 namespace wm { |
| 29 class Shadow; |
| 30 } |
| 27 | 31 |
| 28 namespace keyboard { | 32 namespace keyboard { |
| 29 | 33 |
| 30 // A proxy used by the KeyboardController to get access to the virtual | 34 // A proxy used by the KeyboardController to get access to the virtual |
| 31 // keyboard window. | 35 // keyboard window. |
| 32 class KEYBOARD_EXPORT KeyboardControllerProxy { | 36 class KEYBOARD_EXPORT KeyboardControllerProxy : public aura::WindowObserver { |
| 33 public: | 37 public: |
| 34 class TestApi { | 38 class TestApi { |
| 35 public: | 39 public: |
| 36 explicit TestApi(KeyboardControllerProxy* proxy) : proxy_(proxy) {} | 40 explicit TestApi(KeyboardControllerProxy* proxy) : proxy_(proxy) {} |
| 37 | 41 |
| 38 const content::WebContents* keyboard_contents() { | 42 const content::WebContents* keyboard_contents() { |
| 39 return proxy_->keyboard_contents_.get(); | 43 return proxy_->keyboard_contents_.get(); |
| 40 } | 44 } |
| 41 | 45 |
| 42 private: | 46 private: |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // Gets the BrowserContext to use for creating the WebContents hosting the | 105 // Gets the BrowserContext to use for creating the WebContents hosting the |
| 102 // keyboard. | 106 // keyboard. |
| 103 virtual content::BrowserContext* GetBrowserContext() = 0; | 107 virtual content::BrowserContext* GetBrowserContext() = 0; |
| 104 | 108 |
| 105 // The implementation can choose to setup the WebContents before the virtual | 109 // The implementation can choose to setup the WebContents before the virtual |
| 106 // keyboard page is loaded (e.g. install a WebContentsObserver). | 110 // keyboard page is loaded (e.g. install a WebContentsObserver). |
| 107 // SetupWebContents() is called right after creating the WebContents, before | 111 // SetupWebContents() is called right after creating the WebContents, before |
| 108 // loading the keyboard page. | 112 // loading the keyboard page. |
| 109 virtual void SetupWebContents(content::WebContents* contents); | 113 virtual void SetupWebContents(content::WebContents* contents); |
| 110 | 114 |
| 115 // aura::WindowObserver overrides: |
| 116 virtual void OnWindowBoundsChanged(aura::Window* window, |
| 117 const gfx::Rect& old_bounds, |
| 118 const gfx::Rect& new_bounds) OVERRIDE; |
| 119 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
| 120 |
| 111 private: | 121 private: |
| 112 friend class TestApi; | 122 friend class TestApi; |
| 113 | 123 |
| 114 // Loads the web contents for the given |url|. | 124 // Loads the web contents for the given |url|. |
| 115 void LoadContents(const GURL& url); | 125 void LoadContents(const GURL& url); |
| 116 | 126 |
| 117 // Gets the virtual keyboard URL (either the default URL or IME override URL). | 127 // Gets the virtual keyboard URL (either the default URL or IME override URL). |
| 118 const GURL& GetVirtualKeyboardUrl(); | 128 const GURL& GetVirtualKeyboardUrl(); |
| 119 | 129 |
| 120 const GURL default_url_; | 130 const GURL default_url_; |
| 121 | 131 |
| 122 scoped_ptr<content::WebContents> keyboard_contents_; | 132 scoped_ptr<content::WebContents> keyboard_contents_; |
| 133 scoped_ptr<wm::Shadow> shadow_; |
| 123 | 134 |
| 124 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerProxy); | 135 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerProxy); |
| 125 }; | 136 }; |
| 126 | 137 |
| 127 } // namespace keyboard | 138 } // namespace keyboard |
| 128 | 139 |
| 129 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ | 140 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ |
| OLD | NEW |