OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "chrome/browser/ui/browser_dialogs.h" | 13 #include "chrome/browser/ui/browser_dialogs.h" |
14 #include "ui/base/ui_base_types.h" | 14 #include "ui/base/ui_base_types.h" |
15 #include "ui/views/controls/table/table_view_observer.h" | 15 #include "ui/views/controls/table/table_view_observer.h" |
16 #include "ui/views/window/dialog_delegate.h" | 16 #include "ui/views/window/dialog_delegate.h" |
17 | 17 |
18 class GURL; | 18 class GURL; |
19 class TargetPickerTableModel; | 19 class TargetPickerTableModel; |
20 | 20 |
21 namespace views { | 21 namespace views { |
22 class TableView; | 22 class TableView; |
23 } | 23 } |
24 | 24 |
| 25 namespace { |
| 26 class WebShareTargetPickerViewTest; |
| 27 } |
| 28 |
25 // Dialog that presents the user with a list of share target apps. Allows the | 29 // Dialog that presents the user with a list of share target apps. Allows the |
26 // user to pick one target to be opened and have data passed to it. | 30 // user to pick one target to be opened and have data passed to it. |
27 // | 31 // |
28 // NOTE: This dialog has *not* been UI-reviewed, and is being used by an | 32 // NOTE: This dialog has *not* been UI-reviewed, and is being used by an |
29 // in-development feature (Web Share) behind a runtime flag. It should not be | 33 // in-development feature (Web Share) behind a runtime flag. It should not be |
30 // used by any released code until going through UI review. | 34 // used by any released code until going through UI review. |
31 class WebShareTargetPickerView : public views::DialogDelegateView, | 35 class WebShareTargetPickerView : public views::DialogDelegateView, |
32 public views::TableViewObserver { | 36 public views::TableViewObserver { |
33 public: | 37 public: |
34 // |targets| is a list of app title and manifest URL pairs that will be shown | 38 // |targets| is a list of app title and manifest URL pairs that will be shown |
(...skipping 17 matching lines...) Expand all Loading... |
52 bool Cancel() override; | 56 bool Cancel() override; |
53 bool Accept() override; | 57 bool Accept() override; |
54 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 58 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
55 bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 59 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
56 | 60 |
57 // views::TableViewObserver overrides: | 61 // views::TableViewObserver overrides: |
58 void OnSelectionChanged() override; | 62 void OnSelectionChanged() override; |
59 void OnDoubleClick() override; | 63 void OnDoubleClick() override; |
60 | 64 |
61 private: | 65 private: |
| 66 // For access to |table_|. |
| 67 friend class WebShareTargetPickerViewTest; |
| 68 |
62 views::TableView* table_ = nullptr; | 69 views::TableView* table_ = nullptr; |
63 | 70 |
64 const std::vector<std::pair<base::string16, GURL>> targets_; | 71 const std::vector<std::pair<base::string16, GURL>> targets_; |
65 std::unique_ptr<TargetPickerTableModel> table_model_; | 72 std::unique_ptr<TargetPickerTableModel> table_model_; |
66 | 73 |
67 base::Callback<void(base::Optional<std::string>)> close_callback_; | 74 base::Callback<void(base::Optional<std::string>)> close_callback_; |
68 | 75 |
69 DISALLOW_COPY_AND_ASSIGN(WebShareTargetPickerView); | 76 DISALLOW_COPY_AND_ASSIGN(WebShareTargetPickerView); |
70 }; | 77 }; |
71 | 78 |
72 #endif // CHROME_BROWSER_UI_VIEWS_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_ | 79 #endif // CHROME_BROWSER_UI_VIEWS_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_ |
OLD | NEW |