| Index: ui/views/bubble/tooltip_icon.cc
 | 
| diff --git a/chrome/browser/ui/views/autofill/tooltip_icon.cc b/ui/views/bubble/tooltip_icon.cc
 | 
| similarity index 52%
 | 
| rename from chrome/browser/ui/views/autofill/tooltip_icon.cc
 | 
| rename to ui/views/bubble/tooltip_icon.cc
 | 
| index b2a2678f3c87c36595729ac2a62d71e66daaddaa..2041ad50c94645354a85bd561a1965021dc17e00 100644
 | 
| --- a/chrome/browser/ui/views/autofill/tooltip_icon.cc
 | 
| +++ b/ui/views/bubble/tooltip_icon.cc
 | 
| @@ -2,59 +2,23 @@
 | 
|  // 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/autofill/tooltip_icon.h"
 | 
| +#include "ui/views/bubble/tooltip_icon.h"
 | 
|  
 | 
| -#include "base/macros.h"
 | 
|  #include "base/timer/timer.h"
 | 
| -#include "chrome/browser/ui/views/autofill/info_bubble.h"
 | 
|  #include "ui/accessibility/ax_node_data.h"
 | 
|  #include "ui/gfx/paint_vector_icon.h"
 | 
|  #include "ui/gfx/vector_icons_public.h"
 | 
|  #include "ui/views/bubble/bubble_frame_view.h"
 | 
| +#include "ui/views/bubble/info_bubble.h"
 | 
|  #include "ui/views/mouse_watcher_view_host.h"
 | 
| -#include "ui/views/painter.h"
 | 
|  
 | 
