| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/views/autofill/learn_more_icon.h" |
| 6 |
| 7 #include "grit/theme_resources.h" |
| 8 #include "ui/base/resource/resource_bundle.h" |
| 9 |
| 10 namespace autofill { |
| 11 |
| 12 LearnMoreIcon::LearnMoreIcon( |
| 13 const base::string16& learn_more_text, |
| 14 const base::WeakPtr<LearnMoreIconDelegate>& delegate) |
| 15 : learn_more_text_(learn_more_text), |
| 16 delegate_(delegate) { |
| 17 ChangeImageTo(IDR_AUTOFILL_LEARN_MORE_ICON); |
| 18 } |
| 19 |
| 20 LearnMoreIcon::~LearnMoreIcon() {} |
| 21 |
| 22 const char LearnMoreIcon::kViewClassName[] = "autofill/LearnMoreIcon"; |
| 23 |
| 24 const char* LearnMoreIcon::GetClassName() const { |
| 25 return kViewClassName; |
| 26 } |
| 27 |
| 28 void LearnMoreIcon::OnMouseEntered(const ui::MouseEvent& event) { |
| 29 if (delegate_) |
| 30 delegate_->OnLearnMoreIconMouseEntered(this); |
| 31 ChangeImageTo(IDR_AUTOFILL_LEARN_MORE_ICON_H); |
| 32 } |
| 33 |
| 34 void LearnMoreIcon::OnMouseExited(const ui::MouseEvent& event) { |
| 35 if (delegate_) |
| 36 delegate_->OnLearnMoreIconMouseExited(this); |
| 37 ChangeImageTo(IDR_AUTOFILL_LEARN_MORE_ICON); |
| 38 } |
| 39 |
| 40 void LearnMoreIcon::ChangeImageTo(int idr) { |
| 41 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 42 SetImage(rb.GetImageNamed(idr).ToImageSkia()); |
| 43 } |
| 44 |
| 45 } // namespace autofill |
| OLD | NEW |