| 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 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_VIEW_H_ |
| 7 | 7 |
| 8 #include "extensions/browser/api/device_permissions_prompt.h" | 8 #include "extensions/browser/api/device_permissions_prompt.h" |
| 9 #include "ui/views/controls/table/table_view_observer.h" |
| 9 #include "ui/views/window/dialog_delegate.h" | 10 #include "ui/views/window/dialog_delegate.h" |
| 10 | 11 |
| 11 namespace views { | 12 namespace views { |
| 12 class TableView; | 13 class TableView; |
| 13 } | 14 } |
| 14 | 15 |
| 15 class DevicePermissionsTableModel; | 16 class DevicePermissionsTableModel; |
| 16 | 17 |
| 17 // Displays a device permissions selector prompt as a modal dialog constrained | 18 // Displays a device permissions selector prompt as a modal dialog constrained |
| 18 // to the window/tab displaying the given web contents. | 19 // to the window/tab displaying the given web contents. |
| 19 class DevicePermissionsDialogView : public views::DialogDelegateView { | 20 class DevicePermissionsDialogView : public views::DialogDelegateView, |
| 21 public views::TableViewObserver { |
| 20 public: | 22 public: |
| 21 DevicePermissionsDialogView( | 23 DevicePermissionsDialogView( |
| 22 scoped_refptr<extensions::DevicePermissionsPrompt::Prompt> prompt); | 24 scoped_refptr<extensions::DevicePermissionsPrompt::Prompt> prompt); |
| 23 ~DevicePermissionsDialogView() override; | 25 ~DevicePermissionsDialogView() override; |
| 24 | 26 |
| 25 // views::DialogDelegateView: | 27 // views::DialogDelegateView: |
| 26 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 28 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 29 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 27 ui::ModalType GetModalType() const override; | 30 ui::ModalType GetModalType() const override; |
| 28 base::string16 GetWindowTitle() const override; | 31 base::string16 GetWindowTitle() const override; |
| 29 void DeleteDelegate() override; | 32 void DeleteDelegate() override; |
| 30 bool Accept() override; | 33 bool Accept() override; |
| 31 gfx::Size GetPreferredSize() const override; | 34 gfx::Size GetPreferredSize() const override; |
| 32 | 35 |
| 36 // views::TableViewObserver: |
| 37 void OnSelectionChanged() override; |
| 38 |
| 33 private: | 39 private: |
| 34 scoped_refptr<extensions::DevicePermissionsPrompt::Prompt> prompt_; | 40 scoped_refptr<extensions::DevicePermissionsPrompt::Prompt> prompt_; |
| 35 | 41 |
| 36 // Displays the list of devices. | 42 // Displays the list of devices. |
| 37 views::TableView* table_view_; | 43 views::TableView* table_view_; |
| 38 std::unique_ptr<DevicePermissionsTableModel> table_model_; | 44 std::unique_ptr<DevicePermissionsTableModel> table_model_; |
| 39 }; | 45 }; |
| 40 | 46 |
| 41 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_VIEW_H_ | 47 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_VIEW_H_ |
| OLD | NEW |