blob: 37bb1a874ba1a37ff1b5db2ef92bbc2ea618c1d9 [file] [log] [blame]
Melissa Zhangdb4dffa2020-07-01 04:03:111// Copyright 2020 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_SHARESHEET_SHARESHEET_SERVICE_DELEGATE_H_
6#define CHROME_BROWSER_SHARESHEET_SHARESHEET_SERVICE_DELEGATE_H_
7
8#include <memory>
9
Melissa Zhangf55c7502020-07-21 12:36:0510#include "base/strings/string16.h"
Melissa Zhang93826e692020-07-14 04:39:0211#include "chrome/browser/sharesheet/sharesheet_controller.h"
Melissa Zhangb330e5ab82020-07-21 05:51:3612#include "chrome/browser/sharesheet/sharesheet_types.h"
Melissa Zhang59ca374f2020-07-22 05:55:5113#include "components/services/app_service/public/mojom/types.mojom.h"
Melissa Zhangdb4dffa2020-07-01 04:03:1114
Melissa Zhang93826e692020-07-14 04:39:0215class SharesheetBubbleView;
Melissa Zhangdb4dffa2020-07-01 04:03:1116
17namespace views {
18class View;
19}
20
Maggie Cai69305332020-08-04 23:28:2621namespace content {
22class WebContents;
23}
24
Melissa Zhangdb4dffa2020-07-01 04:03:1125namespace sharesheet {
26
27class SharesheetService;
28
Melissa Zhang93826e692020-07-14 04:39:0229// The SharesheetServiceDelegate is the middle point between the UI and the
30// business logic in the sharesheet.
31class SharesheetServiceDelegate : public SharesheetController {
Melissa Zhangdb4dffa2020-07-01 04:03:1132 public:
Maggie Cai69305332020-08-04 23:28:2633 SharesheetServiceDelegate(uint32_t id,
34 views::View* bubble_anchor_view,
35 SharesheetService* sharesheet_service);
36 SharesheetServiceDelegate(uint32_t id,
37 content::WebContents* web_contents,
38 SharesheetService* sharesheet_service);
Melissa Zhang93826e692020-07-14 04:39:0239 ~SharesheetServiceDelegate() override;
Melissa Zhangdb4dffa2020-07-01 04:03:1140 SharesheetServiceDelegate(const SharesheetServiceDelegate&) = delete;
41 SharesheetServiceDelegate& operator=(const SharesheetServiceDelegate&) =
42 delete;
43
Melissa Zhang59ca374f2020-07-22 05:55:5144 void ShowBubble(std::vector<TargetInfo> targets,
45 apps::mojom::IntentPtr intent);
Melissa Zhangf55c7502020-07-21 12:36:0546 void OnBubbleClosed(const base::string16& active_action);
47 void OnTargetSelected(const base::string16& target_name,
48 const TargetType type,
Melissa Zhang59ca374f2020-07-22 05:55:5149 apps::mojom::IntentPtr intent,
Melissa Zhangf55c7502020-07-21 12:36:0550 views::View* share_action_view);
51 void OnActionLaunched();
Melissa Zhang93826e692020-07-14 04:39:0252
53 // SharesheetController overrides
Melissa Zhangb330e5ab82020-07-21 05:51:3654 uint32_t GetId() override;
Melissa Zhang0f75f3b2020-08-19 05:24:2655 void SetSharesheetSize(const int& width, const int& height) override;
Melissa Zhangd1a8ba92020-08-07 00:32:4956 void CloseSharesheet() override;
Melissa Zhangdb4dffa2020-07-01 04:03:1157
58 private:
Melissa Zhangb330e5ab82020-07-21 05:51:3659 const uint32_t id_;
Melissa Zhangf55c7502020-07-21 12:36:0560 base::string16 active_action_;
Melissa Zhangdb4dffa2020-07-01 04:03:1161 std::unique_ptr<SharesheetBubbleView> sharesheet_bubble_view_;
Melissa Zhang93826e692020-07-14 04:39:0262 SharesheetService* sharesheet_service_;
Melissa Zhangdb4dffa2020-07-01 04:03:1163};
64
65} // namespace sharesheet
66
67#endif // CHROME_BROWSER_SHARESHEET_SHARESHEET_SERVICE_DELEGATE_H_