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

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

Issue 2596813002: Remove ChromeBrowserProvider::CreateInfoBarView() method. (Closed)
Patch Set: Created 4 years 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/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/strings/grit/components_strings.h" 10 #include "components/strings/grit/components_strings.h"
11 #include "components/translate/core/browser/translate_infobar_delegate.h" 11 #include "components/translate/core/browser/translate_infobar_delegate.h"
12 #include "ios/chrome/browser/translate/translate_infobar_tags.h" 12 #include "ios/chrome/browser/translate/translate_infobar_tags.h"
13 #import "ios/chrome/browser/ui/infobars/infobar_view.h"
14 #import "ios/chrome/browser/ui/infobars/infobar_view_delegate.h"
15 #import "ios/chrome/browser/ui/infobars/infobar_view_protocol.h"
13 #include "ios/chrome/grit/ios_chromium_strings.h" 16 #include "ios/chrome/grit/ios_chromium_strings.h"
14 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
15 #import "ios/public/provider/chrome/browser/ui/infobar_view_delegate.h"
16 #import "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/gfx/image/image.h" 18 #include "ui/gfx/image/image.h"
19 19
20 @interface NeverTranslateInfoBarController () 20 @interface NeverTranslateInfoBarController ()
21 21
22 // Action for any of the user defined buttons. 22 // Action for any of the user defined buttons.
23 - (void)infoBarButtonDidPress:(id)sender; 23 - (void)infoBarButtonDidPress:(id)sender;
24 24
25 @end 25 @end
26 26
27 @implementation NeverTranslateInfoBarController 27 @implementation NeverTranslateInfoBarController
28 28
29 #pragma mark - 29 #pragma mark -
30 #pragma mark InfoBarControllerProtocol 30 #pragma mark InfoBarControllerProtocol
31 31
32 - (UIView<InfoBarViewProtocol>*)viewForDelegate: 32 - (UIView<InfoBarViewProtocol>*)viewForDelegate:
33 (infobars::InfoBarDelegate*)delegate 33 (infobars::InfoBarDelegate*)delegate
34 frame:(CGRect)frame { 34 frame:(CGRect)frame {
35 base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView; 35 base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView;
36 translate::TranslateInfoBarDelegate* translateInfoBarDelegate = 36 translate::TranslateInfoBarDelegate* translateInfoBarDelegate =
37 delegate->AsTranslateInfoBarDelegate(); 37 delegate->AsTranslateInfoBarDelegate();
38 ios::ChromeBrowserProvider* provider = ios::GetChromeBrowserProvider(); 38 infoBarView.reset(
39 infoBarView.reset(provider->CreateInfoBarView(frame, self.delegate)); 39 [[InfoBarView alloc] initWithFrame:frame delegate:self.delegate]);
40 // Icon 40 // Icon
41 gfx::Image icon = translateInfoBarDelegate->GetIcon(); 41 gfx::Image icon = translateInfoBarDelegate->GetIcon();
42 if (!icon.IsEmpty()) 42 if (!icon.IsEmpty())
43 [infoBarView addLeftIcon:icon.ToUIImage()]; 43 [infoBarView addLeftIcon:icon.ToUIImage()];
44 // Main text. 44 // Main text.
45 base::string16 originalLanguage = 45 base::string16 originalLanguage =
46 translateInfoBarDelegate->original_language_name(); 46 translateInfoBarDelegate->original_language_name();
47 [infoBarView 47 [infoBarView
48 addLabel:l10n_util::GetNSStringF(IDS_IOS_TRANSLATE_INFOBAR_NEVER_MESSAGE, 48 addLabel:l10n_util::GetNSStringF(IDS_IOS_TRANSLATE_INFOBAR_NEVER_MESSAGE,
49 originalLanguage)]; 49 originalLanguage)];
(...skipping 30 matching lines...) Expand all
80 self.delegate->InfoBarDidCancel(); 80 self.delegate->InfoBarDidCancel();
81 } else { 81 } else {
82 DCHECK(buttonId == TranslateInfoBarIOSTag::DENY_LANGUAGE || 82 DCHECK(buttonId == TranslateInfoBarIOSTag::DENY_LANGUAGE ||
83 buttonId == TranslateInfoBarIOSTag::DENY_WEBSITE); 83 buttonId == TranslateInfoBarIOSTag::DENY_WEBSITE);
84 self.delegate->InfoBarButtonDidPress(buttonId); 84 self.delegate->InfoBarButtonDidPress(buttonId);
85 } 85 }
86 } 86 }
87 } 87 }
88 88
89 @end 89 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698