| 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 "ui/views/window/client_view.h" | 5 #include "ui/views/window/client_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
| 9 #include "ui/base/hit_test.h" | 9 #include "ui/base/hit_test.h" |
| 10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 gfx::Size ClientView::GetMinimumSize() const { | 60 gfx::Size ClientView::GetMinimumSize() const { |
| 61 // |contents_view_| is allowed to be NULL up until the point where this view | 61 // |contents_view_| is allowed to be NULL up until the point where this view |
| 62 // is attached to a Container. | 62 // is attached to a Container. |
| 63 return contents_view_ ? contents_view_->GetMinimumSize() : gfx::Size(); | 63 return contents_view_ ? contents_view_->GetMinimumSize() : gfx::Size(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void ClientView::Layout() { | 66 void ClientView::Layout() { |
| 67 // |contents_view_| is allowed to be NULL up until the point where this view | 67 // |contents_view_| is allowed to be NULL up until the point where this view |
| 68 // is attached to a Container. | 68 // is attached to a Container. |
| 69 if (contents_view_) | 69 if (contents_view_) { |
| 70 contents_view_->SetBounds(0, 0, width(), height()); | 70 contents_view_->SetBounds(0, 0, width(), height()); |
| 71 contents_view_->Layout(); |
| 72 } |
| 71 } | 73 } |
| 72 | 74 |
| 73 const char* ClientView::GetClassName() const { | 75 const char* ClientView::GetClassName() const { |
| 74 return kViewClassName; | 76 return kViewClassName; |
| 75 } | 77 } |
| 76 | 78 |
| 77 void ClientView::GetAccessibleState(ui::AXViewState* state) { | 79 void ClientView::GetAccessibleState(ui::AXViewState* state) { |
| 78 state->role = ui::AX_ROLE_CLIENT; | 80 state->role = ui::AX_ROLE_CLIENT; |
| 79 } | 81 } |
| 80 | 82 |
| 81 void ClientView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 83 void ClientView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| 82 // Overridden to do nothing. The NonClientView manually calls Layout on the | 84 // Overridden to do nothing. The NonClientView manually calls Layout on the |
| 83 // ClientView when it is itself laid out, see comment in | 85 // ClientView when it is itself laid out, see comment in |
| 84 // NonClientView::Layout. | 86 // NonClientView::Layout. |
| 85 } | 87 } |
| 86 | 88 |
| 87 void ClientView::ViewHierarchyChanged( | 89 void ClientView::ViewHierarchyChanged( |
| 88 const ViewHierarchyChangedDetails& details) { | 90 const ViewHierarchyChangedDetails& details) { |
| 89 if (details.is_add && details.child == this) { | 91 if (details.is_add && details.child == this) { |
| 90 DCHECK(GetWidget()); | 92 DCHECK(GetWidget()); |
| 91 DCHECK(contents_view_); // |contents_view_| must be valid now! | 93 DCHECK(contents_view_); // |contents_view_| must be valid now! |
| 92 // Insert |contents_view_| at index 0 so it is first in the focus chain. | 94 // Insert |contents_view_| at index 0 so it is first in the focus chain. |
| 93 // (the OK/Cancel buttons are inserted before contents_view_) | 95 // (the OK/Cancel buttons are inserted before contents_view_) |
| 94 AddChildViewAt(contents_view_, 0); | 96 AddChildViewAt(contents_view_, 0); |
| 95 } | 97 } |
| 96 } | 98 } |
| 97 | 99 |
| 98 } // namespace views | 100 } // namespace views |
| OLD | NEW |