| 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_infobar_base.h" | 5 #include "chrome/browser/ui/views/infobars/translate_infobar_base.h" | 
| 6 | 6 | 
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" | 
| 8 #include "chrome/browser/translate/translate_infobar_delegate.h" | 8 #include "chrome/browser/translate/translate_infobar_delegate.h" | 
| 9 #include "chrome/browser/ui/views/infobars/after_translate_infobar.h" | 9 #include "chrome/browser/ui/views/infobars/after_translate_infobar.h" | 
| 10 #include "chrome/browser/ui/views/infobars/before_translate_infobar.h" | 10 #include "chrome/browser/ui/views/infobars/before_translate_infobar.h" | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 72   } | 72   } | 
| 73 | 73 | 
| 74   // This must happen after adding all other children so InfoBarView can ensure | 74   // This must happen after adding all other children so InfoBarView can ensure | 
| 75   // the close button is the last child. | 75   // the close button is the last child. | 
| 76   InfoBarView::ViewHierarchyChanged(is_add, parent, child); | 76   InfoBarView::ViewHierarchyChanged(is_add, parent, child); | 
| 77 } | 77 } | 
| 78 | 78 | 
| 79 void TranslateInfoBarBase::UpdateLanguageButtonText( | 79 void TranslateInfoBarBase::UpdateLanguageButtonText( | 
| 80     views::MenuButton* button, | 80     views::MenuButton* button, | 
| 81     LanguagesMenuModel::LanguageType language_type) { | 81     LanguagesMenuModel::LanguageType language_type) { | 
|  | 82   DCHECK(button); | 
| 82   TranslateInfoBarDelegate* delegate = GetDelegate(); | 83   TranslateInfoBarDelegate* delegate = GetDelegate(); | 
| 83   button->SetText(UTF16ToWideHack(delegate->GetLanguageDisplayableNameAt( | 84   button->SetText(UTF16ToWideHack(delegate->GetLanguageDisplayableNameAt( | 
| 84       (language_type == LanguagesMenuModel::ORIGINAL) ? | 85       (language_type == LanguagesMenuModel::ORIGINAL) ? | 
| 85           delegate->original_language_index() : | 86           delegate->original_language_index() : | 
| 86           delegate->target_language_index()))); | 87           delegate->target_language_index()))); | 
| 87   // The button may have to grow to show the new text. | 88   // The button may have to grow to show the new text. | 
| 88   Layout(); | 89   Layout(); | 
| 89   SchedulePaint(); | 90   SchedulePaint(); | 
| 90 } | 91 } | 
| 91 | 92 | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 126 void TranslateInfoBarBase::FadeBackground(gfx::Canvas* canvas, | 127 void TranslateInfoBarBase::FadeBackground(gfx::Canvas* canvas, | 
| 127                                           double animation_value, | 128                                           double animation_value, | 
| 128                                           const views::Background& background) { | 129                                           const views::Background& background) { | 
| 129   // Draw the background into an offscreen buffer with alpha value per animation | 130   // Draw the background into an offscreen buffer with alpha value per animation | 
| 130   // value, then blend it back into the current canvas. | 131   // value, then blend it back into the current canvas. | 
| 131   canvas->SaveLayerAlpha(static_cast<int>(animation_value * 255)); | 132   canvas->SaveLayerAlpha(static_cast<int>(animation_value * 255)); | 
| 132   canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); | 133   canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); | 
| 133   background.Paint(canvas, this); | 134   background.Paint(canvas, this); | 
| 134   canvas->Restore(); | 135   canvas->Restore(); | 
| 135 } | 136 } | 
| OLD | NEW | 
|---|