diff --git a/chrome/browser/ui/views/frame/hosted_app_button_container.cc b/chrome/browser/ui/views/frame/hosted_app_button_container.cc index e8851ad10304be..5da1c4c875ed83 100644 --- a/chrome/browser/ui/views/frame/hosted_app_button_container.cc +++ b/chrome/browser/ui/views/frame/hosted_app_button_container.cc @@ -80,11 +80,10 @@ constexpr base::TimeDelta HostedAppButtonContainer::kOriginFadeOutDuration; const base::TimeDelta HostedAppButtonContainer::kOriginTotalDuration = kOriginFadeInDuration + kOriginPauseDuration + kOriginFadeOutDuration; -class HostedAppButtonContainer::ContentSettingsContainer - : public views::View, - public ContentSettingImageView::Delegate { +class HostedAppButtonContainer::ContentSettingsContainer : public views::View { public: - explicit ContentSettingsContainer(BrowserView* browser_view); + explicit ContentSettingsContainer( + ContentSettingImageView::Delegate* delegate); ~ContentSettingsContainer() override = default; void UpdateContentSettingViewsVisibility() { @@ -132,26 +131,9 @@ class HostedAppButtonContainer::ContentSettingsContainer PreferredSizeChanged(); } - // ContentSettingsImageView::Delegate: - content::WebContents* GetContentSettingWebContents() override { - return browser_view_->GetActiveWebContents(); - } - ContentSettingBubbleModelDelegate* GetContentSettingBubbleModelDelegate() - override { - return browser_view_->browser()->content_setting_bubble_model_delegate(); - } - void OnContentSettingImageBubbleShown( - ContentSettingImageModel::ImageType type) const override { - UMA_HISTOGRAM_ENUMERATION( - "HostedAppFrame.ContentSettings.ImagePressed", type, - ContentSettingImageModel::ImageType::NUM_IMAGE_TYPES); - } - // Owned by the views hierarchy. std::vector content_setting_views_; - BrowserView* browser_view_; - DISALLOW_COPY_AND_ASSIGN(ContentSettingsContainer); }; @@ -165,12 +147,7 @@ HostedAppButtonContainer::GetContentSettingViewsForTesting() const { } HostedAppButtonContainer::ContentSettingsContainer::ContentSettingsContainer( - BrowserView* browser_view) - : browser_view_(browser_view) { - DCHECK( - extensions::HostedAppBrowserController::IsForExperimentalHostedAppBrowser( - browser_view->browser())); - + ContentSettingImageView::Delegate* delegate) { views::BoxLayout& layout = *SetLayoutManager(std::make_unique( views::BoxLayout::kHorizontal, gfx::Insets(), @@ -183,7 +160,7 @@ HostedAppButtonContainer::ContentSettingsContainer::ContentSettingsContainer( ContentSettingImageModel::GenerateContentSettingImageModels(); for (auto& model : models) { auto image_view = std::make_unique( - std::move(model), this, + std::move(model), delegate, views::NativeWidgetAura::GetWindowTitleFontList()); // Padding around content setting icons. constexpr int kContentSettingIconInteriorPadding = 4; @@ -205,7 +182,7 @@ HostedAppButtonContainer::HostedAppButtonContainer(views::Widget* widget, active_color_(active_color), inactive_color_(inactive_color), hosted_app_origin_text_(new HostedAppOriginText(browser_view->browser())), - content_settings_container_(new ContentSettingsContainer(browser_view)), + content_settings_container_(new ContentSettingsContainer(this)), page_action_icon_container_view_(new PageActionIconContainerView( {PageActionIconType::kFind, PageActionIconType::kZoom}, GetLayoutConstant(HOSTED_APP_PAGE_ACTION_ICON_SIZE), @@ -220,6 +197,9 @@ HostedAppButtonContainer::HostedAppButtonContainer(views::Widget* widget, false /* interactive */)), app_menu_button_(new HostedAppMenuButton(browser_view)) { DCHECK(browser_view_); + DCHECK( + extensions::HostedAppBrowserController::IsForExperimentalHostedAppBrowser( + browser_view_->browser())); views::BoxLayout& layout = *SetLayoutManager(std::make_unique( views::BoxLayout::kHorizontal, @@ -314,12 +294,20 @@ void HostedAppButtonContainer::DisableAnimationForTesting() { g_animation_disabled_for_testing = true; } +SkColor HostedAppButtonContainer::GetIconColor() const { + return paint_as_active_ ? active_color_ : inactive_color_; +} + +SkColor HostedAppButtonContainer::GetIconInkDropColor() const { + return color_utils::IsDark(GetIconColor()) ? SK_ColorBLACK : SK_ColorWHITE; +} + void HostedAppButtonContainer::UpdateChildrenColor() { - SkColor color = paint_as_active_ ? active_color_ : inactive_color_; - hosted_app_origin_text_->SetTextColor(color); - content_settings_container_->SetIconColor(color); - page_action_icon_container_view_->SetIconColor(color); - app_menu_button_->SetIconColor(color); + SkColor icon_color = GetIconColor(); + hosted_app_origin_text_->SetTextColor(icon_color); + content_settings_container_->SetIconColor(icon_color); + page_action_icon_container_view_->SetIconColor(icon_color); + app_menu_button_->SetColors(icon_color, GetIconInkDropColor()); } gfx::Size HostedAppButtonContainer::CalculatePreferredSize() const { @@ -371,11 +359,35 @@ HostedAppButtonContainer::CreateToolbarActionsBar( main_bar); } +SkColor HostedAppButtonContainer::GetPageActionInkDropColor() const { + return GetIconInkDropColor(); +} + content::WebContents* HostedAppButtonContainer::GetWebContentsForPageActionIconView() { return browser_view_->GetActiveWebContents(); } +SkColor HostedAppButtonContainer::GetContentSettingInkDropColor() const { + return GetIconInkDropColor(); +} + +content::WebContents* HostedAppButtonContainer::GetContentSettingWebContents() { + return browser_view_->GetActiveWebContents(); +} + +ContentSettingBubbleModelDelegate* +HostedAppButtonContainer::GetContentSettingBubbleModelDelegate() { + return browser_view_->browser()->content_setting_bubble_model_delegate(); +} + +void HostedAppButtonContainer::OnContentSettingImageBubbleShown( + ContentSettingImageModel::ImageType type) const { + UMA_HISTOGRAM_ENUMERATION( + "HostedAppFrame.ContentSettings.ImagePressed", type, + ContentSettingImageModel::ImageType::NUM_IMAGE_TYPES); +} + BrowserActionsContainer* HostedAppButtonContainer::GetBrowserActionsContainer() { return browser_actions_container_; diff --git a/chrome/browser/ui/views/frame/hosted_app_button_container.h b/chrome/browser/ui/views/frame/hosted_app_button_container.h index d68f595b1666e4..912e7bc1abf573 100644 --- a/chrome/browser/ui/views/frame/hosted_app_button_container.h +++ b/chrome/browser/ui/views/frame/hosted_app_button_container.h @@ -40,6 +40,7 @@ class Widget; class HostedAppButtonContainer : public views::AccessiblePaneView, public BrowserActionsContainer::Delegate, public PageActionIconView::Delegate, + public ContentSettingImageView::Delegate, public ToolbarButtonProvider, public ImmersiveModeController::Observer, public views::WidgetObserver { @@ -103,6 +104,8 @@ class HostedAppButtonContainer : public views::AccessiblePaneView, const std::vector& GetContentSettingViewsForTesting() const; + SkColor GetIconColor() const; + SkColor GetIconInkDropColor() const; void UpdateChildrenColor(); // views::View: @@ -120,8 +123,17 @@ class HostedAppButtonContainer : public views::AccessiblePaneView, ToolbarActionsBar* main_bar) const override; // PageActionIconView::Delegate: + SkColor GetPageActionInkDropColor() const override; content::WebContents* GetWebContentsForPageActionIconView() override; + // ContentSettingImageView::Delegate: + SkColor GetContentSettingInkDropColor() const override; + content::WebContents* GetContentSettingWebContents() override; + ContentSettingBubbleModelDelegate* GetContentSettingBubbleModelDelegate() + override; + void OnContentSettingImageBubbleShown( + ContentSettingImageModel::ImageType type) const override; + // ToolbarButtonProvider: BrowserActionsContainer* GetBrowserActionsContainer() override; PageActionIconContainerView* GetPageActionIconContainerView() override; diff --git a/chrome/browser/ui/views/frame/hosted_app_menu_button.cc b/chrome/browser/ui/views/frame/hosted_app_menu_button.cc index 80d9db0a04e171..4ef6f0fcbcdb76 100644 --- a/chrome/browser/ui/views/frame/hosted_app_menu_button.cc +++ b/chrome/browser/ui/views/frame/hosted_app_menu_button.cc @@ -49,9 +49,11 @@ HostedAppMenuButton::HostedAppMenuButton(BrowserView* browser_view) HostedAppMenuButton::~HostedAppMenuButton() {} -void HostedAppMenuButton::SetIconColor(SkColor color) { +void HostedAppMenuButton::SetColors(SkColor icon_color, + SkColor ink_drop_color) { SetImage(views::Button::STATE_NORMAL, - gfx::CreateVectorIcon(kBrowserToolsIcon, color)); + gfx::CreateVectorIcon(kBrowserToolsIcon, icon_color)); + ink_drop_color_ = ink_drop_color; } void HostedAppMenuButton::StartHighlightAnimation() { @@ -80,6 +82,10 @@ void HostedAppMenuButton::OnMenuButtonClicked(views::MenuButton* source, base::UserMetricsAction("HostedAppMenuButtonButton_Clicked")); } +SkColor HostedAppMenuButton::GetInkDropBaseColor() const { + return ink_drop_color_; +} + void HostedAppMenuButton::FadeHighlightOff() { if (!ShouldEnterHoveredState()) { GetInkDrop()->SetHoverHighlightFadeDurationMs( diff --git a/chrome/browser/ui/views/frame/hosted_app_menu_button.h b/chrome/browser/ui/views/frame/hosted_app_menu_button.h index e591d5ca977445..79eac39523d434 100644 --- a/chrome/browser/ui/views/frame/hosted_app_menu_button.h +++ b/chrome/browser/ui/views/frame/hosted_app_menu_button.h @@ -8,6 +8,7 @@ #include "base/timer/timer.h" #include "chrome/browser/ui/views/frame/app_menu_button.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/gfx/color_palette.h" #include "ui/views/controls/button/menu_button_listener.h" class BrowserView; @@ -19,8 +20,8 @@ class HostedAppMenuButton : public AppMenuButton, explicit HostedAppMenuButton(BrowserView* browser_view); ~HostedAppMenuButton() override; - // Sets the color of the menu button icon. - void SetIconColor(SkColor color); + // Sets the color of the menu button icon and highlight. + void SetColors(SkColor icon_color, SkColor ink_drop_color); // Fades the menu button highlight on and off. void StartHighlightAnimation(); @@ -30,6 +31,9 @@ class HostedAppMenuButton : public AppMenuButton, const gfx::Point& point, const ui::Event* event) override; + // InkDropHostView: + SkColor GetInkDropBaseColor() const override; + private: void FadeHighlightOff(); @@ -39,6 +43,8 @@ class HostedAppMenuButton : public AppMenuButton, // The containing browser view. BrowserView* browser_view_; + SkColor ink_drop_color_ = gfx::kPlaceholderColor; + base::OneShotTimer highlight_off_timer_; DISALLOW_COPY_AND_ASSIGN(HostedAppMenuButton); diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc index 0abc5c661fbc02..45e6c5fa05b48a 100644 --- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc +++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc @@ -153,16 +153,15 @@ bool ContentSettingImageView::IsBubbleShowing() const { return bubble_view_ != nullptr; } +SkColor ContentSettingImageView::GetInkDropBaseColor() const { + return delegate_->GetContentSettingInkDropColor(); +} + ContentSettingImageModel::ImageType ContentSettingImageView::GetTypeForTesting() const { return content_setting_image_model_->image_type(); } -SkColor ContentSettingImageView::GetInkDropBaseColor() const { - return icon_color_ ? icon_color_.value() - : IconLabelBubbleView::GetInkDropBaseColor(); -} - void ContentSettingImageView::OnWidgetDestroying(views::Widget* widget) { DCHECK(bubble_view_); DCHECK_EQ(bubble_view_->GetWidget(), widget); diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.h b/chrome/browser/ui/views/location_bar/content_setting_image_view.h index 17b6ce95691b03..4a785e12faead5 100644 --- a/chrome/browser/ui/views/location_bar/content_setting_image_view.h +++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.h @@ -38,6 +38,9 @@ class ContentSettingImageView : public IconLabelBubbleView, public: class Delegate { public: + // Gets the color to use for the ink highlight. + virtual SkColor GetContentSettingInkDropColor() const = 0; + // Gets the web contents the ContentSettingImageView is for. virtual content::WebContents* GetContentSettingWebContents() = 0; @@ -49,9 +52,6 @@ class ContentSettingImageView : public IconLabelBubbleView, // Invoked when a bubble is shown. virtual void OnContentSettingImageBubbleShown( ContentSettingImageModel::ImageType type) const {} - - protected: - virtual ~Delegate() {} }; ContentSettingImageView(std::unique_ptr image_model, @@ -75,11 +75,11 @@ class ContentSettingImageView : public IconLabelBubbleView, bool OnMousePressed(const ui::MouseEvent& event) override; bool OnKeyPressed(const ui::KeyEvent& event) override; void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; - SkColor GetInkDropBaseColor() const override; SkColor GetTextColor() const override; bool ShouldShowSeparator() const override; bool ShowBubble(const ui::Event& event) override; bool IsBubbleShowing() const override; + SkColor GetInkDropBaseColor() const override; ContentSettingImageModel::ImageType GetTypeForTesting() const; diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc index 28397eb2bac56b..963cda76ad2877 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc @@ -357,16 +357,6 @@ IconLabelBubbleView::CreateInkDropHighlight() const { return highlight; } -SkColor IconLabelBubbleView::GetInkDropBaseColor() const { - const SkColor ink_color_opaque = GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_TextfieldDefaultColor); - if (ui::MaterialDesignController::IsNewerMaterialUi()) { - // Opacity of the ink drop is set elsewhere, so just use full opacity here. - return ink_color_opaque; - } - return color_utils::DeriveDefaultIconColor(ink_color_opaque); -} - std::unique_ptr IconLabelBubbleView::CreateInkDropMask() const { if (!LocationBarView::IsRounded()) diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h index 182e563888b6cd..7c0b752ac8305b 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h @@ -141,8 +141,8 @@ class IconLabelBubbleView : public views::InkDropObserver, std::unique_ptr CreateInkDropRipple() const override; std::unique_ptr CreateInkDropHighlight() const override; - SkColor GetInkDropBaseColor() const override; std::unique_ptr CreateInkDropMask() const override; + SkColor GetInkDropBaseColor() const override = 0; // views::Button: bool IsTriggerableEvent(const ui::Event& event) override; diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view_unittest.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view_unittest.cc index 2f055f6a31d0a6..36c5662188b3d1 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view_unittest.cc @@ -84,6 +84,7 @@ class TestIconLabelBubbleView : public IconLabelBubbleView { protected: // IconLabelBubbleView: SkColor GetTextColor() const override { return kTestColor; } + SkColor GetInkDropBaseColor() const override { return kTestColor; } bool ShouldShowLabel() const override { return !IsShrinking() || diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index be9a915a3d0dac..61a3d96313c48e 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -333,6 +333,11 @@ SkColor LocationBarView::GetSecurityChipColor( state); } +SkColor LocationBarView::GetIconInkDropColor() const { + return GetNativeTheme()->GetSystemColor( + ui::NativeTheme::kColorId_TextfieldDefaultColor); +} + void LocationBarView::SetStarToggled(bool on) { if (star_view_) star_view_->SetToggled(on); @@ -749,6 +754,10 @@ WebContents* LocationBarView::GetWebContents() { //////////////////////////////////////////////////////////////////////////////// // LocationBarView, public ContentSettingImageView::Delegate implementation: +SkColor LocationBarView::GetContentSettingInkDropColor() const { + return GetIconInkDropColor(); +} + content::WebContents* LocationBarView::GetContentSettingWebContents() { return GetToolbarModel()->input_in_progress() ? nullptr : GetWebContents(); } @@ -760,6 +769,11 @@ LocationBarView::GetContentSettingBubbleModelDelegate() { //////////////////////////////////////////////////////////////////////////////// // LocationBarView, public PageActionIconView::Delegate implementation: + +SkColor LocationBarView::GetPageActionInkDropColor() const { + return GetIconInkDropColor(); +} + WebContents* LocationBarView::GetWebContentsForPageActionIconView() { return GetWebContents(); } diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index e441ae8244cd1f..2075a15849314b 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -137,6 +137,9 @@ class LocationBarView : public LocationBar, SkColor GetSecurityChipColor( security_state::SecurityLevel security_level) const; + // Returns the color to use for icon ink highlights. + SkColor GetIconInkDropColor() const; + // Returns the cached theme color tint for the location bar and results. OmniboxTint tint() const { return tint_; } @@ -239,6 +242,7 @@ class LocationBarView : public LocationBar, content::WebContents* GetWebContents() override; // ContentSettingImageView::Delegate: + SkColor GetContentSettingInkDropColor() const override; content::WebContents* GetContentSettingWebContents() override; ContentSettingBubbleModelDelegate* GetContentSettingBubbleModelDelegate() override; @@ -373,6 +377,7 @@ class LocationBarView : public LocationBar, const gfx::Point& p) override; // PageActionIconView::Delegate: + SkColor GetPageActionInkDropColor() const override; content::WebContents* GetWebContentsForPageActionIconView() override; // gfx::AnimationDelegate: diff --git a/chrome/browser/ui/views/location_bar/location_icon_view.cc b/chrome/browser/ui/views/location_bar/location_icon_view.cc index 86ffa0bda68bbd..2d6bd14e8967b8 100644 --- a/chrome/browser/ui/views/location_bar/location_icon_view.cc +++ b/chrome/browser/ui/views/location_bar/location_icon_view.cc @@ -96,6 +96,10 @@ bool LocationIconView::ShowBubble(const ui::Event& event) { return location_bar_->ShowPageInfoDialog(contents); } +SkColor LocationIconView::GetInkDropBaseColor() const { + return location_bar_->GetIconInkDropColor(); +} + void LocationIconView::GetAccessibleNodeData(ui::AXNodeData* node_data) { if (location_bar_->GetOmniboxView()->IsEditingOrEmpty()) { node_data->role = ax::mojom::Role::kImage; diff --git a/chrome/browser/ui/views/location_bar/location_icon_view.h b/chrome/browser/ui/views/location_bar/location_icon_view.h index 63ebb5f16fd9cc..1d4187e327b4a0 100644 --- a/chrome/browser/ui/views/location_bar/location_icon_view.h +++ b/chrome/browser/ui/views/location_bar/location_icon_view.h @@ -32,6 +32,7 @@ class LocationIconView : public IconLabelBubbleView { bool ShowBubble(const ui::Event& event) override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; bool IsBubbleShowing() const override; + SkColor GetInkDropBaseColor() const override; // Whether we should show the tooltip for this icon or not. void set_show_tooltip(bool show_tooltip) { show_tooltip_ = show_tooltip; } diff --git a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc index dcbb75d63c0f56..87edc03314816b 100644 --- a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc +++ b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc @@ -49,6 +49,10 @@ SkColor SelectedKeywordView::GetTextColor() const { return location_bar_->GetColor(OmniboxPart::LOCATION_BAR_SELECTED_KEYWORD); } +SkColor SelectedKeywordView::GetInkDropBaseColor() const { + return location_bar_->GetIconInkDropColor(); +} + gfx::Size SelectedKeywordView::CalculatePreferredSize() const { // Height will be ignored by the LocationBarView. return GetSizeForLabelWidth(full_label_.GetPreferredSize().width()); diff --git a/chrome/browser/ui/views/location_bar/selected_keyword_view.h b/chrome/browser/ui/views/location_bar/selected_keyword_view.h index 861f90071f9e72..0f3ea30859de9b 100644 --- a/chrome/browser/ui/views/location_bar/selected_keyword_view.h +++ b/chrome/browser/ui/views/location_bar/selected_keyword_view.h @@ -33,6 +33,7 @@ class SelectedKeywordView : public IconLabelBubbleView { // IconLabelBubbleView: SkColor GetTextColor() const override; + SkColor GetInkDropBaseColor() const override; // views::View: gfx::Size CalculatePreferredSize() const override; diff --git a/chrome/browser/ui/views/page_action/page_action_icon_view.cc b/chrome/browser/ui/views/page_action/page_action_icon_view.cc index a7d3b64953b512..615721fb4165c4 100644 --- a/chrome/browser/ui/views/page_action/page_action_icon_view.cc +++ b/chrome/browser/ui/views/page_action/page_action_icon_view.cc @@ -68,12 +68,6 @@ bool PageActionIconView::IsBubbleShowing() const { return GetBubble() != nullptr; } -SkColor PageActionIconView::GetTextColor() const { - // Returns the color of the label shown during animation. - return GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_LabelDisabledColor); -} - bool PageActionIconView::SetCommandEnabled(bool enabled) const { DCHECK(command_updater_); command_updater_->UpdateCommandEnabled(command_id_, enabled); @@ -84,6 +78,12 @@ bool PageActionIconView::Update() { return false; } +SkColor PageActionIconView::GetTextColor() const { + // Returns the color of the label shown during animation. + return GetNativeTheme()->GetSystemColor( + ui::NativeTheme::kColorId_LabelDisabledColor); +} + void PageActionIconView::GetAccessibleNodeData(ui::AXNodeData* node_data) { node_data->role = ax::mojom::Role::kButton; node_data->SetName(GetTextForTooltipAndAccessibleName()); @@ -205,16 +205,6 @@ PageActionIconView::CreateInkDropHighlight() const { return highlight; } -SkColor PageActionIconView::GetInkDropBaseColor() const { - const SkColor ink_color_opaque = GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_TextfieldDefaultColor); - if (ui::MaterialDesignController::IsNewerMaterialUi()) { - // Opacity of the ink drop is set elsewhere, so just use full opacity here. - return ink_color_opaque; - } - return color_utils::DeriveDefaultIconColor(ink_color_opaque); -} - std::unique_ptr PageActionIconView::CreateInkDropMask() const { if (!LocationBarView::IsRounded()) @@ -223,6 +213,10 @@ std::unique_ptr PageActionIconView::CreateInkDropMask() height() / 2.f); } +SkColor PageActionIconView::GetInkDropBaseColor() const { + return delegate_->GetPageActionInkDropColor(); +} + void PageActionIconView::OnGestureEvent(ui::GestureEvent* event) { if (event->type() == ui::ET_GESTURE_TAP) { AnimateInkDrop(views::InkDropState::ACTIVATED, event); diff --git a/chrome/browser/ui/views/page_action/page_action_icon_view.h b/chrome/browser/ui/views/page_action/page_action_icon_view.h index f0f73fb4ae9e76..897614daf41957 100644 --- a/chrome/browser/ui/views/page_action/page_action_icon_view.h +++ b/chrome/browser/ui/views/page_action/page_action_icon_view.h @@ -37,6 +37,9 @@ class PageActionIconView : public IconLabelBubbleView { public: class Delegate { public: + // Gets the color to use for the ink highlight. + virtual SkColor GetPageActionInkDropColor() const = 0; + virtual content::WebContents* GetWebContentsForPageActionIconView() = 0; }; @@ -73,8 +76,6 @@ class PageActionIconView : public IconLabelBubbleView { // Returns true if a related bubble is showing. bool IsBubbleShowing() const override; - SkColor GetTextColor() const override; - // Enables or disables the associated command. // Returns true if the command is enabled. bool SetCommandEnabled(bool enabled) const; @@ -89,6 +90,7 @@ class PageActionIconView : public IconLabelBubbleView { virtual void OnPressed(bool activated) {} // views::IconLabelBubbleView: + SkColor GetTextColor() const override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; bool GetTooltipText(const gfx::Point& p, base::string16* tooltip) const override; @@ -106,8 +108,8 @@ class PageActionIconView : public IconLabelBubbleView { std::unique_ptr CreateInkDropRipple() const override; std::unique_ptr CreateInkDropHighlight() const override; - SkColor GetInkDropBaseColor() const override; std::unique_ptr CreateInkDropMask() const override; + SkColor GetInkDropBaseColor() const override; // ui::EventHandler: void OnGestureEvent(ui::GestureEvent* event) override;