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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/infobars/infobar_tab_helper.h" | 8 #include "chrome/browser/infobars/infobar_tab_helper.h" |
9 #include "chrome/browser/translate/translate_infobar_delegate.h" | 9 #include "chrome/browser/translate/translate_infobar_delegate.h" |
10 #include "chrome/browser/ui/views/infobars/after_translate_infobar.h" | 10 #include "chrome/browser/ui/views/infobars/after_translate_infobar.h" |
11 #include "chrome/browser/ui/views/infobars/before_translate_infobar.h" | 11 #include "chrome/browser/ui/views/infobars/before_translate_infobar.h" |
12 #include "chrome/browser/ui/views/infobars/translate_message_infobar.h" | 12 #include "chrome/browser/ui/views/infobars/translate_message_infobar.h" |
13 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
14 #include "ui/base/animation/slide_animation.h" | 14 #include "ui/base/animation/slide_animation.h" |
15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
16 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
17 #include "ui/views/controls/button/menu_button.h" | 17 #include "ui/views/controls/button/menu_button.h" |
18 #include "ui/views/controls/label.h" | 18 #include "ui/views/controls/label.h" |
19 | 19 |
20 // TranslateInfoBarDelegate --------------------------------------------------- | 20 // TranslateInfoBarDelegate --------------------------------------------------- |
21 | 21 |
22 InfoBar* TranslateInfoBarDelegate::CreateInfoBar(InfoBarTabService* owner) { | 22 InfoBar* TranslateInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
23 InfoBarTabHelper* helper = static_cast<InfoBarTabHelper*>(owner); | 23 InfoBarTabHelper* helper = static_cast<InfoBarTabHelper*>(owner); |
24 TranslateInfoBarBase* infobar = NULL; | 24 TranslateInfoBarBase* infobar = NULL; |
25 switch (type_) { | 25 switch (type_) { |
26 case BEFORE_TRANSLATE: | 26 case BEFORE_TRANSLATE: |
27 infobar = new BeforeTranslateInfoBar(helper, this); | 27 infobar = new BeforeTranslateInfoBar(helper, this); |
28 break; | 28 break; |
29 case AFTER_TRANSLATE: | 29 case AFTER_TRANSLATE: |
30 infobar = new AfterTranslateInfoBar(helper, this); | 30 infobar = new AfterTranslateInfoBar(helper, this); |
31 break; | 31 break; |
32 case TRANSLATING: | 32 case TRANSLATING: |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 void TranslateInfoBarBase::FadeBackground(gfx::Canvas* canvas, | 128 void TranslateInfoBarBase::FadeBackground(gfx::Canvas* canvas, |
129 double animation_value, | 129 double animation_value, |
130 const views::Background& background) { | 130 const views::Background& background) { |
131 // Draw the background into an offscreen buffer with alpha value per animation | 131 // Draw the background into an offscreen buffer with alpha value per animation |
132 // value, then blend it back into the current canvas. | 132 // value, then blend it back into the current canvas. |
133 canvas->SaveLayerAlpha(static_cast<int>(animation_value * 255)); | 133 canvas->SaveLayerAlpha(static_cast<int>(animation_value * 255)); |
134 canvas->sk_canvas()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); | 134 canvas->sk_canvas()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); |
135 background.Paint(canvas, this); | 135 background.Paint(canvas, this); |
136 canvas->Restore(); | 136 canvas->Restore(); |
137 } | 137 } |
OLD | NEW |