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