| OLD | NEW |
| 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/browser/views/delay_view.h" | 5 #include "chrome/browser/views/delay_view.h" |
| 6 | 6 |
| 7 #include "chrome/common/l10n_util.h" | 7 #include "chrome/common/l10n_util.h" |
| 8 | 8 |
| 9 #include "generated_resources.h" | 9 #include "generated_resources.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 void DelayView::Layout() { | 49 void DelayView::Layout() { |
| 50 if (!GetParent()) | 50 if (!GetParent()) |
| 51 return; | 51 return; |
| 52 | 52 |
| 53 CSize available; | 53 CSize available; |
| 54 GetParent()->GetSize(&available); | 54 GetParent()->GetSize(&available); |
| 55 | 55 |
| 56 if (cancel_button_) { | 56 if (cancel_button_) { |
| 57 CSize button_size; | 57 gfx::Size button_size = cancel_button_->GetPreferredSize(); |
| 58 cancel_button_->GetPreferredSize(&button_size); | 58 cancel_button_->SetBounds(available.cx - kWindowMargin - |
| 59 cancel_button_->SetBounds(available.cx - kWindowMargin - button_size.cx, | 59 button_size.width(), |
| 60 available.cy - kWindowMargin - button_size.cy, | 60 available.cy - kWindowMargin - |
| 61 button_size.cx, button_size.cy); | 61 button_size.height(), |
| 62 button_size.width(), button_size.height()); |
| 62 } | 63 } |
| 63 | 64 |
| 64 DCHECK(label_); | 65 DCHECK(label_); |
| 65 CSize label_size; | 66 gfx::Size label_size = label_->GetPreferredSize(); |
| 66 label_->GetPreferredSize(&label_size); | |
| 67 | 67 |
| 68 DCHECK(throbber_); | 68 DCHECK(throbber_); |
| 69 CSize throbber_size; | 69 gfx::Size throbber_size = throbber_->GetPreferredSize(); |
| 70 throbber_->GetPreferredSize(&throbber_size); | |
| 71 | 70 |
| 72 CRect main_rect(0, 0, | 71 gfx::Rect main_rect(0, 0, |
| 73 throbber_size.cx + kThrobberLabelSpace + label_size.cx, | 72 throbber_size.width() + kThrobberLabelSpace + |
| 74 std::max(throbber_size.cy, label_size.cy)); | 73 label_size.width(), |
| 74 std::max(throbber_size.height(), label_size.height())); |
| 75 | 75 |
| 76 main_rect.MoveToXY((available.cx / 2) - (main_rect.Width() / 2), | 76 main_rect.set_x((available.cx / 2) - (main_rect.width() / 2)); |
| 77 (available.cy / 2) - (main_rect.Height() / 2)); | 77 main_rect.set_y((available.cy / 2) - (main_rect.height() / 2)); |
| 78 | 78 |
| 79 label_->SetBounds(main_rect.left + throbber_size.cx + kThrobberLabelSpace, | 79 label_->SetBounds(main_rect.x() + throbber_size.width() + |
| 80 main_rect.top + main_rect.Height() / 2 - label_size.cy / 2, | 80 kThrobberLabelSpace, |
| 81 label_size.cx, | 81 main_rect.y() + main_rect.height() / 2 - |
| 82 label_size.cy); | 82 label_size.height() / 2, |
| 83 label_size.width(), |
| 84 label_size.height()); |
| 83 | 85 |
| 84 throbber_->SetBounds( | 86 throbber_->SetBounds( |
| 85 main_rect.left, | 87 main_rect.x(), |
| 86 main_rect.top + main_rect.Height() / 2 - throbber_size.cy / 2, | 88 main_rect.y() + main_rect.height() / 2 - throbber_size.height() / 2, |
| 87 throbber_size.cx, | 89 throbber_size.width(), |
| 88 throbber_size.cy); | 90 throbber_size.height()); |
| 89 } | 91 } |
| OLD | NEW |