| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/device_permissions_dialog_view.h" | 5 #include "chrome/browser/ui/views/extensions/device_permissions_dialog_view.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h" | 8 #include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h" |
| 9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 10 #include "components/constrained_window/constrained_window_views.h" | 10 #include "components/constrained_window/constrained_window_views.h" |
| 11 #include "components/web_modal/popup_manager.h" |
| 11 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 12 #include "device/usb/usb_device.h" | 13 #include "device/usb/usb_device.h" |
| 13 #include "extensions/common/extension.h" | 14 #include "extensions/common/extension.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/models/table_model.h" | 16 #include "ui/base/models/table_model.h" |
| 16 #include "ui/base/models/table_model_observer.h" | 17 #include "ui/base/models/table_model_observer.h" |
| 17 #include "ui/views/controls/label.h" | 18 #include "ui/views/controls/label.h" |
| 18 #include "ui/views/controls/table/table_view.h" | 19 #include "ui/views/controls/table/table_view.h" |
| 19 #include "ui/views/layout/box_layout.h" | 20 #include "ui/views/layout/box_layout.h" |
| 20 #include "ui/views/layout/layout_constants.h" | 21 #include "ui/views/layout/layout_constants.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 base::string16 DevicePermissionsDialogView::GetWindowTitle() const { | 150 base::string16 DevicePermissionsDialogView::GetWindowTitle() const { |
| 150 return prompt_->GetHeading(); | 151 return prompt_->GetHeading(); |
| 151 } | 152 } |
| 152 | 153 |
| 153 gfx::Size DevicePermissionsDialogView::GetPreferredSize() const { | 154 gfx::Size DevicePermissionsDialogView::GetPreferredSize() const { |
| 154 return gfx::Size(500, 250); | 155 return gfx::Size(500, 250); |
| 155 } | 156 } |
| 156 | 157 |
| 157 void ChromeDevicePermissionsPrompt::ShowDialog() { | 158 void ChromeDevicePermissionsPrompt::ShowDialog() { |
| 158 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 159 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 159 constrained_window::ShowWebModalDialogViews( | 160 |
| 160 new DevicePermissionsDialogView(prompt()), web_contents()); | 161 web_modal::PopupManager* popup_manager = |
| 162 web_modal::PopupManager::FromWebContents(web_contents()); |
| 163 if (popup_manager) { |
| 164 constrained_window::ShowWebModalDialogViews( |
| 165 new DevicePermissionsDialogView(prompt()), web_contents()); |
| 166 } else { |
| 167 prompt()->Dismissed(); |
| 168 } |
| 161 } | 169 } |
| OLD | NEW |