blob: e957b2c397727dbf5fec0db36d3b0344b73243a1 [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 Zhang12f6a072020-09-30 21:16:0710#include "base/callback.h"
Melissa Zhangf55c7502020-07-21 12:36:0511#include "base/strings/string16.h"
Melissa Zhang93826e692020-07-14 04:39:0212#include "chrome/browser/sharesheet/sharesheet_controller.h"
Melissa Zhangb330e5ab82020-07-21 05:51:3613#include "chrome/browser/sharesheet/sharesheet_types.h"
Melissa Zhang59ca374f2020-07-22 05:55:5114#include "components/services/app_service/public/mojom/types.mojom.h"
Melissa Zhangdb4dffa2020-07-01 04:03:1115
Melissa Zhang575490a2020-08-31 07:14:4016class Profile;
Melissa Zhang93826e692020-07-14 04:39:0217class SharesheetBubbleView;
Melissa Zhangdb4dffa2020-07-01 04:03:1118
19namespace views {
20class View;
21}
22
Maggie Cai69305332020-08-04 23:28:2623namespace content {
24class WebContents;
25}
26
Melissa Zhanga8a835f2020-11-05 05:02:4627namespace gfx {
28struct VectorIcon;
29}
30
Melissa Zhangdb4dffa2020-07-01 04:03:1131namespace sharesheet {
32
33class SharesheetService;
34
Melissa Zhang93826e692020-07-14 04:39:0235// The SharesheetServiceDelegate is the middle point between the UI and the
36// business logic in the sharesheet.
37class SharesheetServiceDelegate : public SharesheetController {
Melissa Zhangdb4dffa2020-07-01 04:03:1138 public:
Maggie Cai69305332020-08-04 23:28:2639 SharesheetServiceDelegate(uint32_t id,
Maggie Cai69305332020-08-04 23:28:2640 content::WebContents* web_contents,
41 SharesheetService* sharesheet_service);
Melissa Zhang93826e692020-07-14 04:39:0242 ~SharesheetServiceDelegate() override;
Melissa Zhangdb4dffa2020-07-01 04:03:1143 SharesheetServiceDelegate(const SharesheetServiceDelegate&) = delete;
44 SharesheetServiceDelegate& operator=(const SharesheetServiceDelegate&) =
45 delete;
46
Melissa Zhang59ca374f2020-07-22 05:55:5147 void ShowBubble(std::vector<TargetInfo> targets,
Melissa Zhang12f6a072020-09-30 21:16:0748 apps::mojom::IntentPtr intent,
49 sharesheet::CloseCallback close_callback);
Melissa Zhangf55c7502020-07-21 12:36:0550 void OnBubbleClosed(const base::string16& active_action);
51 void OnTargetSelected(const base::string16& target_name,
52 const TargetType type,
Melissa Zhang59ca374f2020-07-22 05:55:5153 apps::mojom::IntentPtr intent,
Melissa Zhangf55c7502020-07-21 12:36:0554 views::View* share_action_view);
55 void OnActionLaunched();
Melissa Zhanga8a835f2020-11-05 05:02:4656 const gfx::VectorIcon* GetVectorIcon(const base::string16& display_name);
Melissa Zhang93826e692020-07-14 04:39:0257
58 // SharesheetController overrides
Melissa Zhangb330e5ab82020-07-21 05:51:3659 uint32_t GetId() override;
Melissa Zhang575490a2020-08-31 07:14:4060 Profile* GetProfile() override;
Melissa Zhang0f75f3b2020-08-19 05:24:2661 void SetSharesheetSize(const int& width, const int& height) override;
Melissa Zhangd1a8ba92020-08-07 00:32:4962 void CloseSharesheet() override;
Melissa Zhangdb4dffa2020-07-01 04:03:1163
64 private:
Melissa Zhangb330e5ab82020-07-21 05:51:3665 const uint32_t id_;
Melissa Zhangf55c7502020-07-21 12:36:0566 base::string16 active_action_;
Melissa Zhangdb4dffa2020-07-01 04:03:1167 std::unique_ptr<SharesheetBubbleView> sharesheet_bubble_view_;
Melissa Zhang93826e692020-07-14 04:39:0268 SharesheetService* sharesheet_service_;
Melissa Zhangdb4dffa2020-07-01 04:03:1169};
70
71} // namespace sharesheet
72
73#endif // CHROME_BROWSER_SHARESHEET_SHARESHEET_SERVICE_DELEGATE_H_