| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/translate/translate_infobar_delegate.h" | |
| 9 #include "chrome/browser/translate/translate_tab_helper.h" | 8 #include "chrome/browser/translate/translate_tab_helper.h" |
| 10 #include "chrome/browser/ui/views/infobars/after_translate_infobar.h" | 9 #include "chrome/browser/ui/views/infobars/after_translate_infobar.h" |
| 11 #include "chrome/browser/ui/views/infobars/before_translate_infobar.h" | 10 #include "chrome/browser/ui/views/infobars/before_translate_infobar.h" |
| 12 #include "chrome/browser/ui/views/infobars/translate_message_infobar.h" | 11 #include "chrome/browser/ui/views/infobars/translate_message_infobar.h" |
| 13 #include "components/infobars/core/infobar.h" | 12 #include "components/infobars/core/infobar.h" |
| 13 #include "components/translate/core/browser/translate_infobar_delegate.h" |
| 14 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/gfx/animation/slide_animation.h" | 16 #include "ui/gfx/animation/slide_animation.h" |
| 17 #include "ui/gfx/canvas.h" | 17 #include "ui/gfx/canvas.h" |
| 18 #include "ui/views/controls/button/menu_button.h" | 18 #include "ui/views/controls/button/menu_button.h" |
| 19 #include "ui/views/controls/label.h" | 19 #include "ui/views/controls/label.h" |
| 20 | 20 |
| 21 | 21 |
| 22 // TranslateInfoBarDelegate --------------------------------------------------- | 22 // TranslateTabHelper ---------------------------------------------------------- |
| 23 | 23 |
| 24 // static | 24 scoped_ptr<infobars::InfoBar> TranslateTabHelper::CreateInfoBar( |
| 25 scoped_ptr<infobars::InfoBar> TranslateInfoBarDelegate::CreateInfoBar( | 25 scoped_ptr<TranslateInfoBarDelegate> delegate) const { |
| 26 scoped_ptr<TranslateInfoBarDelegate> delegate) { | |
| 27 if (delegate->translate_step() == | 26 if (delegate->translate_step() == |
| 28 translate::TRANSLATE_STEP_BEFORE_TRANSLATE) { | 27 translate::TRANSLATE_STEP_BEFORE_TRANSLATE) { |
| 29 return scoped_ptr<infobars::InfoBar>( | 28 return scoped_ptr<infobars::InfoBar>( |
| 30 new BeforeTranslateInfoBar(delegate.Pass())); | 29 new BeforeTranslateInfoBar(delegate.Pass())); |
| 31 } | 30 } |
| 32 if (delegate->translate_step() == | 31 if (delegate->translate_step() == |
| 33 translate::TRANSLATE_STEP_AFTER_TRANSLATE) { | 32 translate::TRANSLATE_STEP_AFTER_TRANSLATE) { |
| 34 return scoped_ptr<infobars::InfoBar>( | 33 return scoped_ptr<infobars::InfoBar>( |
| 35 new AfterTranslateInfoBar(delegate.Pass())); | 34 new AfterTranslateInfoBar(delegate.Pass())); |
| 36 } | 35 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 123 |
| 125 void TranslateInfoBarBase::FadeBackground(gfx::Canvas* canvas, | 124 void TranslateInfoBarBase::FadeBackground(gfx::Canvas* canvas, |
| 126 double animation_value, | 125 double animation_value, |
| 127 const views::Background& background) { | 126 const views::Background& background) { |
| 128 // Draw the background into an offscreen buffer with alpha value per animation | 127 // Draw the background into an offscreen buffer with alpha value per animation |
| 129 // value, then blend it back into the current canvas. | 128 // value, then blend it back into the current canvas. |
| 130 canvas->SaveLayerAlpha(static_cast<int>(animation_value * 255)); | 129 canvas->SaveLayerAlpha(static_cast<int>(animation_value * 255)); |
| 131 background.Paint(canvas, this); | 130 background.Paint(canvas, this); |
| 132 canvas->Restore(); | 131 canvas->Restore(); |
| 133 } | 132 } |
| OLD | NEW |