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

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

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.cc
diff --git a/chrome/browser/ui/views/autofill/learn_more_icon.cc b/chrome/browser/ui/views/autofill/learn_more_icon.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d0a45f3d2764ed2e3cfd4b09a64eef69c5b3b083
--- /dev/null
+++ b/chrome/browser/ui/views/autofill/learn_more_icon.cc
@@ -0,0 +1,45 @@
+// 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.
+
+#include "chrome/browser/ui/views/autofill/learn_more_icon.h"
+
+#include "grit/theme_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+
+namespace autofill {
+
+LearnMoreIcon::LearnMoreIcon(
+ const base::string16& learn_more_text,
+ const base::WeakPtr<LearnMoreIconDelegate>& delegate)
+ : learn_more_text_(learn_more_text),
+ delegate_(delegate) {
+ ChangeImageTo(IDR_AUTOFILL_LEARN_MORE_ICON);
+}
+
+LearnMoreIcon::~LearnMoreIcon() {}
+
+const char LearnMoreIcon::kViewClassName[] = "autofill/LearnMoreIcon";
+
+const char* LearnMoreIcon::GetClassName() const {
+ return kViewClassName;
+}
+
+void LearnMoreIcon::OnMouseEntered(const ui::MouseEvent& event) {
+ if (delegate_)
+ delegate_->OnLearnMoreIconMouseEntered(this);
+ ChangeImageTo(IDR_AUTOFILL_LEARN_MORE_ICON_H);
+}
+
+void LearnMoreIcon::OnMouseExited(const ui::MouseEvent& event) {
+ if (delegate_)
+ delegate_->OnLearnMoreIconMouseExited(this);
+ ChangeImageTo(IDR_AUTOFILL_LEARN_MORE_ICON);
+}
+
+void LearnMoreIcon::ChangeImageTo(int idr) {
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ SetImage(rb.GetImageNamed(idr).ToImageSkia());
+}
+
+} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698