[Sharesheet] Add ShareAction interface and SharesheetController.
This CL adds an interface for ShareActions to implement and a
SharesheetController.
The SharesheetController makes changes to the Sharesheet bubble. It's
designed such that SharesheetServiceDelegate can use it to make all
bubble changes but ShareActions only have access to limited functions.
This CL also restructures the ownership between
SharesheetServiceDelegate, SharesheetService and SharesheetBubbleView.
The SharesheetService now owns the delegates which own the bubbles.
Bug: 1097623
Change-Id: I976b8e97be24877316163ff133d36b1670e8b35b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2275366
Commit-Queue: Melissa Zhang <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Dominick Ng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#788057}
diff --git a/chrome/browser/sharesheet/sharesheet_service_delegate.h b/chrome/browser/sharesheet/sharesheet_service_delegate.h
index 5fdf67a..9a737c6 100644
--- a/chrome/browser/sharesheet/sharesheet_service_delegate.h
+++ b/chrome/browser/sharesheet/sharesheet_service_delegate.h
@@ -7,11 +7,9 @@
#include <memory>
-class SharesheetBubbleView;
+#include "chrome/browser/sharesheet/sharesheet_controller.h"
-namespace content {
-class WebContents;
-} // namespace content
+class SharesheetBubbleView;
namespace views {
class View;
@@ -21,20 +19,30 @@
class SharesheetService;
-class SharesheetServiceDelegate {
+// The SharesheetServiceDelegate is the middle point between the UI and the
+// business logic in the sharesheet.
+class SharesheetServiceDelegate : public SharesheetController {
public:
- explicit SharesheetServiceDelegate(content::WebContents* web_contents,
- views::View* bubble_anchor_view);
- ~SharesheetServiceDelegate();
+ explicit SharesheetServiceDelegate(uint32_t id,
+ views::View* bubble_anchor_view,
+ SharesheetService* sharesheet_service);
+ ~SharesheetServiceDelegate() override;
SharesheetServiceDelegate(const SharesheetServiceDelegate&) = delete;
SharesheetServiceDelegate& operator=(const SharesheetServiceDelegate&) =
delete;
+ uint32_t GetId();
+
void ShowBubble();
+ void OnBubbleClosed();
+
+ // SharesheetController overrides
+ void ShareActionCompleted() override;
private:
+ uint32_t id_;
std::unique_ptr<SharesheetBubbleView> sharesheet_bubble_view_;
- std::unique_ptr<SharesheetService> sharesheet_service_;
+ SharesheetService* sharesheet_service_;
};
} // namespace sharesheet