Chromium Code Reviews| 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/chrome_select_file_policy.h" | |
| 7 #include "chrome/browser/ui/views/constrained_window_views.h" | 8 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 8 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/views/controls/button/checkbox.h" | 11 #include "ui/views/controls/button/checkbox.h" |
| 11 #include "ui/views/controls/button/text_button.h" | 12 #include "ui/views/controls/button/text_button.h" |
| 12 #include "ui/views/controls/label.h" | 13 #include "ui/views/controls/label.h" |
| 13 #include "ui/views/layout/box_layout.h" | 14 #include "ui/views/layout/box_layout.h" |
| 14 #include "ui/views/layout/grid_layout.h" | 15 #include "ui/views/layout/grid_layout.h" |
| 15 #include "ui/views/layout/layout_constants.h" | 16 #include "ui/views/layout/layout_constants.h" |
| 16 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 | 96 |
| 96 const GalleryPermissions& permissions = controller_->permissions(); | 97 const GalleryPermissions& permissions = controller_->permissions(); |
| 97 for (GalleryPermissions::const_iterator iter = permissions.begin(); | 98 for (GalleryPermissions::const_iterator iter = permissions.begin(); |
| 98 iter != permissions.end(); ++iter) { | 99 iter != permissions.end(); ++iter) { |
| 99 AddOrUpdateGallery(&iter->second.pref_info, iter->second.allowed); | 100 AddOrUpdateGallery(&iter->second.pref_info, iter->second.allowed); |
| 100 if (iter->second.allowed) | 101 if (iter->second.allowed) |
| 101 confirm_available_ = true; | 102 confirm_available_ = true; |
| 102 } | 103 } |
| 103 | 104 |
| 104 // Add Gallery button. | 105 // Add Gallery button. |
| 105 add_gallery_ = new views::NativeTextButton( | 106 if (ChromeSelectFilePolicy::FileSelectDialogsAllowed()) { |
| 106 this, l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY)); | 107 add_gallery_ = new views::NativeTextButton( |
| 107 layout->StartRowWithPadding(0, column_set_id, | 108 this, |
|
Peter Kasting
2012/08/16 03:30:20
Nit: Or this can go on the end of the previous lin
| |
| 108 0, views::kRelatedControlVerticalSpacing); | 109 l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY)); |
| 109 layout->AddView(add_gallery_); | 110 layout->StartRowWithPadding(0, column_set_id, |
| 111 0, views::kRelatedControlVerticalSpacing); | |
| 112 layout->AddView(add_gallery_); | |
| 113 } | |
| 110 } | 114 } |
| 111 | 115 |
| 112 void MediaGalleriesDialogViews::UpdateGallery( | 116 void MediaGalleriesDialogViews::UpdateGallery( |
| 113 const MediaGalleryPrefInfo* gallery, | 117 const MediaGalleryPrefInfo* gallery, |
| 114 bool permitted) { | 118 bool permitted) { |
| 115 // After adding a new checkbox, we have to update the size of the dialog. | 119 // After adding a new checkbox, we have to update the size of the dialog. |
| 116 if (AddOrUpdateGallery(gallery, permitted)) | 120 if (AddOrUpdateGallery(gallery, permitted)) |
| 117 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); | 121 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); |
| 118 } | 122 } |
| 119 | 123 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 | 201 |
| 198 // MediaGalleriesDialogViewsController ----------------------------------------- | 202 // MediaGalleriesDialogViewsController ----------------------------------------- |
| 199 | 203 |
| 200 // static | 204 // static |
| 201 MediaGalleriesDialog* MediaGalleriesDialog::Create( | 205 MediaGalleriesDialog* MediaGalleriesDialog::Create( |
| 202 MediaGalleriesDialogController* controller) { | 206 MediaGalleriesDialogController* controller) { |
| 203 return new MediaGalleriesDialogViews(controller); | 207 return new MediaGalleriesDialogViews(controller); |
| 204 } | 208 } |
| 205 | 209 |
| 206 } // namespace chrome | 210 } // namespace chrome |
| OLD | NEW |