Commit 514dce03 authored by Melissa Zhang's avatar Melissa Zhang Committed by Commit Bot

[Sharesheet] Remove unused code. Fix crash bug.

This CL removes unused constructor code and fixes crash when
sharesheet is launched from non-files app.

Bug: 1132697
Change-Id: Ib61cf18393eaec5eae9b9f6ea7d16b2bfe6153fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2434069Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarEric Willigers <ericwilligers@chromium.org>
Commit-Queue: Melissa Zhang <melzhang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811498}
parent 5a1718f8
......@@ -32,17 +32,6 @@ SharesheetService::SharesheetService(Profile* profile)
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);
ShowBubbleWithDelegate(std::move(sharesheet_service_delegate),
std::move(intent), /*contains_hosted_document=*/false);
}
void SharesheetService::ShowBubble(content::WebContents* web_contents,
apps::mojom::IntentPtr intent) {
ShowBubble(web_contents, std::move(intent),
......
......@@ -49,8 +49,6 @@ class SharesheetService : public KeyedService {
// other applications and targets. |intent| contains the list of the
// files/content to be shared. If the files to share contains Google
// Drive hosted document, only drive share action will be shown.
void ShowBubble(views::View* bubble_anchor_view,
apps::mojom::IntentPtr intent);
void ShowBubble(content::WebContents* web_contents,
apps::mojom::IntentPtr intent);
void ShowBubble(content::WebContents* web_contents,
......
......@@ -16,14 +16,6 @@
namespace sharesheet {
SharesheetServiceDelegate::SharesheetServiceDelegate(
uint32_t id,
views::View* bubble_anchor_view,
SharesheetService* sharesheet_service)
: id_(id),
sharesheet_bubble_view_(
std::make_unique<SharesheetBubbleView>(bubble_anchor_view, this)),
sharesheet_service_(sharesheet_service) {}
SharesheetServiceDelegate::SharesheetServiceDelegate(
uint32_t id,
content::WebContents* web_contents,
......
......@@ -31,9 +31,6 @@ class SharesheetService;
// business logic in the sharesheet.
class SharesheetServiceDelegate : public SharesheetController {
public:
SharesheetServiceDelegate(uint32_t id,
views::View* bubble_anchor_view,
SharesheetService* sharesheet_service);
SharesheetServiceDelegate(uint32_t id,
content::WebContents* web_contents,
SharesheetService* sharesheet_service);
......
......@@ -81,26 +81,11 @@ void SetUpTargetColumnSet(views::GridLayout* layout) {
} // namespace
SharesheetBubbleView::SharesheetBubbleView(
views::View* anchor_view,
sharesheet::SharesheetServiceDelegate* delegate)
: delegate_(delegate) {
SetAnchorView(anchor_view);
CreateBubble();
}
SharesheetBubbleView::SharesheetBubbleView(
content::WebContents* web_contents,
sharesheet::SharesheetServiceDelegate* delegate)
: delegate_(delegate) {
// TODO(crbug.com/1097623): When supporting open from multiple apps,
// pass in |app_id| and get NativeWindow from it.
Profile* const profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
gfx::NativeWindow parent =
extensions::AppWindowRegistry::Get(profile)
->GetCurrentAppWindowForApp(extension_misc::kFilesManagerAppId)
->GetNativeWindow();
gfx::NativeWindow parent = web_contents->GetTopLevelNativeWindow();
set_parent_window(parent);
parent_view_ = views::Widget::GetWidgetForNativeWindow(parent)->GetRootView();
UpdateAnchorPosition();
......
......@@ -31,8 +31,6 @@ class SharesheetBubbleView : public views::BubbleDialogDelegateView,
public:
using TargetInfo = sharesheet::TargetInfo;
SharesheetBubbleView(views::View* anchor_view,
sharesheet::SharesheetServiceDelegate* delegate);
SharesheetBubbleView(content::WebContents* web_contents,
sharesheet::SharesheetServiceDelegate* delegate);
SharesheetBubbleView(const SharesheetBubbleView&) = delete;
......
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