1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/input_method/hidable_area.h"
7 #include "ui/views/layout/fill_layout.h"
10 namespace input_method
{
12 HidableArea::HidableArea() {
13 place_holder_
.reset(new views::View
);
14 place_holder_
->set_owned_by_client(); // Won't own
16 // Initially show nothing.
17 SetLayoutManager(new views::FillLayout
);
18 AddChildView(place_holder_
.get());
21 HidableArea::~HidableArea() {
24 void HidableArea::SetContents(views::View
* contents
) {
25 contents_
.reset(contents
);
26 contents_
->set_owned_by_client(); // Won't own
29 void HidableArea::Show() {
30 if (contents_
.get() && contents_
->parent() != this) {
31 RemoveAllChildViews(false); // Don't delete child views.
32 AddChildView(contents_
.get());
36 void HidableArea::Hide() {
38 RemoveAllChildViews(false); // Don't delete child views.
39 AddChildView(place_holder_
.get());
43 bool HidableArea::IsShown() const {
44 return contents_
.get() && contents_
->parent() == this;
47 } // namespace input_method
48 } // namespace chromeos