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

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

Issue 2644793006: Add picker view for Web Share Target. (Closed)
Patch Set: Rebase. Created 3 years, 11 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
new file mode 100644
index 0000000000000000000000000000000000000000..324955ebf5d36df8916559983b0abb052a5de22e
--- /dev/null
+++ b/chrome/browser/ui/views/webshare/webshare_target_picker_view.h
@@ -0,0 +1,60 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_
+
+#include <vector>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "chrome/browser/ui/browser_dialogs.h"
+#include "ui/base/models/table_model.h"
+#include "ui/base/ui_base_types.h"
+#include "ui/views/window/dialog_delegate.h"
+
+// 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.
+//
+// NOTE: This dialog has *not* been UI-reviewed, and is being used by an
+// 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 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.
+ WebShareTargetPickerView(
+ const std::vector<base::string16>& targets,
+ const base::Callback<void(SharePickerResult)>& close_callback);
+ ~WebShareTargetPickerView() override;
+
+ // views::View overrides:
+ gfx::Size GetPreferredSize() const override;
+
+ // views::WidgetDelegate overrides:
+ ui::ModalType GetModalType() const override;
+ base::string16 GetWindowTitle() const override;
+
+ // views::DialogDelegate overrides:
+ bool Cancel() override;
+ bool Accept() override;
+ base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
+
+ // ui::TableModel overrides:
+ int RowCount() override;
+ base::string16 GetText(int row, int column_id) override;
+ void SetObserver(ui::TableModelObserver* observer) override;
+
+ private:
+ const std::vector<base::string16> targets_;
+
+ base::Callback<void(SharePickerResult)> close_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebShareTargetPickerView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_WEBSHARE_WEBSHARE_TARGET_PICKER_VIEW_H_
« 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