Commit 686e048c authored by Richard Knoll's avatar Richard Knoll Committed by Commit Bot

Fix SharingIcon visibility on ChromeOS.

The ClickToCall icon in the omnibox is attached to the
IntentPickerBubbleView on ChromeOS. We need to check that the bubble is
actually intended for ClickToCall though and only do that for
ClickToCall and not other sharing features.

Bug: 1013112
Change-Id: Id6d8b84f5e69189748b620b64cacc34453876501
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1852247Reviewed-by: default avatarAlex Chau <alexchau@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Commit-Queue: Bret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705494}
parent 6ad61ec6
...@@ -92,6 +92,8 @@ class IntentPickerBubbleView : public LocationBarBubbleDelegateView, ...@@ -92,6 +92,8 @@ class IntentPickerBubbleView : public LocationBarBubbleDelegateView,
bool ShouldShowCloseButton() const override; bool ShouldShowCloseButton() const override;
int GetDialogButtons() const override; int GetDialogButtons() const override;
PageActionIconType icon_type() const { return icon_type_; }
protected: protected:
// LocationBarBubbleDelegateView overrides: // LocationBarBubbleDelegateView overrides:
base::string16 GetWindowTitle() const override; base::string16 GetWindowTitle() const override;
......
...@@ -57,7 +57,7 @@ PageActionIconContainerView::PageActionIconContainerView(const Params& params) ...@@ -57,7 +57,7 @@ PageActionIconContainerView::PageActionIconContainerView(const Params& params)
ClickToCallUiController::GetOrCreateFromWebContents( ClickToCallUiController::GetOrCreateFromWebContents(
contents)); contents));
}), }),
base::BindRepeating(SharingDialogView::GetAsBubble)); base::BindRepeating(SharingDialogView::GetAsBubbleForClickToCall));
page_action_icons_.push_back(click_to_call_icon_); page_action_icons_.push_back(click_to_call_icon_);
break; break;
case PageActionIconType::kCookieControls: case PageActionIconType::kCookieControls:
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "chrome/browser/ui/page_action/page_action_icon_type.h"
#include "chrome/browser/ui/views/intent_picker_bubble_view.h" #include "chrome/browser/ui/views/intent_picker_bubble_view.h"
#endif #endif
...@@ -315,9 +316,18 @@ void SharingDialogView::WindowClosing() { ...@@ -315,9 +316,18 @@ void SharingDialogView::WindowClosing() {
// static // static
views::BubbleDialogDelegateView* SharingDialogView::GetAsBubble( views::BubbleDialogDelegateView* SharingDialogView::GetAsBubble(
SharingDialog* dialog) { SharingDialog* dialog) {
return static_cast<SharingDialogView*>(dialog);
}
// static
views::BubbleDialogDelegateView* SharingDialogView::GetAsBubbleForClickToCall(
SharingDialog* dialog) {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
if (!dialog) if (!dialog) {
return IntentPickerBubbleView::intent_picker_bubble(); auto* bubble = IntentPickerBubbleView::intent_picker_bubble();
if (bubble && bubble->icon_type() == PageActionIconType::kClickToCall)
return bubble;
}
#endif #endif
return static_cast<SharingDialogView*>(dialog); return static_cast<SharingDialogView*>(dialog);
} }
...@@ -59,6 +59,9 @@ class SharingDialogView : public SharingDialog, ...@@ -59,6 +59,9 @@ class SharingDialogView : public SharingDialog,
static views::BubbleDialogDelegateView* GetAsBubble(SharingDialog* dialog); static views::BubbleDialogDelegateView* GetAsBubble(SharingDialog* dialog);
static views::BubbleDialogDelegateView* GetAsBubbleForClickToCall(
SharingDialog* dialog);
private: private:
friend class SharingDialogViewTest; friend class SharingDialogViewTest;
FRIEND_TEST_ALL_PREFIXES(SharingDialogViewTest, PopulateDialogView); FRIEND_TEST_ALL_PREFIXES(SharingDialogViewTest, PopulateDialogView);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/views/sharing/sharing_icon_view.h" #include "chrome/browser/ui/views/sharing/sharing_icon_view.h"
#include "chrome/app/vector_icons/vector_icons.h" #include "chrome/app/vector_icons/vector_icons.h"
#include "components/vector_icons/vector_icons.h" #include "components/vector_icons/vector_icons.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
......
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