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

Unified Diff: chrome/browser/ui/views/autofill/learn_more_icon.h

Issue 55243005: Implement learn more bubble on views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years, 1 month 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: chrome/browser/ui/views/autofill/learn_more_icon.h
diff --git a/chrome/browser/ui/views/autofill/learn_more_icon.h b/chrome/browser/ui/views/autofill/learn_more_icon.h
new file mode 100644
index 0000000000000000000000000000000000000000..54833b9ae1e26dd520de680a56d1935f0d8acf2a
--- /dev/null
+++ b/chrome/browser/ui/views/autofill/learn_more_icon.h
@@ -0,0 +1,60 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// 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_LEARN_MORE_ICON_H_
+#define CHROME_BROWSER_UI_VIEWS_AUTOFILL_LEARN_MORE_ICON_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/weak_ptr.h"
+#include "base/strings/string16.h"
+#include "ui/views/controls/image_view.h"
+
+namespace autofill {
+
+class LearnMoreIcon;
+
+// A delegate to notify when events happen.
Evan Stade 2013/11/05 02:01:40 I'd much prefer if the bubble were managed by the
Dan Beam 2013/11/05 07:00:55 Done.
+class LearnMoreIconDelegate {
+ public:
+ // Called when the mouse enters |source|.
+ virtual void OnLearnMoreIconMouseEntered(LearnMoreIcon* source) = 0;
+
+ // Called when the moust exits |source|.
+ virtual void OnLearnMoreIconMouseExited(LearnMoreIcon* source) = 0;
+};
+
+// A learn more icon (just an ImageView with some text to be shown in a bubble).
+// Looks like (?).
+class LearnMoreIcon : public views::ImageView {
Evan Stade 2013/11/05 02:01:40 leave the class name as TooltipIcon, or if you hat
Dan Beam 2013/11/05 07:00:55 left as is
+ public:
+ explicit LearnMoreIcon(const base::string16& learn_more_text,
+ const base::WeakPtr<LearnMoreIconDelegate>& delegate);
+ virtual ~LearnMoreIcon();
+
+ static const char kViewClassName[];
+
+ // views::ImageView:
+ virtual const char* GetClassName() const OVERRIDE;
+ virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
+ virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
+
+ const base::string16& learn_more_text() { return learn_more_text_; }
+
+ private:
+ // Changes the actively showing image to the resource identified by |idr|.
+ void ChangeImageTo(int idr);
+
+ // Text to be shown in an informational bubble when this icon is hovered.
+ base::string16 learn_more_text_;
+
+ // Weak, un-owned, and must outlive this class.
+ base::WeakPtr<LearnMoreIconDelegate> delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(LearnMoreIcon);
+};
+
+} // namespace autofill
+
+#endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_LEARN_MORE_ICON_H_

Powered by Google App Engine
This is Rietveld 408576698