Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Side by Side Diff: chrome/browser/ui/views/infobars/translate_infobar_base.cc

Issue 14175017: Remove one-click signin inforbar, since its now replaced with the gaia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.h"
9 #include "chrome/browser/translate/translate_infobar_delegate.h" 8 #include "chrome/browser/translate/translate_infobar_delegate.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 "grit/theme_resources.h" 12 #include "grit/theme_resources.h"
14 #include "ui/base/animation/slide_animation.h" 13 #include "ui/base/animation/slide_animation.h"
15 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/gfx/canvas.h" 15 #include "ui/gfx/canvas.h"
17 #include "ui/views/controls/button/menu_button.h" 16 #include "ui/views/controls/button/menu_button.h"
18 #include "ui/views/controls/label.h" 17 #include "ui/views/controls/label.h"
19 18
20 // TranslateInfoBarDelegate --------------------------------------------------- 19 // TranslateInfoBarDelegate ---------------------------------------------------
21 20
22 InfoBar* TranslateInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { 21 InfoBar* TranslateInfoBarDelegate::CreateInfoBar(InfoBarService* owner) {
23 if (infobar_type_ == BEFORE_TRANSLATE) 22 if (infobar_type_ == BEFORE_TRANSLATE)
24 return new BeforeTranslateInfoBar(owner, this); 23 return new BeforeTranslateInfoBar(owner, this);
25 if (infobar_type_ == AFTER_TRANSLATE) 24 if (infobar_type_ == AFTER_TRANSLATE)
26 return new AfterTranslateInfoBar(owner, this); 25 return new AfterTranslateInfoBar(owner, this);
27 return new TranslateMessageInfoBar(owner, this); 26 return new TranslateMessageInfoBar(owner, this);
28 } 27 }
29 28
30 // TranslateInfoBarBase ------------------------------------------------------- 29 // TranslateInfoBarBase -------------------------------------------------------
31 30
32 // static 31 // static
33 const int TranslateInfoBarBase::kButtonInLabelSpacing = 5; 32 const int TranslateInfoBarBase::kButtonInLabelSpacing = 5;
34 33
35 TranslateInfoBarBase::TranslateInfoBarBase(InfoBarService* owner, 34 TranslateInfoBarBase::TranslateInfoBarBase(InfoBarService* owner,
36 TranslateInfoBarDelegate* delegate) 35 TranslateInfoBarDelegate* delegate)
37 : InfoBarView(owner, delegate), 36 : InfoBarView(owner, delegate),
38 error_background_(GetInfoBarTopColor(InfoBarDelegate::WARNING_TYPE), 37 error_background_(InfoBarDelegate::WARNING_TYPE) {
39 GetInfoBarBottomColor(InfoBarDelegate::WARNING_TYPE)) {
40 } 38 }
41 39
42 TranslateInfoBarBase::~TranslateInfoBarBase() { 40 TranslateInfoBarBase::~TranslateInfoBarBase() {
43 } 41 }
44 42
45 void TranslateInfoBarBase::UpdateLanguageButtonText(views::MenuButton* button, 43 void TranslateInfoBarBase::UpdateLanguageButtonText(views::MenuButton* button,
46 const string16& text) { 44 const string16& text) {
47 DCHECK(button); 45 DCHECK(button);
48 button->SetText(text); 46 button->SetText(text);
49 // The button may have to grow to show the new text. 47 // The button may have to grow to show the new text.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 108
111 void TranslateInfoBarBase::FadeBackground(gfx::Canvas* canvas, 109 void TranslateInfoBarBase::FadeBackground(gfx::Canvas* canvas,
112 double animation_value, 110 double animation_value,
113 const views::Background& background) { 111 const views::Background& background) {
114 // Draw the background into an offscreen buffer with alpha value per animation 112 // Draw the background into an offscreen buffer with alpha value per animation
115 // value, then blend it back into the current canvas. 113 // value, then blend it back into the current canvas.
116 canvas->SaveLayerAlpha(static_cast<int>(animation_value * 255)); 114 canvas->SaveLayerAlpha(static_cast<int>(animation_value * 255));
117 background.Paint(canvas, this); 115 background.Paint(canvas, this);
118 canvas->Restore(); 116 canvas->Restore();
119 } 117 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/one_click_signin_infobar.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698