OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/infobars/translate_message_infobar.h" | 5 #include "chrome/browser/ui/views/infobars/translate_message_infobar.h" |
6 | 6 |
7 #include "chrome/browser/translate/translate_infobar_delegate.h" | 7 #include "chrome/browser/translate/translate_infobar_delegate.h" |
8 #include "chrome/browser/ui/views/infobars/infobar_text_button.h" | 8 #include "views/controls/button/text_button.h" |
9 #include "views/controls/image_view.h" | 9 #include "views/controls/image_view.h" |
10 #include "views/controls/label.h" | 10 #include "views/controls/label.h" |
11 | 11 |
12 TranslateMessageInfoBar::TranslateMessageInfoBar( | 12 TranslateMessageInfoBar::TranslateMessageInfoBar( |
13 TranslateInfoBarDelegate* delegate) | 13 TranslateInfoBarDelegate* delegate) |
14 : TranslateInfoBarBase(delegate), | 14 : TranslateInfoBarBase(delegate), |
15 button_(NULL) { | 15 button_(NULL) { |
16 label_ = CreateLabel(delegate->GetMessageInfoBarText()); | 16 label_ = CreateLabel(delegate->GetMessageInfoBarText()); |
17 AddChildView(label_); | 17 AddChildView(label_); |
18 | 18 |
19 string16 button_text = delegate->GetMessageInfoBarButtonText(); | 19 string16 button_text = delegate->GetMessageInfoBarButtonText(); |
20 if (!button_text.empty()) { | 20 if (!button_text.empty()) { |
21 button_ = InfoBarTextButton::Create(this, button_text); | 21 button_ = CreateTextButton(this, button_text, false); |
22 AddChildView(button_); | 22 AddChildView(button_); |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 TranslateMessageInfoBar::~TranslateMessageInfoBar() { | 26 TranslateMessageInfoBar::~TranslateMessageInfoBar() { |
27 } | 27 } |
28 | 28 |
29 void TranslateMessageInfoBar::Layout() { | 29 void TranslateMessageInfoBar::Layout() { |
30 TranslateInfoBarBase::Layout(); | 30 TranslateInfoBarBase::Layout(); |
31 | 31 |
(...skipping 14 matching lines...) Expand all Loading... |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 void TranslateMessageInfoBar::ButtonPressed(views::Button* sender, | 49 void TranslateMessageInfoBar::ButtonPressed(views::Button* sender, |
50 const views::Event& event) { | 50 const views::Event& event) { |
51 if (sender == button_) | 51 if (sender == button_) |
52 GetDelegate()->MessageInfoBarButtonPressed(); | 52 GetDelegate()->MessageInfoBarButtonPressed(); |
53 else | 53 else |
54 TranslateInfoBarBase::ButtonPressed(sender, event); | 54 TranslateInfoBarBase::ButtonPressed(sender, event); |
55 } | 55 } |
OLD | NEW |