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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 using device::UsbDevice; | 22 using device::UsbDevice; |
23 using extensions::DevicePermissionsPrompt; | 23 using extensions::DevicePermissionsPrompt; |
24 | 24 |
25 class DevicePermissionsTableModel | 25 class DevicePermissionsTableModel |
26 : public ui::TableModel, | 26 : public ui::TableModel, |
27 public DevicePermissionsPrompt::Prompt::Observer { | 27 public DevicePermissionsPrompt::Prompt::Observer { |
28 public: | 28 public: |
29 explicit DevicePermissionsTableModel( | 29 explicit DevicePermissionsTableModel( |
30 scoped_refptr<DevicePermissionsPrompt::Prompt> prompt) | 30 scoped_refptr<DevicePermissionsPrompt::Prompt> prompt) |
31 : prompt_(prompt) { | 31 : prompt_(prompt), observer_(nullptr) { |
32 prompt_->SetObserver(this); | 32 prompt_->SetObserver(this); |
33 } | 33 } |
34 | 34 |
35 ~DevicePermissionsTableModel() override { prompt_->SetObserver(nullptr); } | 35 ~DevicePermissionsTableModel() override { prompt_->SetObserver(nullptr); } |
36 | 36 |
37 // ui::TableModel | 37 // ui::TableModel |
38 int RowCount() override; | 38 int RowCount() override; |
39 base::string16 GetText(int row, int column) override; | 39 base::string16 GetText(int row, int column) override; |
40 void SetObserver(ui::TableModelObserver* observer) override; | 40 void SetObserver(ui::TableModelObserver* observer) override; |
41 | 41 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 gfx::Size DevicePermissionsDialogView::GetPreferredSize() const { | 156 gfx::Size DevicePermissionsDialogView::GetPreferredSize() const { |
157 return gfx::Size(500, 250); | 157 return gfx::Size(500, 250); |
158 } | 158 } |
159 | 159 |
160 void ChromeDevicePermissionsPrompt::ShowDialog() { | 160 void ChromeDevicePermissionsPrompt::ShowDialog() { |
161 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 161 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
162 constrained_window::ShowWebModalDialogViews( | 162 constrained_window::ShowWebModalDialogViews( |
163 new DevicePermissionsDialogView(delegate(), prompt()), web_contents()); | 163 new DevicePermissionsDialogView(delegate(), prompt()), web_contents()); |
164 } | 164 } |
OLD | NEW |