Chromium Code Reviews| Index: chrome/browser/ui/views/extensions/request_file_system_dialog_view.cc |
| diff --git a/chrome/browser/extensions/api/file_system/request_file_system_dialog_view.cc b/chrome/browser/ui/views/extensions/request_file_system_dialog_view.cc |
| similarity index 82% |
| rename from chrome/browser/extensions/api/file_system/request_file_system_dialog_view.cc |
| rename to chrome/browser/ui/views/extensions/request_file_system_dialog_view.cc |
| index 409a007b13226e5211f2d2de5deaea073f9d4384..d8bf6b705ca0d7f4c41c16803114ec2a69ff8b00 100644 |
| --- a/chrome/browser/extensions/api/file_system/request_file_system_dialog_view.cc |
| +++ b/chrome/browser/ui/views/extensions/request_file_system_dialog_view.cc |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/extensions/api/file_system/request_file_system_dialog_view.h" |
| +#include "chrome/browser/ui/views/extensions/request_file_system_dialog_view.h" |
| #include <stddef.h> |
| @@ -10,6 +10,7 @@ |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/threading/thread_task_runner_handle.h" |
| +#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| #include "chrome/grit/generated_resources.h" |
| #include "components/constrained_window/constrained_window_views.h" |
| #include "content/public/browser/web_contents.h" |
| @@ -17,8 +18,7 @@ |
| #include "ui/gfx/font.h" |
| #include "ui/gfx/range/range.h" |
| #include "ui/views/controls/styled_label.h" |
| -#include "ui/views/layout/box_layout.h" |
| -#include "ui/views/layout/layout_constants.h" |
| +#include "ui/views/layout/fill_layout.h" |
| namespace { |
| @@ -39,8 +39,7 @@ void RequestFileSystemDialogView::ShowDialog( |
| web_contents); |
| } |
| -RequestFileSystemDialogView::~RequestFileSystemDialogView() { |
| -} |
| +RequestFileSystemDialogView::~RequestFileSystemDialogView() {} |
| base::string16 RequestFileSystemDialogView::GetAccessibleWindowTitle() const { |
| return l10n_util::GetStringUTF16( |
| @@ -70,18 +69,6 @@ ui::ModalType RequestFileSystemDialogView::GetModalType() const { |
| return ui::MODAL_TYPE_CHILD; |
| } |
| -views::View* RequestFileSystemDialogView::GetContentsView() { |
| - return contents_view_; |
| -} |
| - |
| -views::Widget* RequestFileSystemDialogView::GetWidget() { |
| - return contents_view_->GetWidget(); |
| -} |
| - |
| -const views::Widget* RequestFileSystemDialogView::GetWidget() const { |
| - return contents_view_->GetWidget(); |
| -} |
| - |
| bool RequestFileSystemDialogView::Cancel() { |
| callback_.Run(ui::DIALOG_BUTTON_CANCEL); |
| return true; |
| @@ -92,6 +79,15 @@ bool RequestFileSystemDialogView::Accept() { |
| return true; |
| } |
| +gfx::Size RequestFileSystemDialogView::GetPreferredSize() const { |
| + return gfx::Size(kDialogMaxWidth, |
| + child_at(0)->GetHeightForWidth(kDialogMaxWidth)); |
| +} |
| + |
| +gfx::Insets RequestFileSystemDialogView::GetInsets() const { |
| + return ChromeLayoutProvider::Get()->GetInsetsMetric(views::INSETS_PANEL); |
| +} |
| + |
| RequestFileSystemDialogView::RequestFileSystemDialogView( |
| const extensions::Extension& extension, |
| base::WeakPtr<file_manager::Volume> volume, |
| @@ -132,11 +128,8 @@ RequestFileSystemDialogView::RequestFileSystemDialogView( |
| placeholder_offsets[1] + volume_name.length()), |
| bold_style); |
| - views::BoxLayout* const layout = new views::BoxLayout( |
| - views::BoxLayout::kHorizontal, views::kButtonHEdgeMarginNew, |
| - views::kPanelVertMargin, 0); |
| - contents_view_->SetLayoutManager(layout); |
| + views::FillLayout* const layout = new views::FillLayout(); |
|
Peter Kasting
2017/04/26 18:26:25
Nit: Or just inline into next line.
ananta
2017/04/26 19:42:20
Done.
|
| + SetLayoutManager(layout); |
| - label->SizeToFit(kDialogMaxWidth - 2 * views::kButtonHEdgeMarginNew); |
| - contents_view_->AddChildView(label); |
| + AddChildView(label); |
| } |