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

Side by Side Diff: ui/views/window/dialog_client_view.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 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
« no previous file with comments | « ui/views/window/dialog_client_view.h ('k') | ui/views/window/dialog_delegate_unittest.cc » ('j') | 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) 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/dialog_client_view.h" 5 #include "ui/views/window/dialog_client_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/events/keycodes/keyboard_codes.h" 9 #include "ui/events/keycodes/keyboard_codes.h"
10 #include "ui/views/background.h" 10 #include "ui/views/background.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 default_button_->SetIsDefault(true); 168 default_button_->SetIsDefault(true);
169 } 169 }
170 170
171 void DialogClientView::OnDidChangeFocus(View* focused_before, 171 void DialogClientView::OnDidChangeFocus(View* focused_before,
172 View* focused_now) { 172 View* focused_now) {
173 } 173 }
174 174
175 //////////////////////////////////////////////////////////////////////////////// 175 ////////////////////////////////////////////////////////////////////////////////
176 // DialogClientView, View overrides: 176 // DialogClientView, View overrides:
177 177
178 gfx::Size DialogClientView::GetPreferredSize() { 178 gfx::Size DialogClientView::GetPreferredSize() const {
179 // Initialize the size to fit the buttons and extra view row. 179 // Initialize the size to fit the buttons and extra view row.
180 gfx::Size size( 180 gfx::Size size(
181 (ok_button_ ? ok_button_->GetPreferredSize().width() : 0) + 181 (ok_button_ ? ok_button_->GetPreferredSize().width() : 0) +
182 (cancel_button_ ? cancel_button_->GetPreferredSize().width() : 0) + 182 (cancel_button_ ? cancel_button_->GetPreferredSize().width() : 0) +
183 (cancel_button_ && ok_button_ ? kRelatedButtonHSpacing : 0) + 183 (cancel_button_ && ok_button_ ? kRelatedButtonHSpacing : 0) +
184 (ShouldShow(extra_view_) ? extra_view_->GetPreferredSize().width() : 0) + 184 (ShouldShow(extra_view_) ? extra_view_->GetPreferredSize().width() : 0) +
185 (ShouldShow(extra_view_) && has_dialog_buttons() ? 185 (ShouldShow(extra_view_) && has_dialog_buttons() ?
186 kRelatedButtonHSpacing : 0), 186 kRelatedButtonHSpacing : 0),
187 0); 187 0);
188 188
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 gfx::Insets(0, kButtonHEdgeMarginNew, 419 gfx::Insets(0, kButtonHEdgeMarginNew,
420 kButtonVEdgeMarginNew, kButtonHEdgeMarginNew); 420 kButtonVEdgeMarginNew, kButtonHEdgeMarginNew);
421 } 421 }
422 422
423 void DialogClientView::Close() { 423 void DialogClientView::Close() {
424 GetWidget()->Close(); 424 GetWidget()->Close();
425 GetDialogDelegate()->OnClosed(); 425 GetDialogDelegate()->OnClosed();
426 } 426 }
427 427
428 } // namespace views 428 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/window/dialog_client_view.h ('k') | ui/views/window/dialog_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698