Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: ui/views/bubble/tooltip_icon.h

Issue 2684343006: Make the account chooser and CVC dialog use the same icon with toolip for Views. (Closed)
Patch Set: move files Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/bubble/tooltip_icon.h
diff --git a/chrome/browser/ui/views/autofill/tooltip_icon.h b/ui/views/bubble/tooltip_icon.h
similarity index 66%
rename from chrome/browser/ui/views/autofill/tooltip_icon.h
rename to ui/views/bubble/tooltip_icon.h
index 482ba0b963ad498f22c1fc40723cdb2593d1cef9..9fddcf97331802db6f5572a85a7b71310f12d0ac 100644
--- a/chrome/browser/ui/views/autofill/tooltip_icon.h
+++ b/ui/views/bubble/tooltip_icon.h
@@ -2,8 +2,8 @@
// 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_AUTOFILL_TOOLTIP_ICON_H_
-#define CHROME_BROWSER_UI_VIEWS_AUTOFILL_TOOLTIP_ICON_H_
+#ifndef UI_VIEWS_BUBBLE_TOOLTIP_ICON_H_
+#define UI_VIEWS_BUBBLE_TOOLTIP_ICON_H_
#include <memory>
@@ -17,35 +17,40 @@
#include "ui/views/mouse_watcher.h"
#include "ui/views/widget/widget_observer.h"
-namespace autofill {
+namespace views {
class InfoBubble;
// A tooltip icon that shows a bubble on hover. Looks like (?).
msw 2017/02/15 21:06:39 nit: "Looks like (i)."
vasilii 2017/02/16 14:28:07 Done.
-class TooltipIcon : public views::ImageView,
- public views::MouseWatcherListener,
- public views::WidgetObserver {
+class VIEWS_EXPORT TooltipIcon : public ImageView,
+ public MouseWatcherListener,
+ public WidgetObserver {
public:
static const char kViewClassName[];
msw 2017/02/15 21:06:39 nit: inline in TooltipIcon::GetClassName()
vasilii 2017/02/16 14:28:07 Done.
explicit TooltipIcon(const base::string16& tooltip);
~TooltipIcon() override;
- // views::ImageView:
+ // ImageView:
const char* GetClassName() const override;
void OnMouseEntered(const ui::MouseEvent& event) override;
void OnMouseExited(const ui::MouseEvent& event) override;
void OnGestureEvent(ui::GestureEvent* event) override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
- // views::MouseWatcherListener:
+ // MouseWatcherListener:
void MouseMovedOutOfHost() override;
- // views::WidgetObserver:
- void OnWidgetDestroyed(views::Widget* widget) override;
+ // WidgetObserver:
+ void OnWidgetDestroyed(Widget* widget) override;
- void set_bubble_arrow(views::BubbleBorder::Arrow arrow) {
- bubble_arrow_ = arrow;
+ // View:
msw 2017/02/15 21:06:39 nit: order after ImageView, reorder definition to
vasilii 2017/02/16 14:28:07 Done.
+ bool OnMousePressed(const ui::MouseEvent& event) override;
+
+ void set_bubble_arrow(BubbleBorder::Arrow arrow) { bubble_arrow_ = arrow; }
msw 2017/02/15 21:06:39 nit: remove setter and member (and bubble_border.h
vasilii 2017/02/16 14:28:07 Done.
+
+ void set_bubble_width(int preferred_width) {
+ preferred_width_ = preferred_width;
}
private:
@@ -68,20 +73,23 @@ class TooltipIcon : public views::ImageView,
// A bubble shown on hover. Weak; owns itself. NULL while hiding.
InfoBubble* bubble_;
+ // The width the tooltip prefers to be. Default is 0 (no preference).
+ int preferred_width_;
+
// The position of the bubble's arrow.
- views::BubbleBorder::Arrow bubble_arrow_;
+ BubbleBorder::Arrow bubble_arrow_;
// A timer to delay showing |bubble_|.
base::OneShotTimer show_timer_;
// A watcher that keeps |bubble_| open if the user's mouse enters it.
- std::unique_ptr<views::MouseWatcher> mouse_watcher_;
+ std::unique_ptr<MouseWatcher> mouse_watcher_;
- ScopedObserver<views::Widget, TooltipIcon> observer_;
+ ScopedObserver<Widget, TooltipIcon> observer_;
DISALLOW_COPY_AND_ASSIGN(TooltipIcon);
};
-} // namespace autofill
+} // namespace views
-#endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_TOOLTIP_ICON_H_
+#endif // UI_VIEWS_BUBBLE_TOOLTIP_ICON_H_

Powered by Google App Engine
This is Rietveld 408576698