| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chooser_dialog_view.h" | 5 #include "chrome/browser/ui/views/extensions/chooser_dialog_view.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "chrome/browser/chooser_controller/chooser_controller.h" | 9 #include "chrome/browser/chooser_controller/chooser_controller.h" |
| 10 #include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h" | 10 #include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 views::View* ChooserDialogView::CreateFootnoteView() { | 70 views::View* ChooserDialogView::CreateFootnoteView() { |
| 71 return device_chooser_content_view_->footnote_link(); | 71 return device_chooser_content_view_->footnote_link(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 views::ClientView* ChooserDialogView::CreateClientView(views::Widget* widget) { | 74 views::ClientView* ChooserDialogView::CreateClientView(views::Widget* widget) { |
| 75 views::DialogClientView* client = | 75 views::DialogClientView* client = |
| 76 new views::DialogClientView(widget, GetContentsView()); | 76 new views::DialogClientView(widget, GetContentsView()); |
| 77 | 77 |
| 78 constexpr int kMinWidth = 402; | |
| 79 constexpr int kMinHeight = 320; | |
| 80 int min_width = LayoutDelegate::Get()->GetDialogPreferredWidth( | |
| 81 LayoutDelegate::DialogWidth::MEDIUM); | |
| 82 if (!min_width) | |
| 83 min_width = kMinWidth; | |
| 84 client->set_minimum_size(gfx::Size(min_width, kMinHeight)); | |
| 85 | |
| 86 LayoutDelegate* delegate = LayoutDelegate::Get(); | 78 LayoutDelegate* delegate = LayoutDelegate::Get(); |
| 87 client->set_button_row_insets(gfx::Insets( | 79 client->set_button_row_insets(gfx::Insets( |
| 88 delegate->GetMetric( | 80 delegate->GetMetric( |
| 89 LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING), | 81 LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING), |
| 90 0, 0, 0)); | 82 0, 0, 0)); |
| 91 return client; | 83 return client; |
| 92 } | 84 } |
| 93 | 85 |
| 94 views::NonClientFrameView* ChooserDialogView::CreateNonClientFrameView( | 86 views::NonClientFrameView* ChooserDialogView::CreateNonClientFrameView( |
| 95 views::Widget* widget) { | 87 views::Widget* widget) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void ChromeDevicePermissionsPrompt::ShowDialogViews() { | 145 void ChromeDevicePermissionsPrompt::ShowDialogViews() { |
| 154 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 146 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 155 | 147 |
| 156 std::unique_ptr<ChooserController> chooser_controller( | 148 std::unique_ptr<ChooserController> chooser_controller( |
| 157 new DevicePermissionsDialogController(web_contents()->GetMainFrame(), | 149 new DevicePermissionsDialogController(web_contents()->GetMainFrame(), |
| 158 prompt())); | 150 prompt())); |
| 159 | 151 |
| 160 constrained_window::ShowWebModalDialogViews( | 152 constrained_window::ShowWebModalDialogViews( |
| 161 new ChooserDialogView(std::move(chooser_controller)), web_contents()); | 153 new ChooserDialogView(std::move(chooser_controller)), web_contents()); |
| 162 } | 154 } |
| OLD | NEW |