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

Side by Side Diff: ios/chrome/browser/translate/never_translate_infobar_controller.mm

Issue 975663002: Remove the distinction between informational and warning infobar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ios/chrome/browser/translate/never_translate_infobar_controller.h" 5 #include "ios/chrome/browser/translate/never_translate_infobar_controller.h"
6 6
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "components/translate/core/browser/translate_infobar_delegate.h" 9 #include "components/translate/core/browser/translate_infobar_delegate.h"
10 #include "grit/components_strings.h" 10 #include "grit/components_strings.h"
(...skipping 14 matching lines...) Expand all
25 25
26 @implementation NeverTranslateInfoBarController 26 @implementation NeverTranslateInfoBarController
27 27
28 #pragma mark - 28 #pragma mark -
29 #pragma mark InfoBarControllerProtocol 29 #pragma mark InfoBarControllerProtocol
30 30
31 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate 31 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate
32 frame:(CGRect)frame { 32 frame:(CGRect)frame {
33 translate::TranslateInfoBarDelegate* translateInfoBarDelegate = 33 translate::TranslateInfoBarDelegate* translateInfoBarDelegate =
34 delegate->AsTranslateInfoBarDelegate(); 34 delegate->AsTranslateInfoBarDelegate();
35 infobars::InfoBarDelegate* infoBarDelegate =
36 static_cast<infobars::InfoBarDelegate*>(translateInfoBarDelegate);
37 DCHECK(!infoBarView_); 35 DCHECK(!infoBarView_);
38 ios::ChromeBrowserProvider* provider = ios::GetChromeBrowserProvider(); 36 ios::ChromeBrowserProvider* provider = ios::GetChromeBrowserProvider();
39 infoBarView_.reset([provider->CreateInfoBarView() 37 infoBarView_.reset([provider->CreateInfoBarView()
40 initWithFrame:frame 38 initWithFrame:frame
41 delegate:delegate_ 39 delegate:delegate_]);
42 isWarning:infoBarDelegate->GetInfoBarType() ==
43 infobars::InfoBarDelegate::WARNING_TYPE]);
44 // Icon 40 // Icon
45 gfx::Image icon = translateInfoBarDelegate->GetIcon(); 41 gfx::Image icon = translateInfoBarDelegate->GetIcon();
46 if (!icon.IsEmpty()) 42 if (!icon.IsEmpty())
47 [infoBarView_ addLeftIcon:icon.ToUIImage()]; 43 [infoBarView_ addLeftIcon:icon.ToUIImage()];
48 // Main text. 44 // Main text.
49 base::string16 originalLanguage = translateInfoBarDelegate->language_name_at( 45 base::string16 originalLanguage = translateInfoBarDelegate->language_name_at(
50 translateInfoBarDelegate->original_language_index()); 46 translateInfoBarDelegate->original_language_index());
51 [infoBarView_ addLabel:l10n_util::GetNSStringF( 47 [infoBarView_ addLabel:l10n_util::GetNSStringF(
52 IDS_TRANSLATE_INFOBAR_NEVER_MESSAGE_IOS, 48 IDS_TRANSLATE_INFOBAR_NEVER_MESSAGE_IOS,
53 provider->GetStringProvider()->GetProductName(), 49 provider->GetStringProvider()->GetProductName(),
(...skipping 30 matching lines...) Expand all
84 delegate_->InfoBarDidCancel(); 80 delegate_->InfoBarDidCancel();
85 } else { 81 } else {
86 DCHECK(buttonId == TranslateInfoBarIOSTag::DENY_LANGUAGE || 82 DCHECK(buttonId == TranslateInfoBarIOSTag::DENY_LANGUAGE ||
87 buttonId == TranslateInfoBarIOSTag::DENY_WEBSITE); 83 buttonId == TranslateInfoBarIOSTag::DENY_WEBSITE);
88 delegate_->InfoBarButtonDidPress(buttonId); 84 delegate_->InfoBarButtonDidPress(buttonId);
89 } 85 }
90 } 86 }
91 } 87 }
92 88
93 @end 89 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698