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

Side by Side Diff: chrome/views/window/non_client_view.cc

Issue 60003: Merge r12930.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/branches/172/src/
Patch Set: Created 11 years, 8 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
« no previous file with comments | « chrome/views/window/non_client_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/views/window/non_client_view.h" 5 #include "chrome/views/window/non_client_view.h"
6 6
7 #include "chrome/common/win_util.h" 7 #include "chrome/common/win_util.h"
8 #include "chrome/views/widget/root_view.h" 8 #include "chrome/views/widget/root_view.h"
9 #include "chrome/views/widget/widget.h" 9 #include "chrome/views/widget/widget.h"
10 #include "chrome/views/window/window.h" 10 #include "chrome/views/window/window.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 void NonClientView::EnableClose(bool enable) { 107 void NonClientView::EnableClose(bool enable) {
108 frame_view_->EnableClose(enable); 108 frame_view_->EnableClose(enable);
109 } 109 }
110 110
111 void NonClientView::ResetWindowControls() { 111 void NonClientView::ResetWindowControls() {
112 frame_view_->ResetWindowControls(); 112 frame_view_->ResetWindowControls();
113 } 113 }
114 114
115 //////////////////////////////////////////////////////////////////////////////// 115 void NonClientView::LayoutFrameView() {
116 // NonClientView, View overrides:
117
118 gfx::Size NonClientView::GetPreferredSize() {
119 gfx::Rect client_bounds(gfx::Point(), client_view_->GetPreferredSize());
120 return GetWindowBoundsForClientBounds(client_bounds).size();
121 }
122
123 void NonClientView::Layout() {
124 // First layout the NonClientFrameView, which determines the size of the 116 // First layout the NonClientFrameView, which determines the size of the
125 // ClientView... 117 // ClientView...
126 frame_view_->SetBounds(0, 0, width(), height()); 118 frame_view_->SetBounds(0, 0, width(), height());
127 119
128 // We need to manually call Layout here because layout for the frame view can 120 // We need to manually call Layout here because layout for the frame view can
129 // change independently of the bounds changing - e.g. after the initial 121 // change independently of the bounds changing - e.g. after the initial
130 // display of the window the metrics of the native window controls can change, 122 // display of the window the metrics of the native window controls can change,
131 // which does not change the bounds of the window but requires a re-layout to 123 // which does not change the bounds of the window but requires a re-layout to
132 // trigger a repaint. We override DidChangeBounds for the NonClientFrameView 124 // trigger a repaint. We override DidChangeBounds for the NonClientFrameView
133 // to do nothing so that SetBounds above doesn't cause Layout to be called 125 // to do nothing so that SetBounds above doesn't cause Layout to be called
134 // twice. 126 // twice.
135 frame_view_->Layout(); 127 frame_view_->Layout();
128 }
129
130 ////////////////////////////////////////////////////////////////////////////////
131 // NonClientView, View overrides:
132
133 gfx::Size NonClientView::GetPreferredSize() {
134 gfx::Rect client_bounds(gfx::Point(), client_view_->GetPreferredSize());
135 return GetWindowBoundsForClientBounds(client_bounds).size();
136 }
137
138 void NonClientView::Layout() {
139 LayoutFrameView();
136 140
137 // Then layout the ClientView, using those bounds. 141 // Then layout the ClientView, using those bounds.
138 client_view_->SetBounds(frame_view_->GetBoundsForClientView()); 142 client_view_->SetBounds(frame_view_->GetBoundsForClientView());
139 143
140 // We need to manually call Layout on the ClientView as well for the same 144 // We need to manually call Layout on the ClientView as well for the same
141 // reason as above. 145 // reason as above.
142 client_view_->Layout(); 146 client_view_->Layout();
143 } 147 }
144 148
145 void NonClientView::ViewHierarchyChanged(bool is_add, View* parent, 149 void NonClientView::ViewHierarchyChanged(bool is_add, View* parent,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } else { 239 } else {
236 return HTNOWHERE; 240 return HTNOWHERE;
237 } 241 }
238 242
239 // If the window can't be resized, there are no resize boundaries, just 243 // If the window can't be resized, there are no resize boundaries, just
240 // window borders. 244 // window borders.
241 return can_resize ? component : HTBORDER; 245 return can_resize ? component : HTBORDER;
242 } 246 }
243 247
244 } // namespace views 248 } // namespace views
OLDNEW
« no previous file with comments | « chrome/views/window/non_client_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698