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

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

Issue 97013002: [Input View] Makes the input view window support window.resizeTo() and w3c visibility API its web c… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years 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 | Annotate | Revision Log
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 #include "ui/keyboard/keyboard_controller_proxy.h" 5 #include "ui/keyboard/keyboard_controller_proxy.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "content/public/browser/site_instance.h" 8 #include "content/public/browser/site_instance.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // Overridden from content::WebContentsDelegate: 64 // Overridden from content::WebContentsDelegate:
65 virtual content::WebContents* OpenURLFromTab( 65 virtual content::WebContents* OpenURLFromTab(
66 content::WebContents* source, 66 content::WebContents* source,
67 const content::OpenURLParams& params) OVERRIDE { 67 const content::OpenURLParams& params) OVERRIDE {
68 source->GetController().LoadURL( 68 source->GetController().LoadURL(
69 params.url, params.referrer, params.transition, params.extra_headers); 69 params.url, params.referrer, params.transition, params.extra_headers);
70 Observe(source); 70 Observe(source);
71 return source; 71 return source;
72 } 72 }
73 73
74 virtual bool IsPopupOrPanel(const content::WebContents* source) const
75 OVERRIDE {
76 return true;
77 }
78
79 virtual void MoveContents(
80 content::WebContents* source, const gfx::Rect& pos) OVERRIDE {
81 aura::Window* keyboard = proxy_->GetKeyboardWindow();
82 gfx::Rect bounds = keyboard->bounds();
83 int new_height = pos.height();
84 bounds.set_y(bounds.y() + bounds.height() - new_height);
85 bounds.set_height(new_height);
86 // Records the keyboard new height. So that GetHitTestMask() can set the
87 // same keyboard bounds as the hit test mask.
kevers 2013/12/04 15:18:28 Nit: Obsolete comment. Please remove.
Shu Chen 2013/12/05 05:01:39 Done.
88 proxy_->set_resizing_from_contents(true);
89 keyboard->SetBounds(bounds);
90 }
91
74 // Overridden from content::WebContentsDelegate: 92 // Overridden from content::WebContentsDelegate:
75 virtual void RequestMediaAccessPermission(content::WebContents* web_contents, 93 virtual void RequestMediaAccessPermission(content::WebContents* web_contents,
76 const content::MediaStreamRequest& request, 94 const content::MediaStreamRequest& request,
77 const content::MediaResponseCallback& callback) OVERRIDE { 95 const content::MediaResponseCallback& callback) OVERRIDE {
78 proxy_->RequestAudioInput(web_contents, request, callback); 96 proxy_->RequestAudioInput(web_contents, request, callback);
79 } 97 }
80 98
81 99
82 // Overridden from content::WebContentsObserver: 100 // Overridden from content::WebContentsObserver:
83 virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE { 101 virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE {
84 delete this; 102 delete this;
85 } 103 }
86 104
87 keyboard::KeyboardControllerProxy* proxy_; 105 keyboard::KeyboardControllerProxy* proxy_;
88 106
89 DISALLOW_COPY_AND_ASSIGN(KeyboardContentsDelegate); 107 DISALLOW_COPY_AND_ASSIGN(KeyboardContentsDelegate);
90 }; 108 };
91 109
92 } // namespace 110 } // namespace
93 111
94 namespace keyboard { 112 namespace keyboard {
95 113
96 KeyboardControllerProxy::KeyboardControllerProxy() 114 KeyboardControllerProxy::KeyboardControllerProxy()
97 : default_url_(kKeyboardWebUIURL) { 115 : default_url_(kKeyboardWebUIURL), resizing_from_contents_(false) {
98 } 116 }
99 117
100 KeyboardControllerProxy::~KeyboardControllerProxy() { 118 KeyboardControllerProxy::~KeyboardControllerProxy() {
101 } 119 }
102 120
103 const GURL& KeyboardControllerProxy::GetValidUrl() { 121 const GURL& KeyboardControllerProxy::GetValidUrl() {
104 return override_url_.is_valid() ? override_url_ : default_url_; 122 return override_url_.is_valid() ? override_url_ : default_url_;
105 } 123 }
106 124
107 void KeyboardControllerProxy::SetOverrideContentUrl(const GURL& url) { 125 void KeyboardControllerProxy::SetOverrideContentUrl(const GURL& url) {
(...skipping 24 matching lines...) Expand all
132 content::SiteInstance::CreateForURL(context, GetValidUrl())))); 150 content::SiteInstance::CreateForURL(context, GetValidUrl()))));
133 keyboard_contents_->SetDelegate(new KeyboardContentsDelegate(this)); 151 keyboard_contents_->SetDelegate(new KeyboardContentsDelegate(this));
134 SetupWebContents(keyboard_contents_.get()); 152 SetupWebContents(keyboard_contents_.get());
135 ReloadContents(); 153 ReloadContents();
136 } 154 }
137 155
138 return keyboard_contents_->GetView()->GetNativeView(); 156 return keyboard_contents_->GetView()->GetNativeView();
139 } 157 }
140 158
141 void KeyboardControllerProxy::ShowKeyboardContainer(aura::Window* container) { 159 void KeyboardControllerProxy::ShowKeyboardContainer(aura::Window* container) {
160 GetKeyboardWindow()->Show();
142 container->Show(); 161 container->Show();
143 } 162 }
144 163
145 void KeyboardControllerProxy::HideKeyboardContainer(aura::Window* container) { 164 void KeyboardControllerProxy::HideKeyboardContainer(aura::Window* container) {
146 container->Hide(); 165 container->Hide();
166 GetKeyboardWindow()->Hide();
147 } 167 }
148 168
149 void KeyboardControllerProxy::SetUpdateInputType(ui::TextInputType type) { 169 void KeyboardControllerProxy::SetUpdateInputType(ui::TextInputType type) {
150 content::WebUI* webui = keyboard_contents_ ? 170 content::WebUI* webui = keyboard_contents_ ?
151 keyboard_contents_->GetCommittedWebUI() : NULL; 171 keyboard_contents_->GetCommittedWebUI() : NULL;
152 172
153 if (webui && 173 if (webui &&
154 (0 != (webui->GetBindings() & content::BINDINGS_POLICY_WEB_UI))) { 174 (0 != (webui->GetBindings() & content::BINDINGS_POLICY_WEB_UI))) {
155 // Only call OnTextInputBoxFocused function if it is a web ui keyboard, 175 // Only call OnTextInputBoxFocused function if it is a web ui keyboard,
156 // not an extension based keyboard. 176 // not an extension based keyboard.
157 base::DictionaryValue input_context; 177 base::DictionaryValue input_context;
158 input_context.SetString("type", TextInputTypeToString(type)); 178 input_context.SetString("type", TextInputTypeToString(type));
159 webui->CallJavascriptFunction("OnTextInputBoxFocused", input_context); 179 webui->CallJavascriptFunction("OnTextInputBoxFocused", input_context);
160 } 180 }
161 } 181 }
162 182
163 void KeyboardControllerProxy::SetupWebContents(content::WebContents* contents) { 183 void KeyboardControllerProxy::SetupWebContents(content::WebContents* contents) {
164 } 184 }
165 185
166 } // namespace keyboard 186 } // namespace keyboard
OLDNEW
« ui/keyboard/keyboard_controller.cc ('K') | « ui/keyboard/keyboard_controller_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698