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

Side by Side Diff: chrome/browser/chromeos/input_method/hidable_area.cc

Issue 121163003: Cleanup CandidateWindowView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 12 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
OLDNEW
(Empty)
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.
4
5 #include "chrome/browser/chromeos/input_method/hidable_area.h"
6
7 #include "ui/views/layout/fill_layout.h"
8
9 namespace chromeos {
10 namespace input_method {
11
12 HidableArea::HidableArea() {
13 place_holder_.reset(new views::View);
14 place_holder_->set_owned_by_client(); // Won't own
15
16 // Initially show nothing.
17 SetLayoutManager(new views::FillLayout);
18 AddChildView(place_holder_.get());
19 }
20
21 HidableArea::~HidableArea() {
22 }
23
24 void HidableArea::SetContents(views::View* contents) {
25 contents_.reset(contents);
26 contents_->set_owned_by_client(); // Won't own
27 }
28
29 void HidableArea::Show() {
30 if (contents_.get() && contents_->parent() != this) {
31 RemoveAllChildViews(false); // Don't delete child views.
32 AddChildView(contents_.get());
33 }
34 }
35
36 void HidableArea::Hide() {
37 if (IsShown()) {
38 RemoveAllChildViews(false); // Don't delete child views.
39 AddChildView(place_holder_.get());
40 }
41 }
42
43 bool HidableArea::IsShown() const {
44 return contents_.get() && contents_->parent() == this;
45 }
46
47 } // namespace input_method
48 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/hidable_area.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698