forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move KeyboardLayoutManager class to keyboard_layout_manager.*
BUG=NONE Review URL: https://codereview.chromium.org/195193003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258745 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
bshe@chromium.org
committed
Mar 22, 2014
1 parent
36829c3
commit 3d6b28e
Showing
7 changed files
with
127 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ui/keyboard/keyboard_layout_manager.h" | ||
|
||
#include "ui/keyboard/keyboard_controller.h" | ||
#include "ui/keyboard/keyboard_controller_proxy.h" | ||
#include "ui/keyboard/keyboard_util.h" | ||
|
||
namespace keyboard { | ||
|
||
// Overridden from aura::LayoutManager | ||
void KeyboardLayoutManager::OnWindowResized() { | ||
if (keyboard_ && !controller_->proxy()->resizing_from_contents()) | ||
ResizeKeyboardToDefault(keyboard_); | ||
} | ||
|
||
void KeyboardLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | ||
DCHECK(!keyboard_); | ||
keyboard_ = child; | ||
ResizeKeyboardToDefault(keyboard_); | ||
} | ||
|
||
void KeyboardLayoutManager::SetChildBounds(aura::Window* child, | ||
const gfx::Rect& requested_bounds) { | ||
// SetChildBounds can be invoked by resizing from the container or by | ||
// resizing from the contents (through window.resizeTo call in JS). | ||
// The flag resizing_from_contents() is used to determine the source of the | ||
// resize. | ||
if (controller_->proxy()->resizing_from_contents()) { | ||
controller_->NotifyKeyboardBoundsChanging(requested_bounds); | ||
SetChildBoundsDirect(child, requested_bounds); | ||
} | ||
} | ||
|
||
void KeyboardLayoutManager::ResizeKeyboardToDefault(aura::Window* child) { | ||
gfx::Rect keyboard_bounds = DefaultKeyboardBoundsFromWindowBounds( | ||
controller_->GetContainerWindow()->bounds()); | ||
SetChildBoundsDirect(child, keyboard_bounds); | ||
} | ||
|
||
} // namespace keyboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef UI_KEYBOARD_KEYBOARD_LAYOUT_MANAGER_H_ | ||
#define UI_KEYBOARD_KEYBOARD_LAYOUT_MANAGER_H_ | ||
|
||
#include "ui/aura/layout_manager.h" | ||
#include "ui/aura/window.h" | ||
|
||
namespace keyboard { | ||
|
||
class KeyboardController; | ||
|
||
// LayoutManager for the virtual keyboard container. Manages a single window | ||
// (the virtual keyboard) and keeps it positioned at the bottom of the | ||
// owner window. | ||
class KeyboardLayoutManager : public aura::LayoutManager { | ||
public: | ||
explicit KeyboardLayoutManager(KeyboardController* controller) | ||
: controller_(controller), keyboard_(NULL) { | ||
} | ||
|
||
// Overridden from aura::LayoutManager | ||
virtual void OnWindowResized() OVERRIDE; | ||
virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | ||
virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} | ||
virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE {} | ||
virtual void OnChildWindowVisibilityChanged(aura::Window* child, | ||
bool visible) OVERRIDE {} | ||
virtual void SetChildBounds(aura::Window* child, | ||
const gfx::Rect& requested_bounds) OVERRIDE; | ||
|
||
private: | ||
void ResizeKeyboardToDefault(aura::Window* child); | ||
|
||
KeyboardController* controller_; | ||
aura::Window* keyboard_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(KeyboardLayoutManager); | ||
}; | ||
|
||
} // namespace keyboard | ||
|
||
#endif // UI_KEYBOARD_KEYBOARD_LAYOUT_MANAGER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters