| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_ios_translate_client.h" | 5 #include "ios/chrome/browser/translate/chrome_ios_translate_client.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 break; | 79 break; |
| 80 case translate::TRANSLATE_STEP_TRANSLATING: | 80 case translate::TRANSLATE_STEP_TRANSLATING: |
| 81 case translate::TRANSLATE_STEP_TRANSLATE_ERROR: | 81 case translate::TRANSLATE_STEP_TRANSLATE_ERROR: |
| 82 controller.reset([[TranslateMessageInfoBarController alloc] | 82 controller.reset([[TranslateMessageInfoBarController alloc] |
| 83 initWithDelegate:infobar.get()]); | 83 initWithDelegate:infobar.get()]); |
| 84 break; | 84 break; |
| 85 default: | 85 default: |
| 86 NOTREACHED(); | 86 NOTREACHED(); |
| 87 } | 87 } |
| 88 infobar->SetController(controller); | 88 infobar->SetController(controller); |
| 89 // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required. |
| 89 return std::move(infobar); | 90 return std::move(infobar); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void ChromeIOSTranslateClient::ShowTranslateUI( | 93 void ChromeIOSTranslateClient::ShowTranslateUI( |
| 93 translate::TranslateStep step, | 94 translate::TranslateStep step, |
| 94 const std::string& source_language, | 95 const std::string& source_language, |
| 95 const std::string& target_language, | 96 const std::string& target_language, |
| 96 translate::TranslateErrors::Type error_type, | 97 translate::TranslateErrors::Type error_type, |
| 97 bool triggered_from_menu) { | 98 bool triggered_from_menu) { |
| 98 DCHECK(web_state()); | 99 DCHECK(web_state()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 const GURL& report_url) { | 148 const GURL& report_url) { |
| 148 NOTREACHED(); | 149 NOTREACHED(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 void ChromeIOSTranslateClient::WebStateDestroyed() { | 152 void ChromeIOSTranslateClient::WebStateDestroyed() { |
| 152 // Translation process can be interrupted. | 153 // Translation process can be interrupted. |
| 153 // Destroying the TranslateManager now guarantees that it never has to deal | 154 // Destroying the TranslateManager now guarantees that it never has to deal |
| 154 // with nullptr WebState. | 155 // with nullptr WebState. |
| 155 translate_manager_.reset(); | 156 translate_manager_.reset(); |
| 156 } | 157 } |
| OLD | NEW |