Commit 5994c2d8 authored by Bettina Dea's avatar Bettina Dea Committed by Commit Bot

Move desktop IPH promo bubble to the right and removed shadow.

Previously the new tab desktop in-product help promo bubble was too
close to the new tab button. Thus, I had to move the the promo bubble
further from the anchor_view of the button. I also removed the shadow
from the new tab promo bubble. Note that new tab promo bubbles are
inactive.

Bug: 734132
Change-Id: I5ba93f841413d3985ff810fbb0f009b8627289bb
Reviewed-on: https://chromium-review.googlesource.com/797920
Commit-Queue: Bettina Dea <bdea@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521958}
parent 8c25eab6
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "components/variations/variations_associated_data.h" #include "components/variations/variations_associated_data.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/text_utils.h" #include "ui/gfx/text_utils.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/event_monitor.h" #include "ui/views/event_monitor.h"
...@@ -54,7 +53,8 @@ FeaturePromoBubbleView::FeaturePromoBubbleView( ...@@ -54,7 +53,8 @@ FeaturePromoBubbleView::FeaturePromoBubbleView(
views::BubbleBorder::Arrow arrow, views::BubbleBorder::Arrow arrow,
int string_specifier, int string_specifier,
ActivationAction activation_action) ActivationAction activation_action)
: BubbleDialogDelegateView(anchor_view, arrow) { : BubbleDialogDelegateView(anchor_view, arrow),
activation_action_(activation_action) {
UseCompactMargins(); UseCompactMargins();
if (!anchor_view) if (!anchor_view)
SetAnchorRect(anchor_rect); SetAnchorRect(anchor_rect);
...@@ -68,13 +68,14 @@ FeaturePromoBubbleView::FeaturePromoBubbleView( ...@@ -68,13 +68,14 @@ FeaturePromoBubbleView::FeaturePromoBubbleView(
SetLayoutManager(box_layout.release()); SetLayoutManager(box_layout.release());
AddChildView(new views::Label(l10n_util::GetStringUTF16(string_specifier))); AddChildView(new views::Label(l10n_util::GetStringUTF16(string_specifier)));
if (activation_action == ActivationAction::DO_NOT_ACTIVATE) {
if (activation_action == ActivationAction::DO_NOT_ACTIVATE)
set_can_activate(activation_action == ActivationAction::ACTIVATE); set_can_activate(activation_action == ActivationAction::ACTIVATE);
set_shadow(views::BubbleBorder::NO_SHADOW);
}
views::Widget* widget = views::BubbleDialogDelegateView::CreateBubble(this); views::Widget* widget = views::BubbleDialogDelegateView::CreateBubble(this);
if (activation_action == ActivationAction::DO_NOT_ACTIVATE) if (activation_action == ActivationAction::DO_NOT_ACTIVATE)
SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT);
UseCompactMargins();
widget->Show(); widget->Show();
if (activation_action == ActivationAction::ACTIVATE) if (activation_action == ActivationAction::ACTIVATE)
StartAutoCloseTimer(kDelayDefault); StartAutoCloseTimer(kDelayDefault);
...@@ -103,6 +104,17 @@ void FeaturePromoBubbleView::OnMouseExited(const ui::MouseEvent& event) { ...@@ -103,6 +104,17 @@ void FeaturePromoBubbleView::OnMouseExited(const ui::MouseEvent& event) {
StartAutoCloseTimer(kDelayShort); StartAutoCloseTimer(kDelayShort);
} }
gfx::Rect FeaturePromoBubbleView::GetBubbleBounds() {
gfx::Rect bounds = BubbleDialogDelegateView::GetBubbleBounds();
if (activation_action_ == ActivationAction::DO_NOT_ACTIVATE) {
if (base::i18n::IsRTL())
bounds.Offset(5, 0);
else
bounds.Offset(-5, 0);
}
return bounds;
}
void FeaturePromoBubbleView::StartAutoCloseTimer( void FeaturePromoBubbleView::StartAutoCloseTimer(
base::TimeDelta auto_close_duration) { base::TimeDelta auto_close_duration) {
timer_.Start(FROM_HERE, auto_close_duration, this, timer_.Start(FROM_HERE, auto_close_duration, this,
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/bubble/bubble_dialog_delegate.h" #include "ui/views/bubble/bubble_dialog_delegate.h"
namespace gfx { namespace gfx {
...@@ -62,12 +63,14 @@ class FeaturePromoBubbleView : public views::BubbleDialogDelegateView { ...@@ -62,12 +63,14 @@ class FeaturePromoBubbleView : public views::BubbleDialogDelegateView {
bool OnMousePressed(const ui::MouseEvent& event) override; bool OnMousePressed(const ui::MouseEvent& event) override;
void OnMouseEntered(const ui::MouseEvent& event) override; void OnMouseEntered(const ui::MouseEvent& event) override;
void OnMouseExited(const ui::MouseEvent& event) override; void OnMouseExited(const ui::MouseEvent& event) override;
gfx::Rect GetBubbleBounds() override;
// Starts a timer to close the promo bubble. // Starts a timer to close the promo bubble.
void StartAutoCloseTimer(base::TimeDelta auto_close_duration); void StartAutoCloseTimer(base::TimeDelta auto_close_duration);
// Timer used to auto close the bubble. // Timer used to auto close the bubble.
base::OneShotTimer timer_; base::OneShotTimer timer_;
const ActivationAction activation_action_;
DISALLOW_COPY_AND_ASSIGN(FeaturePromoBubbleView); DISALLOW_COPY_AND_ASSIGN(FeaturePromoBubbleView);
}; };
......
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