| 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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // used by any released code until going through UI review. | 31 // used by any released code until going through UI review. |
| 32 class WebShareTargetPickerView : public views::DialogDelegateView, | 32 class WebShareTargetPickerView : public views::DialogDelegateView, |
| 33 public views::TableViewObserver { | 33 public views::TableViewObserver { |
| 34 public: | 34 public: |
| 35 // |targets| is a list of app title and manifest URL pairs that will be shown | 35 // |targets| is a list of app title and manifest URL pairs that will be shown |
| 36 // in a list. If the user picks a target, this calls |callback| with the | 36 // in a list. If the user picks a target, this calls |callback| with the |
| 37 // manifest URL of the chosen target, or returns null if the user cancelled | 37 // manifest URL of the chosen target, or returns null if the user cancelled |
| 38 // the share. | 38 // the share. |
| 39 WebShareTargetPickerView( | 39 WebShareTargetPickerView( |
| 40 const std::vector<std::pair<base::string16, GURL>>& targets, | 40 const std::vector<std::pair<base::string16, GURL>>& targets, |
| 41 const base::Callback<void(base::Optional<std::string>)>& | 41 chrome::WebShareTargetPickerCallback close_callback); |
| 42 close_callback); | |
| 43 ~WebShareTargetPickerView() override; | 42 ~WebShareTargetPickerView() override; |
| 44 | 43 |
| 45 // views::View overrides: | 44 // views::View overrides: |
| 46 gfx::Size GetPreferredSize() const override; | 45 gfx::Size GetPreferredSize() const override; |
| 47 | 46 |
| 48 // views::WidgetDelegate overrides: | 47 // views::WidgetDelegate overrides: |
| 49 ui::ModalType GetModalType() const override; | 48 ui::ModalType GetModalType() const override; |
| 50 base::string16 GetWindowTitle() const override; | 49 base::string16 GetWindowTitle() const override; |
| 51 | 50 |
| 52 // views::DialogDelegate overrides: | 51 // views::DialogDelegate overrides: |
| 53 bool Cancel() override; | 52 bool Cancel() override; |
| 54 bool Accept() override; | 53 bool Accept() override; |
| 55 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 54 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 56 bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 55 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 57 | 56 |
| 58 // views::TableViewObserver overrides: | 57 // views::TableViewObserver overrides: |
| 59 void OnSelectionChanged() override; | 58 void OnSelectionChanged() override; |
| 60 void OnDoubleClick() override; | 59 void OnDoubleClick() override; |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 // For access to |table_|. | 62 // For access to |table_|. |
| 64 friend class WebShareTargetPickerViewTest; | 63 friend class WebShareTargetPickerViewTest; |
| 65 | 64 |
| 66 views::TableView* table_ = nullptr; | 65 views::TableView* table_ = nullptr; |
| 67 | 66 |
| 68 const std::vector<std::pair<base::string16, GURL>> targets_; | 67 const std::vector<std::pair<base::string16, GURL>> targets_; |
| 69 std::unique_ptr<TargetPickerTableModel> table_model_; | 68 std::unique_ptr<TargetPickerTableModel> table_model_; |
| 70 | 69 |
| 71 base::Callback<void(base::Optional<std::string>)> close_callback_; | 70 chrome::WebShareTargetPickerCallback close_callback_; |
| 72 | 71 |
| 73 DISALLOW_COPY_AND_ASSIGN(WebShareTargetPickerView); | 72 DISALLOW_COPY_AND_ASSIGN(WebShareTargetPickerView); |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 #endif // CHROME_BROWSER_UI_VIEWS_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_ | 75 #endif // CHROME_BROWSER_UI_VIEWS_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_ |
| OLD | NEW |