| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 public: | 329 public: |
| 330 HidableArea() { | 330 HidableArea() { |
| 331 // |place_holder_| will be deleted by scoped_ptr, rather than | 331 // |place_holder_| will be deleted by scoped_ptr, rather than |
| 332 // the standard owning relation of views::View. | 332 // the standard owning relation of views::View. |
| 333 // | 333 // |
| 334 // This is because we swap the contents of HidableArea between | 334 // This is because we swap the contents of HidableArea between |
| 335 // |place_holder_| (to show nothing) and |contents_| (to show something). | 335 // |place_holder_| (to show nothing) and |contents_| (to show something). |
| 336 // In other words, the HidableArea only contains one of the two views | 336 // In other words, the HidableArea only contains one of the two views |
| 337 // hence cannot own the two views at the same time. | 337 // hence cannot own the two views at the same time. |
| 338 place_holder_.reset(new views::View); | 338 place_holder_.reset(new views::View); |
| 339 place_holder_->set_parent_owned(false); // Won't own | 339 place_holder_->set_not_owned_by_parent(); // Won't own |
| 340 | 340 |
| 341 // Initially show nothing. | 341 // Initially show nothing. |
| 342 SetLayoutManager(new views::FillLayout); | 342 SetLayoutManager(new views::FillLayout); |
| 343 AddChildView(place_holder_.get()); | 343 AddChildView(place_holder_.get()); |
| 344 } | 344 } |
| 345 | 345 |
| 346 // Sets the content view. | 346 // Sets the content view. |
| 347 void SetContents(views::View* contents) { | 347 void SetContents(views::View* contents) { |
| 348 contents_.reset(contents); | 348 contents_.reset(contents); |
| 349 contents_->set_parent_owned(false); // Won't own | 349 contents_->set_not_owned_by_parent(); // Won't own |
| 350 } | 350 } |
| 351 | 351 |
| 352 // Shows the content. | 352 // Shows the content. |
| 353 void Show() { | 353 void Show() { |
| 354 if (contents_.get() && contents_->parent() != this) { | 354 if (contents_.get() && contents_->parent() != this) { |
| 355 RemoveAllChildViews(false); // Don't delete child views. | 355 RemoveAllChildViews(false); // Don't delete child views. |
| 356 AddChildView(contents_.get()); | 356 AddChildView(contents_.get()); |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 | 359 |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 } | 1711 } |
| 1712 | 1712 |
| 1713 // static | 1713 // static |
| 1714 CandidateWindowController* | 1714 CandidateWindowController* |
| 1715 CandidateWindowController::CreateCandidateWindowController() { | 1715 CandidateWindowController::CreateCandidateWindowController() { |
| 1716 return new CandidateWindowControllerImpl; | 1716 return new CandidateWindowControllerImpl; |
| 1717 } | 1717 } |
| 1718 | 1718 |
| 1719 } // namespace input_method | 1719 } // namespace input_method |
| 1720 } // namespace chromeos | 1720 } // namespace chromeos |
| OLD | NEW |