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/models/table_model.h" | 14 #include "ui/base/models/table_model.h" |
15 #include "ui/base/ui_base_types.h" | 15 #include "ui/base/ui_base_types.h" |
16 #include "ui/views/window/dialog_delegate.h" | 16 #include "ui/views/window/dialog_delegate.h" |
17 | 17 |
| 18 namespace views { |
| 19 class TableView; |
| 20 } |
| 21 |
| 22 namespace { |
| 23 class WebShareTargetPickerViewTest; |
| 24 } |
| 25 |
18 // Dialog that presents the user with a list of share target apps. Allows the | 26 // Dialog that presents the user with a list of share target apps. Allows the |
19 // user to pick one target to be opened and have data passed to it. | 27 // user to pick one target to be opened and have data passed to it. |
20 // | 28 // |
21 // NOTE: This dialog has *not* been UI-reviewed, and is being used by an | 29 // NOTE: This dialog has *not* been UI-reviewed, and is being used by an |
22 // in-development feature (Web Share) behind a runtime flag. It should not be | 30 // in-development feature (Web Share) behind a runtime flag. It should not be |
23 // used by any released code until going through UI review. | 31 // used by any released code until going through UI review. |
24 class WebShareTargetPickerView : public views::DialogDelegateView, | 32 class WebShareTargetPickerView : public views::DialogDelegateView, |
25 public ui::TableModel { | 33 public ui::TableModel { |
26 public: | 34 public: |
27 // |targets| is a list of app titles that will be shown in a list. Calls | 35 // |targets| is a list of app titles that will be shown in a list. Calls |
(...skipping 15 matching lines...) Expand all Loading... |
43 bool Cancel() override; | 51 bool Cancel() override; |
44 bool Accept() override; | 52 bool Accept() override; |
45 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 53 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
46 | 54 |
47 // ui::TableModel overrides: | 55 // ui::TableModel overrides: |
48 int RowCount() override; | 56 int RowCount() override; |
49 base::string16 GetText(int row, int column_id) override; | 57 base::string16 GetText(int row, int column_id) override; |
50 void SetObserver(ui::TableModelObserver* observer) override; | 58 void SetObserver(ui::TableModelObserver* observer) override; |
51 | 59 |
52 private: | 60 private: |
| 61 // For access to |table_|. |
| 62 friend class WebShareTargetPickerViewTest; |
| 63 |
| 64 views::TableView* table_; |
| 65 |
53 const std::vector<base::string16> targets_; | 66 const std::vector<base::string16> targets_; |
54 | 67 |
55 base::Callback<void(SharePickerResult)> close_callback_; | 68 base::Callback<void(SharePickerResult)> close_callback_; |
56 | 69 |
57 DISALLOW_COPY_AND_ASSIGN(WebShareTargetPickerView); | 70 DISALLOW_COPY_AND_ASSIGN(WebShareTargetPickerView); |
58 }; | 71 }; |
59 | 72 |
60 #endif // CHROME_BROWSER_UI_VIEWS_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_ | 73 #endif // CHROME_BROWSER_UI_VIEWS_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_ |
OLD | NEW |