Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8801)

Unified Diff: chrome/browser/ui/views/webshare/webshare_target_picker_view.h

Issue 2667803002: Picker takes a vector of pairs, and passes back the user chosen target. (Closed)
Patch Set: Dynamically enable/disable button Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/webshare/webshare_target_picker_view.h
diff --git a/chrome/browser/ui/views/webshare/webshare_target_picker_view.h b/chrome/browser/ui/views/webshare/webshare_target_picker_view.h
index 324955ebf5d36df8916559983b0abb052a5de22e..b3898a7f602e795f63f3d14484a984f3c469ab77 100644
--- a/chrome/browser/ui/views/webshare/webshare_target_picker_view.h
+++ b/chrome/browser/ui/views/webshare/webshare_target_picker_view.h
@@ -13,8 +13,12 @@
#include "chrome/browser/ui/browser_dialogs.h"
#include "ui/base/models/table_model.h"
#include "ui/base/ui_base_types.h"
+#include "ui/views/controls/table/table_view.h"
+#include "ui/views/controls/table/table_view_observer.h"
#include "ui/views/window/dialog_delegate.h"
+class GURL;
+
// Dialog that presents the user with a list of share target apps. Allows the
// user to pick one target to be opened and have data passed to it.
//
@@ -22,14 +26,17 @@
// in-development feature (Web Share) behind a runtime flag. It should not be
// used by any released code until going through UI review.
class WebShareTargetPickerView : public views::DialogDelegateView,
+ public views::TableViewObserver,
public ui::TableModel {
public:
- // |targets| is a list of app titles that will be shown in a list. Calls
- // |close_callback| with SHARE if an app was chosen, or CANCEL if the dialog
- // was cancelled.
+ // |targets| is a list of app title and manifest URL pairs that will be shown
+ // in a list. If the user picks a target, this calls |callback| with the
+ // manifest URL of the chosen target, or returns null if the user cancelled
+ // the share.
WebShareTargetPickerView(
- const std::vector<base::string16>& targets,
- const base::Callback<void(SharePickerResult)>& close_callback);
+ const std::vector<std::pair<base::string16, GURL>>& targets,
+ const base::Callback<void(base::Optional<std::string>)>&
+ close_callback);
~WebShareTargetPickerView() override;
// views::View overrides:
@@ -43,6 +50,11 @@ class WebShareTargetPickerView : public views::DialogDelegateView,
bool Cancel() override;
bool Accept() override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
+ bool IsDialogButtonEnabled(ui::DialogButton button) const override;
+
+ // views::TableViewObserver overrides:
+ void OnSelectionChanged() override;
+ void OnDoubleClick() override;
// ui::TableModel overrides:
int RowCount() override;
@@ -50,9 +62,11 @@ class WebShareTargetPickerView : public views::DialogDelegateView,
void SetObserver(ui::TableModelObserver* observer) override;
private:
- const std::vector<base::string16> targets_;
+ views::TableView* table_;
+
+ const std::vector<std::pair<base::string16, GURL>> targets_;
- base::Callback<void(SharePickerResult)> close_callback_;
+ base::Callback<void(base::Optional<std::string>)> close_callback_;
DISALLOW_COPY_AND_ASSIGN(WebShareTargetPickerView);
};
« no previous file with comments | « chrome/browser/ui/browser_dialogs.h ('k') | chrome/browser/ui/views/webshare/webshare_target_picker_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698