Commit 3a81050c authored by Melissa Zhang's avatar Melissa Zhang Committed by Commit Bot

[Sharesheet] Remove margins. Rank ShareActions before apps.

This CL removes margins and ensures Actions appear before apps.

Bug: 1097623
Change-Id: I787cb122e60f569a2085060ad32044fb9e86c437
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2342334Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Melissa Zhang <melzhang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796283}
parent 4932c6ce
...@@ -157,9 +157,9 @@ void SharesheetService::OnIconLoaded( ...@@ -157,9 +157,9 @@ void SharesheetService::OnIconLoaded(
base::OnceCallback<void(std::vector<TargetInfo> targets)> callback, base::OnceCallback<void(std::vector<TargetInfo> targets)> callback,
apps::mojom::IconValuePtr icon_value) { apps::mojom::IconValuePtr icon_value) {
const auto& app_id_and_activity = app_id_and_activities[index]; const auto& app_id_and_activity = app_id_and_activities[index];
targets.emplace(targets.begin(), TargetType::kApp, icon_value->uncompressed, targets.emplace_back(TargetType::kApp, icon_value->uncompressed,
base::UTF8ToUTF16(app_id_and_activity.app_id), base::UTF8ToUTF16(app_id_and_activity.app_id),
base::UTF8ToUTF16(app_id_and_activity.activity_name)); base::UTF8ToUTF16(app_id_and_activity.activity_name));
LoadAppIcons(std::move(app_id_and_activities), std::move(targets), index + 1, LoadAppIcons(std::move(app_id_and_activities), std::move(targets), index + 1,
std::move(callback)); std::move(callback));
...@@ -180,9 +180,8 @@ void SharesheetService::ShowBubbleWithDelegate( ...@@ -180,9 +180,8 @@ void SharesheetService::ShowBubbleWithDelegate(
auto& actions = sharesheet_action_cache_->GetShareActions(); auto& actions = sharesheet_action_cache_->GetShareActions();
auto iter = actions.begin(); auto iter = actions.begin();
while (iter != actions.end()) { while (iter != actions.end()) {
targets.emplace(targets.begin(), TargetType::kAction, targets.emplace_back(TargetType::kAction, (*iter)->GetActionIcon(),
(*iter)->GetActionIcon(), (*iter)->GetActionName(), (*iter)->GetActionName(), (*iter)->GetActionName());
(*iter)->GetActionName());
++iter; ++iter;
} }
......
...@@ -172,7 +172,7 @@ void SharesheetBubbleView::ShowBubble(std::vector<TargetInfo> targets, ...@@ -172,7 +172,7 @@ void SharesheetBubbleView::ShowBubble(std::vector<TargetInfo> targets,
} }
void SharesheetBubbleView::ShowActionView() { void SharesheetBubbleView::ShowActionView() {
main_view_->SetVisible(false); root_view_->SetVisible(false);
share_action_view_->SetVisible(true); share_action_view_->SetVisible(true);
} }
...@@ -218,6 +218,8 @@ void SharesheetBubbleView::CreateBubble() { ...@@ -218,6 +218,8 @@ void SharesheetBubbleView::CreateBubble() {
SetLayoutManager(std::make_unique<views::BoxLayout>( SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical)); views::BoxLayout::Orientation::kVertical));
set_margins(gfx::Insets());
auto root_view = std::make_unique<views::View>(); auto root_view = std::make_unique<views::View>();
root_view->SetLayoutManager(std::make_unique<views::BoxLayout>( root_view->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, gfx::Insets(kSpacing), 0, views::BoxLayout::Orientation::kVertical, gfx::Insets(kSpacing), 0,
...@@ -230,6 +232,6 @@ void SharesheetBubbleView::CreateBubble() { ...@@ -230,6 +232,6 @@ void SharesheetBubbleView::CreateBubble() {
auto share_action_view = std::make_unique<views::View>(); auto share_action_view = std::make_unique<views::View>();
share_action_view->SetLayoutManager(std::make_unique<views::BoxLayout>( share_action_view->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, gfx::Insets(), 0, true)); views::BoxLayout::Orientation::kVertical, gfx::Insets(), 0, true));
share_action_view_ = root_view_->AddChildView(std::move(share_action_view)); share_action_view_ = AddChildView(std::move(share_action_view));
share_action_view_->SetVisible(false); share_action_view_->SetVisible(false);
} }
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