Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: ui/keyboard/keyboard_controller_proxy.h

Issue 1128173003: Implements onBoundsChanged event in virtualKeyboardPrivate namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/keyboard/keyboard_controller.cc ('k') | ui/keyboard/keyboard_controller_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/aura/window_observer.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 namespace ui { 25 namespace ui {
26 class InputMethod; 26 class InputMethod;
27 } 27 }
28 namespace wm { 28 namespace wm {
29 class Shadow; 29 class Shadow;
30 } 30 }
31 31
32 namespace keyboard { 32 namespace keyboard {
33 33
34 class KeyboardController;
35
34 // A proxy used by the KeyboardController to get access to the virtual 36 // A proxy used by the KeyboardController to get access to the virtual
35 // keyboard window. 37 // keyboard window.
36 class KEYBOARD_EXPORT KeyboardControllerProxy : public aura::WindowObserver { 38 class KEYBOARD_EXPORT KeyboardControllerProxy : public aura::WindowObserver {
37 public: 39 public:
38 class TestApi { 40 class TestApi {
39 public: 41 public:
40 explicit TestApi(KeyboardControllerProxy* proxy) : proxy_(proxy) {} 42 explicit TestApi(KeyboardControllerProxy* proxy) : proxy_(proxy) {}
41 43
42 const content::WebContents* keyboard_contents() { 44 const content::WebContents* keyboard_contents() {
43 return proxy_->keyboard_contents_.get(); 45 return proxy_->keyboard_contents_.get();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // different. The URL can be different if user switch from password field to 96 // different. The URL can be different if user switch from password field to
95 // any other type input field. 97 // any other type input field.
96 // At password field, the system virtual keyboard is forced to load even if 98 // At password field, the system virtual keyboard is forced to load even if
97 // the current IME provides a customized virtual keyboard. This is needed to 99 // the current IME provides a customized virtual keyboard. This is needed to
98 // prevent IME virtual keyboard logging user's password. Once user switch to 100 // prevent IME virtual keyboard logging user's password. Once user switch to
99 // other input fields, the virtual keyboard should switch back to the IME 101 // other input fields, the virtual keyboard should switch back to the IME
100 // provided keyboard, or keep using the system virtual keyboard if IME doesn't 102 // provided keyboard, or keep using the system virtual keyboard if IME doesn't
101 // provide one. 103 // provide one.
102 virtual void ReloadKeyboardIfNeeded(); 104 virtual void ReloadKeyboardIfNeeded();
103 105
106 virtual void SetController(KeyboardController* controller);
107
104 protected: 108 protected:
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
111 // aura::WindowObserver overrides: 115 // aura::WindowObserver overrides:
112 void OnWindowBoundsChanged(aura::Window* window, 116 void OnWindowBoundsChanged(aura::Window* window,
113 const gfx::Rect& old_bounds, 117 const gfx::Rect& old_bounds,
114 const gfx::Rect& new_bounds) override; 118 const gfx::Rect& new_bounds) override;
115 void OnWindowDestroyed(aura::Window* window) override; 119 void OnWindowDestroyed(aura::Window* window) override;
116 120
117 content::BrowserContext* browser_context() { return browser_context_; } 121 content::BrowserContext* browser_context() { return browser_context_; }
122 KeyboardController* keyboard_controller() { return keyboard_controller_; }
118 123
119 private: 124 private:
120 friend class TestApi; 125 friend class TestApi;
121 126
122 // Loads the web contents for the given |url|. 127 // Loads the web contents for the given |url|.
123 void LoadContents(const GURL& url); 128 void LoadContents(const GURL& url);
124 129
125 // Gets the virtual keyboard URL (either the default URL or IME override URL). 130 // Gets the virtual keyboard URL (either the default URL or IME override URL).
126 const GURL& GetVirtualKeyboardUrl(); 131 const GURL& GetVirtualKeyboardUrl();
127 132
128 // The BrowserContext to use for creating the WebContents hosting the 133 // The BrowserContext to use for creating the WebContents hosting the
129 // keyboard. 134 // keyboard.
130 content::BrowserContext* browser_context_; 135 content::BrowserContext* browser_context_;
131 136
137 KeyboardController* keyboard_controller_;
138
sadrul 2015/05/13 16:47:30 There's no reason for the default impl here to sto
bshe 2015/05/13 18:30:03 Correct. I have changed the code according to your
132 const GURL default_url_; 139 const GURL default_url_;
133 140
134 scoped_ptr<content::WebContents> keyboard_contents_; 141 scoped_ptr<content::WebContents> keyboard_contents_;
135 scoped_ptr<wm::Shadow> shadow_; 142 scoped_ptr<wm::Shadow> shadow_;
136 143
137 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerProxy); 144 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerProxy);
138 }; 145 };
139 146
140 } // namespace keyboard 147 } // namespace keyboard
141 148
142 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ 149 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_
OLDNEW
« no previous file with comments | « ui/keyboard/keyboard_controller.cc ('k') | ui/keyboard/keyboard_controller_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698