Commit ea6244a4 authored by Melissa Zhang's avatar Melissa Zhang Committed by Commit Bot

[Sharesheet] Pass intent to share action

Bug: 1097623
Change-Id: Iafdd79b44aa39829b310536b404822f921ce34e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2326851
Commit-Queue: Melissa Zhang <melzhang@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793019}
parent 8673a86c
......@@ -7,6 +7,7 @@
#include "base/strings/string16.h"
#include "chrome/browser/sharesheet/sharesheet_controller.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
#include "ui/gfx/image/image.h"
#include "ui/views/view.h"
......@@ -30,8 +31,12 @@ class ShareAction {
// |root_view| and |controller| will stay alive and visible until either
// ShareAction::OnClosing is called, or the ShareAction calls
// |controller|->ShareActionCompleted().
//
// |intent| contains the data (including the file URLs) for the share action
// to parse and interpret if needed for its UI and functionality.
virtual void LaunchAction(SharesheetController* controller,
views::View* root_view) = 0;
views::View* root_view,
apps::mojom::IntentPtr intent) = 0;
// OnClosing informs the ShareAction when the sharesheet with |controller| is
// closed. This occurs when the user presses the back button out of the share
......
......@@ -14,6 +14,7 @@
#include "chrome/browser/sharesheet/share_action.h"
#include "chrome/browser/sharesheet/sharesheet_service_delegate.h"
#include "chrome/browser/sharesheet/sharesheet_types.h"
#include "components/services/app_service/public/cpp/intent_util.h"
#include "ui/display/types/display_constants.h"
#include "ui/views/view.h"
......@@ -29,6 +30,8 @@ SharesheetService::~SharesheetService() = default;
void SharesheetService::ShowBubble(views::View* bubble_anchor_view,
apps::mojom::IntentPtr intent) {
DCHECK(intent->action == apps_util::kIntentActionSend ||
intent->action == apps_util::kIntentActionSendMultiple);
auto sharesheet_service_delegate =
std::make_unique<SharesheetServiceDelegate>(
delegate_counter_++, std::move(bubble_anchor_view), this);
......@@ -92,7 +95,7 @@ void SharesheetService::OnTargetSelected(uint32_t delegate_id,
if (share_action == nullptr)
return;
delegate->OnActionLaunched();
share_action->LaunchAction(delegate, share_action_view);
share_action->LaunchAction(delegate, share_action_view, std::move(intent));
} else if (type == TargetType::kApp) {
auto launch_source = apps::mojom::LaunchSource::kFromSharesheet;
app_service_proxy_->LaunchAppWithIntent(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment