| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 0)); | 80 0)); |
| 81 return client; | 81 return client; |
| 82 } | 82 } |
| 83 | 83 |
| 84 views::NonClientFrameView* ChooserDialogView::CreateNonClientFrameView( | 84 views::NonClientFrameView* ChooserDialogView::CreateNonClientFrameView( |
| 85 views::Widget* widget) { | 85 views::Widget* widget) { |
| 86 // ChooserDialogView always has a parent, so ShouldUseCustomFrame() should | 86 // ChooserDialogView always has a parent, so ShouldUseCustomFrame() should |
| 87 // always be true. | 87 // always be true. |
| 88 DCHECK(ShouldUseCustomFrame()); | 88 DCHECK(ShouldUseCustomFrame()); |
| 89 return views::DialogDelegate::CreateDialogFrameView( | 89 return views::DialogDelegate::CreateDialogFrameView( |
| 90 widget, gfx::Insets(ChromeLayoutProvider::Get()->GetDistanceMetric( | 90 widget, ChromeLayoutProvider::Get()->GetInsetsMetric( |
| 91 DISTANCE_PANEL_CONTENT_MARGIN))); | 91 views::INSETS_BUBBLE_CONTENTS)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool ChooserDialogView::Accept() { | 94 bool ChooserDialogView::Accept() { |
| 95 device_chooser_content_view_->Accept(); | 95 device_chooser_content_view_->Accept(); |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool ChooserDialogView::Cancel() { | 99 bool ChooserDialogView::Cancel() { |
| 100 device_chooser_content_view_->Cancel(); | 100 device_chooser_content_view_->Cancel(); |
| 101 return true; | 101 return true; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 void ChromeDevicePermissionsPrompt::ShowDialogViews() { | 143 void ChromeDevicePermissionsPrompt::ShowDialogViews() { |
| 144 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 144 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 145 | 145 |
| 146 std::unique_ptr<ChooserController> chooser_controller( | 146 std::unique_ptr<ChooserController> chooser_controller( |
| 147 new DevicePermissionsDialogController(web_contents()->GetMainFrame(), | 147 new DevicePermissionsDialogController(web_contents()->GetMainFrame(), |
| 148 prompt())); | 148 prompt())); |
| 149 | 149 |
| 150 constrained_window::ShowWebModalDialogViews( | 150 constrained_window::ShowWebModalDialogViews( |
| 151 new ChooserDialogView(std::move(chooser_controller)), web_contents()); | 151 new ChooserDialogView(std::move(chooser_controller)), web_contents()); |
| 152 } | 152 } |
| OLD | NEW |