| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |