| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "chrome/views/client_view.h" | 6 #include "chrome/views/client_view.h" |
| 7 #include "chrome/views/window.h" | 7 #include "chrome/views/window.h" |
| 8 #include "chrome/views/window_delegate.h" | 8 #include "chrome/views/window_delegate.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // ClientView, View overrides: | 29 // ClientView, View overrides: |
| 30 | 30 |
| 31 gfx::Size ClientView::GetPreferredSize() { | 31 gfx::Size ClientView::GetPreferredSize() { |
| 32 // |contents_view_| is allowed to be NULL up until the point where this view | 32 // |contents_view_| is allowed to be NULL up until the point where this view |
| 33 // is attached to a Container. | 33 // is attached to a Container. |
| 34 if (contents_view_) | 34 if (contents_view_) |
| 35 return contents_view_->GetPreferredSize(); | 35 return contents_view_->GetPreferredSize(); |
| 36 return gfx::Size(); | 36 return gfx::Size(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void ClientView::Layout() { |
| 40 // |contents_view_| is allowed to be NULL up until the point where this view |
| 41 // is attached to a Container. |
| 42 if (contents_view_) |
| 43 contents_view_->SetBounds(0, 0, width(), height()); |
| 44 } |
| 45 |
| 39 void ClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { | 46 void ClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { |
| 40 if (is_add && child == this) { | 47 if (is_add && child == this) { |
| 41 DCHECK(GetWidget()); | 48 DCHECK(GetWidget()); |
| 42 DCHECK(contents_view_); // |contents_view_| must be valid now! | 49 DCHECK(contents_view_); // |contents_view_| must be valid now! |
| 43 AddChildView(contents_view_); | 50 AddChildView(contents_view_); |
| 44 } | 51 } |
| 45 } | 52 } |
| 46 | 53 |
| 47 void ClientView::Layout() { | 54 void ClientView::DidChangeBounds(const gfx::Rect& previous, |
| 48 // |contents_view_| is allowed to be NULL up until the point where this view | 55 const gfx::Rect& current) { |
| 49 // is attached to a Container. | 56 // Overridden to do nothing. The NonClientView manually calls Layout on the |
| 50 if (contents_view_) | 57 // ClientView when it is itself laid out, see comment in |
| 51 contents_view_->SetBounds(0, 0, width(), height()); | 58 // NonClientView::Layout. |
| 52 } | 59 } |
| 53 | 60 |
| 54 } // namespace views | 61 } // namespace views |
| OLD | NEW |