| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool ChooserDialogView::IsDialogButtonEnabled(ui::DialogButton button) const { | 68 bool ChooserDialogView::IsDialogButtonEnabled(ui::DialogButton button) const { |
| 69 return device_chooser_content_view_->IsDialogButtonEnabled(button); | 69 return device_chooser_content_view_->IsDialogButtonEnabled(button); |
| 70 } | 70 } |
| 71 | 71 |
| 72 views::View* ChooserDialogView::CreateFootnoteView() { | 72 views::View* ChooserDialogView::CreateFootnoteView() { |
| 73 return device_chooser_content_view_->footnote_link(); | 73 return device_chooser_content_view_->footnote_link(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 views::ClientView* ChooserDialogView::CreateClientView(views::Widget* widget) { | |
| 77 views::DialogClientView* client = | |
| 78 new views::DialogClientView(widget, GetContentsView()); | |
| 79 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); | |
| 80 client->SetButtonRowInsets(gfx::Insets( | |
| 81 provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_VERTICAL), 0, 0, | |
| 82 0)); | |
| 83 return client; | |
| 84 } | |
| 85 | |
| 86 views::NonClientFrameView* ChooserDialogView::CreateNonClientFrameView( | |
| 87 views::Widget* widget) { | |
| 88 // ChooserDialogView always has a parent, so ShouldUseCustomFrame() should | |
| 89 // always be true. | |
| 90 DCHECK(ShouldUseCustomFrame()); | |
| 91 return views::DialogDelegate::CreateDialogFrameView( | |
| 92 widget, ChromeLayoutProvider::Get()->GetInsetsMetric( | |
| 93 views::INSETS_BUBBLE_CONTENTS)); | |
| 94 } | |
| 95 | |
| 96 bool ChooserDialogView::Accept() { | 76 bool ChooserDialogView::Accept() { |
| 97 device_chooser_content_view_->Accept(); | 77 device_chooser_content_view_->Accept(); |
| 98 return true; | 78 return true; |
| 99 } | 79 } |
| 100 | 80 |
| 101 bool ChooserDialogView::Cancel() { | 81 bool ChooserDialogView::Cancel() { |
| 102 device_chooser_content_view_->Cancel(); | 82 device_chooser_content_view_->Cancel(); |
| 103 return true; | 83 return true; |
| 104 } | 84 } |
| 105 | 85 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 void ChromeDevicePermissionsPrompt::ShowDialogViews() { | 125 void ChromeDevicePermissionsPrompt::ShowDialogViews() { |
| 146 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 126 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 147 | 127 |
| 148 std::unique_ptr<ChooserController> chooser_controller( | 128 std::unique_ptr<ChooserController> chooser_controller( |
| 149 new DevicePermissionsDialogController(web_contents()->GetMainFrame(), | 129 new DevicePermissionsDialogController(web_contents()->GetMainFrame(), |
| 150 prompt())); | 130 prompt())); |
| 151 | 131 |
| 152 constrained_window::ShowWebModalDialogViews( | 132 constrained_window::ShowWebModalDialogViews( |
| 153 new ChooserDialogView(std::move(chooser_controller)), web_contents()); | 133 new ChooserDialogView(std::move(chooser_controller)), web_contents()); |
| 154 } | 134 } |
| OLD | NEW |