Commit 32c3a1d1 authored by Melissa Zhang's avatar Melissa Zhang Committed by Commit Bot

[Sharesheet] Remove Sharesheet button from Toolbar

This CL removes the temporary button that was used to test
the sharesheet during development.

Bug: 1097623
Change-Id: Id75f93030cf07d67a33b061b432f38d8141500d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2371862Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Melissa Zhang <melzhang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801227}
parent 3c2bf33c
......@@ -3918,8 +3918,6 @@ static_library("ui") {
"views/toolbar/home_button.h",
"views/toolbar/reload_button.cc",
"views/toolbar/reload_button.h",
"views/toolbar/sharesheet_button.cc",
"views/toolbar/sharesheet_button.h",
"views/toolbar/toolbar_account_icon_container_view.cc",
"views/toolbar/toolbar_account_icon_container_view.h",
"views/toolbar/toolbar_action_view.cc",
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/toolbar/sharesheet_button.h"
#include <memory>
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sharesheet/sharesheet_service.h"
#include "chrome/browser/sharesheet/sharesheet_service_factory.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/base/pointer/touch_ui_controller.h"
#include "ui/gfx/paint_vector_icon.h"
SharesheetButton::SharesheetButton(Browser* browser)
: ToolbarButton(this), browser_(browser) {}
SharesheetButton::~SharesheetButton() = default;
void SharesheetButton::UpdateIcon() {
SetImageModel(views::Button::STATE_NORMAL,
ui::ImageModel::FromVectorIcon(
vector_icons::kHelpIcon,
GetThemeProvider()->GetColor(
ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON),
GetIconSize()));
}
void SharesheetButton::ButtonPressed(views::Button* sender,
const ui::Event& event) {
// On button press show sharesheet bubble.
auto* profile = Profile::FromBrowserContext(
browser_->tab_strip_model()->GetActiveWebContents()->GetBrowserContext());
auto* sharesheet_service =
sharesheet::SharesheetServiceFactory::GetForProfile(profile);
sharesheet_service->ShowBubble(/* bubble_anchor_view */ this,
/* intent */ nullptr);
}
int SharesheetButton::GetIconSize() const {
const bool touch_ui = ui::TouchUiController::Get()->touch_ui();
return (touch_ui && !browser_->app_controller()) ? kDefaultTouchableIconSize
: kDefaultIconSize;
}
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_SHARESHEET_BUTTON_H_
#define CHROME_BROWSER_UI_VIEWS_TOOLBAR_SHARESHEET_BUTTON_H_
#include "chrome/browser/ui/views/toolbar/toolbar_button.h"
class Browser;
class SharesheetButton : public ToolbarButton, public views::ButtonListener {
public:
explicit SharesheetButton(Browser* browser);
SharesheetButton(const SharesheetButton&) = delete;
SharesheetButton& operator=(const SharesheetButton&) = delete;
~SharesheetButton() override;
// ToolbarButton:
void UpdateIcon() override;
private:
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
int GetIconSize() const;
Browser* const browser_;
};
#endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_SHARESHEET_BUTTON_H_
......@@ -53,7 +53,6 @@
#include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h"
#include "chrome/browser/ui/views/toolbar/home_button.h"
#include "chrome/browser/ui/views/toolbar/reload_button.h"
#include "chrome/browser/ui/views/toolbar/sharesheet_button.h"
#include "chrome/browser/ui/views/toolbar/toolbar_account_icon_container_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_button.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
......@@ -232,13 +231,6 @@ void ToolbarView::Init() {
media_button = std::make_unique<MediaToolbarButtonView>(browser_);
}
std::unique_ptr<SharesheetButton> sharesheet_button;
#if defined(OS_CHROMEOS)
if (base::FeatureList::IsEnabled(features::kSharesheet)) {
sharesheet_button = std::make_unique<SharesheetButton>(browser_);
}
#endif
std::unique_ptr<ToolbarAccountIconContainerView>
toolbar_account_icon_container;
bool show_avatar_toolbar_button = true;
......@@ -276,9 +268,6 @@ void ToolbarView::Init() {
if (media_button)
media_button_ = AddChildView(std::move(media_button));
if (sharesheet_button)
sharesheet_button_ = AddChildView(std::move(sharesheet_button));
if (toolbar_account_icon_container) {
toolbar_account_icon_container_ =
AddChildView(std::move(toolbar_account_icon_container));
......
......@@ -49,7 +49,6 @@ class ExtensionsToolbarContainer;
class HomeButton;
class MediaToolbarButtonView;
class ReloadButton;
class SharesheetButton;
class ToolbarButton;
class ToolbarAccountIconContainerView;
......@@ -273,7 +272,6 @@ class ToolbarView : public views::AccessiblePaneView,
media_router::CastToolbarButton* cast_ = nullptr;
ToolbarAccountIconContainerView* toolbar_account_icon_container_ = nullptr;
AvatarToolbarButton* avatar_ = nullptr;
SharesheetButton* sharesheet_button_ = nullptr;
MediaToolbarButtonView* media_button_ = nullptr;
BrowserAppMenuButton* app_menu_button_ = nullptr;
......
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