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

Side by Side Diff: chrome/views/client_view.cc

Issue 7344: Convert GetPreferredSize from:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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
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 7
8 namespace ChromeViews { 8 namespace ChromeViews {
9 9
10 /////////////////////////////////////////////////////////////////////////////// 10 ///////////////////////////////////////////////////////////////////////////////
11 // ClientView, public: 11 // ClientView, public:
12 12
13 ClientView::ClientView(Window* window, View* contents_view) 13 ClientView::ClientView(Window* window, View* contents_view)
14 : window_(window), 14 : window_(window),
15 contents_view_(contents_view) { 15 contents_view_(contents_view) {
16 } 16 }
17 17
18 int ClientView::NonClientHitTest(const gfx::Point& point) { 18 int ClientView::NonClientHitTest(const gfx::Point& point) {
19 return bounds().Contains(point) ? HTCLIENT : HTNOWHERE; 19 return bounds().Contains(point) ? HTCLIENT : HTNOWHERE;
20 } 20 }
21 21
22 /////////////////////////////////////////////////////////////////////////////// 22 ///////////////////////////////////////////////////////////////////////////////
23 // ClientView, View overrides: 23 // ClientView, View overrides:
24 24
25 void ClientView::GetPreferredSize(CSize* out) { 25 gfx::Size ClientView::GetPreferredSize() {
26 DCHECK(out);
27 // |contents_view_| is allowed to be NULL up until the point where this view 26 // |contents_view_| is allowed to be NULL up until the point where this view
28 // is attached to a ViewContainer. 27 // is attached to a ViewContainer.
29 if (contents_view_) 28 if (contents_view_)
30 contents_view_->GetPreferredSize(out); 29 return contents_view_->GetPreferredSize();
30 return gfx::Size();
31 } 31 }
32 32
33 void ClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { 33 void ClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
34 if (is_add && child == this) { 34 if (is_add && child == this) {
35 DCHECK(GetViewContainer()); 35 DCHECK(GetViewContainer());
36 DCHECK(contents_view_); // |contents_view_| must be valid now! 36 DCHECK(contents_view_); // |contents_view_| must be valid now!
37 AddChildView(contents_view_); 37 AddChildView(contents_view_);
38 } 38 }
39 } 39 }
40 40
41 void ClientView::DidChangeBounds(const CRect& previous, const CRect& current) { 41 void ClientView::DidChangeBounds(const CRect& previous, const CRect& current) {
42 Layout(); 42 Layout();
43 } 43 }
44 44
45 void ClientView::Layout() { 45 void ClientView::Layout() {
46 // |contents_view_| is allowed to be NULL up until the point where this view 46 // |contents_view_| is allowed to be NULL up until the point where this view
47 // is attached to a ViewContainer. 47 // is attached to a ViewContainer.
48 if (contents_view_) 48 if (contents_view_)
49 contents_view_->SetBounds(0, 0, width(), height()); 49 contents_view_->SetBounds(0, 0, width(), height());
50 } 50 }
51 51
52 }; // namespace ChromeViews 52 }; // namespace ChromeViews
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698