| -namespace autofill {
 | 
| -
 | 
| -namespace {
 | 
| -
 | 
| -gfx::Insets GetPreferredInsets(const views::View* view) {
 | 
| -  gfx::Size pref_size = view->GetPreferredSize();
 | 
| -  gfx::Rect local_bounds = view->GetLocalBounds();
 | 
| -  gfx::Point origin = local_bounds.CenterPoint();
 | 
| -  origin.Offset(-pref_size.width() / 2, -pref_size.height() / 2);
 | 
| -  return gfx::Insets(origin.y(),
 | 
| -                     origin.x(),
 | 
| -                     local_bounds.bottom() - (origin.y() + pref_size.height()),
 | 
| -                     local_bounds.right() - (origin.x() + pref_size.width()));
 | 
| -}
 | 
| -
 | 
| -// An info bubble with some extra positioning magic for tooltip icons.
 | 
| -class TooltipBubble : public InfoBubble {
 | 
| - public:
 | 
| -  TooltipBubble(views::View* anchor, const base::string16& message)
 | 
| -      : InfoBubble(anchor, message) {}
 | 
| -  ~TooltipBubble() override {}
 | 
| -
 | 
| - protected:
 | 
| -  // InfoBubble:
 | 
| -  gfx::Rect GetAnchorRect() const override {
 | 
| -    gfx::Rect bounds = views::BubbleDialogDelegateView::GetAnchorRect();
 | 
| -    bounds.Inset(GetPreferredInsets(anchor()));
 | 
| -    return bounds;
 | 
| -  }
 | 
| -
 | 
| - private:
 | 
| -  DISALLOW_COPY_AND_ASSIGN(TooltipBubble);
 | 
| -};
 | 
| -
 | 
| -}  // namespace
 | 
| +namespace views {
 | 
|  
 | 
|  TooltipIcon::TooltipIcon(const base::string16& tooltip)
 | 
|      : tooltip_(tooltip),
 | 
|        mouse_inside_(false),
 | 
| -      bubble_(NULL),
 | 
| -      bubble_arrow_(views::BubbleBorder::TOP_RIGHT),
 | 
| +      bubble_(nullptr),
 | 
| +      preferred_width_(0),
 | 
|        observer_(this) {
 | 
|    SetDrawAsHovered(false);
 | 
|  }
 | 
| @@ -63,11 +27,8 @@ TooltipIcon::~TooltipIcon() {
 | 
|    HideBubble();
 | 
|  }
 | 
|  
 | 
| -// static
 | 
| -const char TooltipIcon::kViewClassName[] = "autofill/TooltipIcon";
 | 
| -
 | 
|  const char* TooltipIcon::GetClassName() const {
 | 
| -  return TooltipIcon::kViewClassName;
 | 
| +  return "TooltipIcon";
 | 
|  }
 | 
|  
 | 
|  void TooltipIcon::OnMouseEntered(const ui::MouseEvent& event) {
 | 
| @@ -80,6 +41,11 @@ void TooltipIcon::OnMouseExited(const ui::MouseEvent& event) {
 | 
|    show_timer_.Stop();
 | 
|  }
 | 
|  
 | 
| +bool TooltipIcon::OnMousePressed(const ui::MouseEvent& event) {
 | 
| +  // Swallow the click so that the parent doesn't process it.
 | 
| +  return true;
 | 
| +}
 | 
| +
 | 
|  void TooltipIcon::OnGestureEvent(ui::GestureEvent* event) {
 | 
|    if (event->type() == ui::ET_GESTURE_TAP) {
 | 
|      ShowBubble();
 | 
| @@ -102,7 +68,7 @@ void TooltipIcon::MouseMovedOutOfHost() {
 | 
|  }
 | 
|  
 | 
|  void TooltipIcon::SetDrawAsHovered(bool hovered) {
 | 
| -  SetImage(gfx::CreateVectorIcon(gfx::VectorIconId::HELP_OUTLINE, 18,
 | 
| +  SetImage(gfx::CreateVectorIcon(gfx::VectorIconId::INFO_OUTLINE, 18,
 | 
|                                   hovered
 | 
|                                       ? SkColorSetARGB(0xBD, 0, 0, 0)
 | 
|                                       : SkColorSetARGB(0xBD, 0x44, 0x44, 0x44)));
 | 
| @@ -114,8 +80,9 @@ void TooltipIcon::ShowBubble() {
 | 
|  
 | 
|    SetDrawAsHovered(true);
 | 
|  
 | 
| -  bubble_ = new TooltipBubble(this, tooltip_);
 | 
| -  bubble_->set_arrow(bubble_arrow_);
 | 
| +  bubble_ = new InfoBubble(this, tooltip_);
 | 
| +  bubble_->set_preferred_width(preferred_width_);
 | 
| +  bubble_->set_arrow(BubbleBorder::TOP_RIGHT);
 | 
|    // When shown due to a gesture event, close on deactivate (i.e. don't use
 | 
|    // "focusless").
 | 
|    bubble_->set_can_activate(!mouse_inside_);
 | 
| @@ -124,10 +91,10 @@ void TooltipIcon::ShowBubble() {
 | 
|    observer_.Add(bubble_->GetWidget());
 | 
|  
 | 
|    if (mouse_inside_) {
 | 
| -    views::View* frame = bubble_->GetWidget()->non_client_view()->frame_view();
 | 
| -    std::unique_ptr<views::MouseWatcherHost> host(
 | 
| -        new views::MouseWatcherViewHost(frame, gfx::Insets()));
 | 
| -    mouse_watcher_.reset(new views::MouseWatcher(host.release(), this));
 | 
| +    View* frame = bubble_->GetWidget()->non_client_view()->frame_view();
 | 
| +    std::unique_ptr<MouseWatcherHost> host(
 | 
| +        base::MakeUnique<MouseWatcherViewHost>(frame, gfx::Insets()));
 | 
| +    mouse_watcher_ = base::MakeUnique<MouseWatcher>(host.release(), this);
 | 
|      mouse_watcher_->Start();
 | 
|    }
 | 
|  }
 | 
| @@ -137,12 +104,12 @@ void TooltipIcon::HideBubble() {
 | 
|      bubble_->Hide();
 | 
|  }
 | 
|  
 | 
| -void TooltipIcon::OnWidgetDestroyed(views::Widget* widget) {
 | 
| +void TooltipIcon::OnWidgetDestroyed(Widget* widget) {
 | 
|    observer_.Remove(widget);
 | 
|  
 | 
|    SetDrawAsHovered(false);
 | 
|    mouse_watcher_.reset();
 | 
| -  bubble_ = NULL;
 | 
| +  bubble_ = nullptr;
 | 
|  }
 | 
|  
 | 
| -}  // namespace autofill
 | 
| +}  // namespace views
 | 
| 
 |