| 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/extensions/media_galleries_dialog_views.h" | 5 #include "chrome/browser/ui/views/extensions/media_galleries_dialog_views.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/constrained_window_views.h" | 7 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 8 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.h" |
| 9 #include "grit/locale_settings.h" | 9 #include "grit/locale_settings.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| 11 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/views/controls/button/checkbox.h" | 12 #include "ui/views/controls/button/checkbox.h" |
| 12 #include "ui/views/controls/button/text_button.h" | 13 #include "ui/views/controls/button/text_button.h" |
| 13 #include "ui/views/controls/label.h" | 14 #include "ui/views/controls/label.h" |
| 14 #include "ui/views/layout/box_layout.h" | 15 #include "ui/views/layout/box_layout.h" |
| 15 #include "ui/views/layout/grid_layout.h" | 16 #include "ui/views/layout/grid_layout.h" |
| 16 #include "ui/views/layout/layout_constants.h" | 17 #include "ui/views/layout/layout_constants.h" |
| 17 #include "ui/views/view.h" | 18 #include "ui/views/view.h" |
| 18 #include "ui/views/window/dialog_client_view.h" | 19 #include "ui/views/window/dialog_client_view.h" |
| 19 | 20 |
| 20 | 21 |
| 21 namespace chrome { | 22 namespace chrome { |
| 22 | 23 |
| 23 typedef MediaGalleriesDialogController::KnownGalleryPermissions | 24 typedef MediaGalleriesDialogController::KnownGalleryPermissions |
| 24 GalleryPermissions; | 25 GalleryPermissions; |
| 25 | 26 |
| 26 namespace { | |
| 27 | |
| 28 // Heading font size correction. | |
| 29 const int kHeadingFontSizeDelta = 1; | |
| 30 | |
| 31 } // namespace | |
| 32 | |
| 33 MediaGalleriesDialogViews::MediaGalleriesDialogViews( | 27 MediaGalleriesDialogViews::MediaGalleriesDialogViews( |
| 34 MediaGalleriesDialogController* controller) | 28 MediaGalleriesDialogController* controller) |
| 35 : controller_(controller), | 29 : controller_(controller), |
| 36 window_(NULL), | 30 window_(NULL), |
| 37 contents_(new views::View()), | 31 contents_(new views::View()), |
| 38 checkbox_container_(NULL), | 32 checkbox_container_(NULL), |
| 39 add_gallery_container_(NULL), | 33 add_gallery_container_(NULL), |
| 40 confirm_available_(false), | 34 confirm_available_(false), |
| 41 accepted_(false) { | 35 accepted_(false) { |
| 42 InitChildViews(); | 36 InitChildViews(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 60 views::GridLayout::LEADING, | 54 views::GridLayout::LEADING, |
| 61 1, | 55 1, |
| 62 views::GridLayout::FIXED, | 56 views::GridLayout::FIXED, |
| 63 views::Widget::GetLocalizedContentsWidth( | 57 views::Widget::GetLocalizedContentsWidth( |
| 64 IDS_MEDIA_GALLERIES_DIALOG_CONTENT_WIDTH_CHARS), | 58 IDS_MEDIA_GALLERIES_DIALOG_CONTENT_WIDTH_CHARS), |
| 65 0); | 59 0); |
| 66 contents_->SetLayoutManager(layout); | 60 contents_->SetLayoutManager(layout); |
| 67 | 61 |
| 68 // Header text. | 62 // Header text. |
| 69 views::Label* header = new views::Label(controller_->GetHeader()); | 63 views::Label* header = new views::Label(controller_->GetHeader()); |
| 70 header->SetFont(header->font().DeriveFont(kHeadingFontSizeDelta, | 64 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 71 gfx::Font::BOLD)); | 65 header->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); |
| 72 header->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 66 header->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 73 layout->StartRow(0, column_set_id); | 67 layout->StartRow(0, column_set_id); |
| 74 layout->AddView(header); | 68 layout->AddView(header); |
| 75 | 69 |
| 76 // Message text. | 70 // Message text. |
| 77 views::Label* subtext = new views::Label(controller_->GetSubtext()); | 71 views::Label* subtext = new views::Label(controller_->GetSubtext()); |
| 78 subtext->SetMultiLine(true); | 72 subtext->SetMultiLine(true); |
| 79 subtext->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 73 subtext->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 80 layout->StartRowWithPadding(0, column_set_id, | 74 layout->StartRowWithPadding(0, column_set_id, |
| 81 0, views::kRelatedControlVerticalSpacing); | 75 0, views::kRelatedControlVerticalSpacing); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 217 |
| 224 // MediaGalleriesDialogViewsController ----------------------------------------- | 218 // MediaGalleriesDialogViewsController ----------------------------------------- |
| 225 | 219 |
| 226 // static | 220 // static |
| 227 MediaGalleriesDialog* MediaGalleriesDialog::Create( | 221 MediaGalleriesDialog* MediaGalleriesDialog::Create( |
| 228 MediaGalleriesDialogController* controller) { | 222 MediaGalleriesDialogController* controller) { |
| 229 return new MediaGalleriesDialogViews(controller); | 223 return new MediaGalleriesDialogViews(controller); |
| 230 } | 224 } |
| 231 | 225 |
| 232 } // namespace chrome | 226 } // namespace chrome |
| OLD | NEW |