| OLD | NEW |
| 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/after_translate_infobar_controller.h" | 5 #include "ios/chrome/browser/translate/after_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" |
| 11 #include "ios/chrome/browser/translate/translate_infobar_tags.h" | 11 #include "ios/chrome/browser/translate/translate_infobar_tags.h" |
| 12 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 12 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 13 #include "ios/public/provider/chrome/browser/string_provider.h" | 13 #include "ios/public/provider/chrome/browser/string_provider.h" |
| 14 #import "ios/public/provider/chrome/browser/ui/infobar_view_delegate.h" | 14 #import "ios/public/provider/chrome/browser/ui/infobar_view_delegate.h" |
| 15 #import "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h" | 15 #import "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
| 18 | 18 |
| 19 @interface AfterTranslateInfoBarController () { | 19 @interface AfterTranslateInfoBarController () { |
| 20 __weak translate::TranslateInfoBarDelegate* _translateInfoBarDelegate; | 20 translate::TranslateInfoBarDelegate* _translateInfoBarDelegate; // weak |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Action for any of the user defined buttons. | 23 // Action for any of the user defined buttons. |
| 24 - (void)infoBarButtonDidPress:(id)sender; | 24 - (void)infoBarButtonDidPress:(id)sender; |
| 25 | 25 |
| 26 @end | 26 @end |
| 27 | 27 |
| 28 @implementation AfterTranslateInfoBarController | 28 @implementation AfterTranslateInfoBarController |
| 29 | 29 |
| 30 #pragma mark - | 30 #pragma mark - |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 - (void)infoBarSwitchDidPress:(id)sender { | 119 - (void)infoBarSwitchDidPress:(id)sender { |
| 120 DCHECK_EQ(TranslateInfoBarIOSTag::ALWAYS_TRANSLATE_SWITCH, [sender tag]); | 120 DCHECK_EQ(TranslateInfoBarIOSTag::ALWAYS_TRANSLATE_SWITCH, [sender tag]); |
| 121 DCHECK([sender respondsToSelector:@selector(isOn)]); | 121 DCHECK([sender respondsToSelector:@selector(isOn)]); |
| 122 if (_translateInfoBarDelegate->ShouldAlwaysTranslate() != [sender isOn]) | 122 if (_translateInfoBarDelegate->ShouldAlwaysTranslate() != [sender isOn]) |
| 123 _translateInfoBarDelegate->ToggleAlwaysTranslate(); | 123 _translateInfoBarDelegate->ToggleAlwaysTranslate(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 @end | 126 @end |
| OLD | NEW |