| 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 "chrome/browser/ui/views/importer/import_lock_dialog_view.h" | 5 #include "chrome/browser/ui/views/importer/import_lock_dialog_view.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/importer/importer_lock_dialog.h" | 10 #include "chrome/browser/importer/importer_lock_dialog.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 ImportLockDialogView::~ImportLockDialogView() { | 50 ImportLockDialogView::~ImportLockDialogView() { |
| 51 } | 51 } |
| 52 | 52 |
| 53 gfx::Size ImportLockDialogView::GetPreferredSize() { | 53 gfx::Size ImportLockDialogView::GetPreferredSize() { |
| 54 return gfx::Size(views::Widget::GetLocalizedContentsSize( | 54 return gfx::Size(views::Widget::GetLocalizedContentsSize( |
| 55 IDS_IMPORTLOCK_DIALOG_WIDTH_CHARS, | 55 IDS_IMPORTLOCK_DIALOG_WIDTH_CHARS, |
| 56 IDS_IMPORTLOCK_DIALOG_HEIGHT_LINES)); | 56 IDS_IMPORTLOCK_DIALOG_HEIGHT_LINES)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ImportLockDialogView::Layout() { | 59 void ImportLockDialogView::Layout() { |
| 60 if (DialogDelegate::UseNewStyle()) { | 60 gfx::Rect bounds(GetLocalBounds()); |
| 61 description_label_->SetBounds( | 61 bounds.Inset(views::kButtonHEdgeMargin, views::kPanelVertMargin); |
| 62 views::kButtonHEdgeMargin, | 62 description_label_->SetBoundsRect(bounds); |
| 63 views::kPanelVertMargin, | |
| 64 width() - 2 * views::kButtonHEdgeMargin, | |
| 65 height() - 2 * views::kPanelVertMargin); | |
| 66 } else { | |
| 67 description_label_->SetBounds( | |
| 68 views::kPanelHorizMargin, | |
| 69 views::kPanelVertMargin, | |
| 70 width() - 2 * views::kPanelHorizMargin, | |
| 71 height() - 2 * views::kPanelVertMargin); | |
| 72 } | |
| 73 } | 63 } |
| 74 | 64 |
| 75 string16 ImportLockDialogView::GetDialogButtonLabel( | 65 string16 ImportLockDialogView::GetDialogButtonLabel( |
| 76 ui::DialogButton button) const { | 66 ui::DialogButton button) const { |
| 77 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? | 67 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? |
| 78 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL); | 68 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL); |
| 79 } | 69 } |
| 80 | 70 |
| 81 string16 ImportLockDialogView::GetWindowTitle() const { | 71 string16 ImportLockDialogView::GetWindowTitle() const { |
| 82 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE); | 72 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE); |
| 83 } | 73 } |
| 84 | 74 |
| 85 bool ImportLockDialogView::Accept() { | 75 bool ImportLockDialogView::Accept() { |
| 86 base::MessageLoop::current()->PostTask(FROM_HERE, | 76 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 87 base::Bind(callback_, true)); | 77 base::Bind(callback_, true)); |
| 88 return true; | 78 return true; |
| 89 } | 79 } |
| 90 | 80 |
| 91 bool ImportLockDialogView::Cancel() { | 81 bool ImportLockDialogView::Cancel() { |
| 92 base::MessageLoop::current()->PostTask(FROM_HERE, | 82 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 93 base::Bind(callback_, false)); | 83 base::Bind(callback_, false)); |
| 94 return true; | 84 return true; |
| 95 } | 85 } |
| OLD | NEW |