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

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

Issue 470193002: Set keyboard height to 0 before show a keyboard in a different extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 #include "ui/keyboard/keyboard_controller_proxy.h" 5 #include "ui/keyboard/keyboard_controller_proxy.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "content/public/browser/site_instance.h" 9 #include "content/public/browser/site_instance.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 if (keyboard_contents_->GetURL() != default_url_) { 162 if (keyboard_contents_->GetURL() != default_url_) {
163 // TODO(bshe): The height of system virtual keyboard and IME virtual 163 // TODO(bshe): The height of system virtual keyboard and IME virtual
164 // keyboard may different. The height needs to be restored too. 164 // keyboard may different. The height needs to be restored too.
165 LoadContents(default_url_); 165 LoadContents(default_url_);
166 } 166 }
167 } 167 }
168 168
169 void KeyboardControllerProxy::ReloadKeyboardIfNeeded() { 169 void KeyboardControllerProxy::ReloadKeyboardIfNeeded() {
170 DCHECK(keyboard_contents_); 170 DCHECK(keyboard_contents_);
171 if (keyboard_contents_->GetURL() != GetVirtualKeyboardUrl()) { 171 if (keyboard_contents_->GetURL() != GetVirtualKeyboardUrl()) {
172 if (keyboard_contents_->GetURL().GetOrigin() !=
173 GetVirtualKeyboardUrl().GetOrigin()) {
174 // Sets keyboard window height to 0 before navigate to a keyboard in a
175 // different extension. This keeps the UX the same as Android.
176 gfx::Rect bounds = GetKeyboardWindow()->bounds();
177 bounds.set_y(bounds.y() + bounds.height());
178 bounds.set_height(0);
179 GetKeyboardWindow()->SetBounds(bounds);
180 }
172 LoadContents(GetVirtualKeyboardUrl()); 181 LoadContents(GetVirtualKeyboardUrl());
173 } 182 }
174 } 183 }
175 184
176 void KeyboardControllerProxy::SetupWebContents(content::WebContents* contents) { 185 void KeyboardControllerProxy::SetupWebContents(content::WebContents* contents) {
177 } 186 }
178 187
179 void KeyboardControllerProxy::OnWindowBoundsChanged( 188 void KeyboardControllerProxy::OnWindowBoundsChanged(
180 aura::Window* window, 189 aura::Window* window,
181 const gfx::Rect& old_bounds, 190 const gfx::Rect& old_bounds,
182 const gfx::Rect& new_bounds) { 191 const gfx::Rect& new_bounds) {
183 if (!shadow_) { 192 if (!shadow_) {
184 shadow_.reset(new wm::Shadow()); 193 shadow_.reset(new wm::Shadow());
185 shadow_->Init(wm::Shadow::STYLE_ACTIVE); 194 shadow_->Init(wm::Shadow::STYLE_ACTIVE);
186 shadow_->layer()->SetVisible(true); 195 shadow_->layer()->SetVisible(true);
187 DCHECK(keyboard_contents_->GetNativeView()->parent()); 196 DCHECK(keyboard_contents_->GetNativeView()->parent());
188 keyboard_contents_->GetNativeView()->parent()->layer()->Add( 197 keyboard_contents_->GetNativeView()->parent()->layer()->Add(
189 shadow_->layer()); 198 shadow_->layer());
190 } 199 }
191 200
192 shadow_->SetContentBounds(new_bounds); 201 shadow_->SetContentBounds(new_bounds);
193 } 202 }
194 203
195 void KeyboardControllerProxy::OnWindowDestroyed(aura::Window* window) { 204 void KeyboardControllerProxy::OnWindowDestroyed(aura::Window* window) {
196 window->RemoveObserver(this); 205 window->RemoveObserver(this);
197 } 206 }
198 207
199 } // namespace keyboard 208 } // namespace keyboard
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698