| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/chromeos/input_method/candidate_window.h" | 5 #include "chrome/browser/chromeos/input_method/candidate_window.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 public: | 333 public: |
| 334 HidableArea() { | 334 HidableArea() { |
| 335 // |place_holder_| will be deleted by scoped_ptr, rather than | 335 // |place_holder_| will be deleted by scoped_ptr, rather than |
| 336 // the standard owning relation of views::View. | 336 // the standard owning relation of views::View. |
| 337 // | 337 // |
| 338 // This is because we swap the contents of HidableArea between | 338 // This is because we swap the contents of HidableArea between |
| 339 // |place_holder_| (to show nothing) and |contents_| (to show something). | 339 // |place_holder_| (to show nothing) and |contents_| (to show something). |
| 340 // In other words, the HidableArea only contains one of the two views | 340 // In other words, the HidableArea only contains one of the two views |
| 341 // hence cannot own the two views at the same time. | 341 // hence cannot own the two views at the same time. |
| 342 place_holder_.reset(new views::View); | 342 place_holder_.reset(new views::View); |
| 343 place_holder_->set_parent_owned(false); // Won't own | 343 place_holder_->set_owned_by_client(); // Won't own |
| 344 | 344 |
| 345 // Initially show nothing. | 345 // Initially show nothing. |
| 346 SetLayoutManager(new views::FillLayout); | 346 SetLayoutManager(new views::FillLayout); |
| 347 AddChildView(place_holder_.get()); | 347 AddChildView(place_holder_.get()); |
| 348 } | 348 } |
| 349 | 349 |
| 350 // Sets the content view. | 350 // Sets the content view. |
| 351 void SetContents(views::View* contents) { | 351 void SetContents(views::View* contents) { |
| 352 contents_.reset(contents); | 352 contents_.reset(contents); |
| 353 contents_->set_parent_owned(false); // Won't own | 353 contents_->set_owned_by_client(); // Won't own |
| 354 } | 354 } |
| 355 | 355 |
| 356 // Shows the content. | 356 // Shows the content. |
| 357 void Show() { | 357 void Show() { |
| 358 if (contents_.get() && contents_->parent() != this) { | 358 if (contents_.get() && contents_->parent() != this) { |
| 359 RemoveAllChildViews(false); // Don't delete child views. | 359 RemoveAllChildViews(false); // Don't delete child views. |
| 360 AddChildView(contents_.get()); | 360 AddChildView(contents_.get()); |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 | 363 |
| (...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 } | 1726 } |
| 1727 | 1727 |
| 1728 // static | 1728 // static |
| 1729 CandidateWindowController* | 1729 CandidateWindowController* |
| 1730 CandidateWindowController::CreateCandidateWindowController() { | 1730 CandidateWindowController::CreateCandidateWindowController() { |
| 1731 return new CandidateWindowControllerImpl; | 1731 return new CandidateWindowControllerImpl; |
| 1732 } | 1732 } |
| 1733 | 1733 |
| 1734 } // namespace input_method | 1734 } // namespace input_method |
| 1735 } // namespace chromeos | 1735 } // namespace chromeos |
| OLD | NEW |