| 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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/views/constrained_window_views.h" | 8 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 9 #include "components/web_modal/web_contents_modal_dialog_host.h" | 9 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 10 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 10 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 subtext, 1, 1, | 121 subtext, 1, 1, |
| 122 views::GridLayout::FILL, views::GridLayout::LEADING, | 122 views::GridLayout::FILL, views::GridLayout::LEADING, |
| 123 dialog_content_width, subtext->GetHeightForWidth(dialog_content_width)); | 123 dialog_content_width, subtext->GetHeightForWidth(dialog_content_width)); |
| 124 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 124 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 125 | 125 |
| 126 // Scrollable area for checkboxes. | 126 // Scrollable area for checkboxes. |
| 127 ScrollableView* scroll_container = new ScrollableView(); | 127 ScrollableView* scroll_container = new ScrollableView(); |
| 128 scroll_container->SetLayoutManager(new views::BoxLayout( | 128 scroll_container->SetLayoutManager(new views::BoxLayout( |
| 129 views::BoxLayout::kVertical, 0, 0, | 129 views::BoxLayout::kVertical, 0, 0, |
| 130 views::kRelatedControlSmallVerticalSpacing)); | 130 views::kRelatedControlSmallVerticalSpacing)); |
| 131 scroll_container->set_border(views::Border::CreateEmptyBorder( | 131 scroll_container->SetBorder(views::Border::CreateEmptyBorder( |
| 132 views::kRelatedControlVerticalSpacing, | 132 views::kRelatedControlVerticalSpacing, |
| 133 0, | 133 0, |
| 134 views::kRelatedControlVerticalSpacing, | 134 views::kRelatedControlVerticalSpacing, |
| 135 0)); | 135 0)); |
| 136 | 136 |
| 137 // Add attached galleries checkboxes. | 137 // Add attached galleries checkboxes. |
| 138 checkbox_map_.clear(); | 138 checkbox_map_.clear(); |
| 139 new_checkbox_map_.clear(); | 139 new_checkbox_map_.clear(); |
| 140 GalleryPermissionsVector permissions = controller_->AttachedPermissions(); | 140 GalleryPermissionsVector permissions = controller_->AttachedPermissions(); |
| 141 for (GalleryPermissionsVector::const_iterator iter = permissions.begin(); | 141 for (GalleryPermissionsVector::const_iterator iter = permissions.begin(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 154 // Separator line. | 154 // Separator line. |
| 155 views::Separator* separator = new views::Separator( | 155 views::Separator* separator = new views::Separator( |
| 156 views::Separator::HORIZONTAL); | 156 views::Separator::HORIZONTAL); |
| 157 scroll_container->AddChildView(separator); | 157 scroll_container->AddChildView(separator); |
| 158 | 158 |
| 159 // Unattached locations section. | 159 // Unattached locations section. |
| 160 views::Label* unattached_text = new views::Label( | 160 views::Label* unattached_text = new views::Label( |
| 161 controller_->GetUnattachedLocationsHeader()); | 161 controller_->GetUnattachedLocationsHeader()); |
| 162 unattached_text->SetMultiLine(true); | 162 unattached_text->SetMultiLine(true); |
| 163 unattached_text->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 163 unattached_text->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 164 unattached_text->set_border(views::Border::CreateEmptyBorder( | 164 unattached_text->SetBorder(views::Border::CreateEmptyBorder( |
| 165 views::kRelatedControlVerticalSpacing, | 165 views::kRelatedControlVerticalSpacing, |
| 166 views::kPanelHorizMargin, | 166 views::kPanelHorizMargin, |
| 167 views::kRelatedControlVerticalSpacing, | 167 views::kRelatedControlVerticalSpacing, |
| 168 0)); | 168 0)); |
| 169 scroll_container->AddChildView(unattached_text); | 169 scroll_container->AddChildView(unattached_text); |
| 170 | 170 |
| 171 // Add unattached galleries checkboxes. | 171 // Add unattached galleries checkboxes. |
| 172 for (GalleryPermissionsVector::const_iterator iter = | 172 for (GalleryPermissionsVector::const_iterator iter = |
| 173 unattached_permissions.begin(); | 173 unattached_permissions.begin(); |
| 174 iter != unattached_permissions.end(); ++iter) { | 174 iter != unattached_permissions.end(); ++iter) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 checkbox->set_listener(this); | 225 checkbox->set_listener(this); |
| 226 if (gallery.pref_id != kInvalidMediaGalleryPrefId) | 226 if (gallery.pref_id != kInvalidMediaGalleryPrefId) |
| 227 checkbox->set_context_menu_controller(this); | 227 checkbox->set_context_menu_controller(this); |
| 228 checkbox->SetTooltipText(tooltip_text); | 228 checkbox->SetTooltipText(tooltip_text); |
| 229 views::Label* secondary_text = new views::Label(details); | 229 views::Label* secondary_text = new views::Label(details); |
| 230 if (gallery.pref_id != kInvalidMediaGalleryPrefId) | 230 if (gallery.pref_id != kInvalidMediaGalleryPrefId) |
| 231 secondary_text->set_context_menu_controller(this); | 231 secondary_text->set_context_menu_controller(this); |
| 232 secondary_text->SetTooltipText(tooltip_text); | 232 secondary_text->SetTooltipText(tooltip_text); |
| 233 secondary_text->SetEnabledColor(kDeemphasizedTextColor); | 233 secondary_text->SetEnabledColor(kDeemphasizedTextColor); |
| 234 secondary_text->SetTooltipText(tooltip_text); | 234 secondary_text->SetTooltipText(tooltip_text); |
| 235 secondary_text->set_border(views::Border::CreateEmptyBorder( | 235 secondary_text->SetBorder(views::Border::CreateEmptyBorder( |
| 236 0, | 236 0, |
| 237 views::kRelatedControlSmallHorizontalSpacing, | 237 views::kRelatedControlSmallHorizontalSpacing, |
| 238 0, | 238 0, |
| 239 views::kRelatedControlSmallHorizontalSpacing)); | 239 views::kRelatedControlSmallHorizontalSpacing)); |
| 240 | 240 |
| 241 views::View* checkbox_view = new views::View(); | 241 views::View* checkbox_view = new views::View(); |
| 242 if (gallery.pref_id != kInvalidMediaGalleryPrefId) | 242 if (gallery.pref_id != kInvalidMediaGalleryPrefId) |
| 243 checkbox_view->set_context_menu_controller(this); | 243 checkbox_view->set_context_menu_controller(this); |
| 244 checkbox_view->set_border(views::Border::CreateEmptyBorder( | 244 checkbox_view->SetBorder(views::Border::CreateEmptyBorder( |
| 245 0, | 245 0, |
| 246 views::kPanelHorizMargin, | 246 views::kPanelHorizMargin, |
| 247 trailing_vertical_space, | 247 trailing_vertical_space, |
| 248 0)); | 248 0)); |
| 249 checkbox_view->SetLayoutManager( | 249 checkbox_view->SetLayoutManager( |
| 250 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); | 250 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
| 251 checkbox_view->AddChildView(checkbox); | 251 checkbox_view->AddChildView(checkbox); |
| 252 checkbox_view->AddChildView(secondary_text); | 252 checkbox_view->AddChildView(secondary_text); |
| 253 | 253 |
| 254 container->AddChildView(checkbox_view); | 254 container->AddChildView(checkbox_view); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 } | 383 } |
| 384 } | 384 } |
| 385 | 385 |
| 386 // MediaGalleriesDialogViewsController ----------------------------------------- | 386 // MediaGalleriesDialogViewsController ----------------------------------------- |
| 387 | 387 |
| 388 // static | 388 // static |
| 389 MediaGalleriesDialog* MediaGalleriesDialog::Create( | 389 MediaGalleriesDialog* MediaGalleriesDialog::Create( |
| 390 MediaGalleriesDialogController* controller) { | 390 MediaGalleriesDialogController* controller) { |
| 391 return new MediaGalleriesDialogViews(controller); | 391 return new MediaGalleriesDialogViews(controller); |
| 392 } | 392 } |
| OLD | NEW |