| 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 "components/translate/ios/browser/ios_translate_driver.h" | 5 #include "components/translate/ios/browser/ios_translate_driver.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "ios/web/public/load_committed_details.h" | 22 #include "ios/web/public/load_committed_details.h" |
| 23 #include "ios/web/public/navigation_item.h" | 23 #include "ios/web/public/navigation_item.h" |
| 24 #include "ios/web/public/navigation_manager.h" | 24 #include "ios/web/public/navigation_manager.h" |
| 25 #include "ios/web/public/referrer.h" | 25 #include "ios/web/public/referrer.h" |
| 26 #include "ios/web/public/web_state/js/crw_js_injection_receiver.h" | 26 #include "ios/web/public/web_state/js/crw_js_injection_receiver.h" |
| 27 #include "ios/web/public/web_state/web_state.h" | 27 #include "ios/web/public/web_state/web_state.h" |
| 28 #include "ui/base/page_transition_types.h" | 28 #include "ui/base/page_transition_types.h" |
| 29 #include "ui/base/window_open_disposition.h" | 29 #include "ui/base/window_open_disposition.h" |
| 30 #include "url/gurl.h" | 30 #include "url/gurl.h" |
| 31 | 31 |
| 32 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 33 #error "This file requires ARC support." |
| 34 #endif |
| 35 |
| 32 namespace translate { | 36 namespace translate { |
| 33 | 37 |
| 34 namespace { | 38 namespace { |
| 35 // The delay we wait in milliseconds before checking whether the translation has | 39 // The delay we wait in milliseconds before checking whether the translation has |
| 36 // finished. | 40 // finished. |
| 37 // Note: This should be kept in sync with the constant of the same name in | 41 // Note: This should be kept in sync with the constant of the same name in |
| 38 // translate_ios.js. | 42 // translate_ios.js. |
| 39 const int kTranslateStatusCheckDelayMs = 400; | 43 const int kTranslateStatusCheckDelayMs = 400; |
| 40 // Language name passed to the Translate element for it to detect the language. | 44 // Language name passed to the Translate element for it to detect the language. |
| 41 const char kAutoDetectionLanguage[] = "auto"; | 45 const char kAutoDetectionLanguage[] = "auto"; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 translate_manager_->PageTranslated(source_language_, target_language_, | 259 translate_manager_->PageTranslated(source_language_, target_language_, |
| 256 TranslateErrors::TRANSLATION_ERROR); | 260 TranslateErrors::TRANSLATION_ERROR); |
| 257 } | 261 } |
| 258 | 262 |
| 259 TranslationDidSucceed(source_language_, target_language_, | 263 TranslationDidSucceed(source_language_, target_language_, |
| 260 pending_page_seq_no_, original_language, | 264 pending_page_seq_no_, original_language, |
| 261 translation_time); | 265 translation_time); |
| 262 } | 266 } |
| 263 | 267 |
| 264 } // namespace translate | 268 } // namespace translate |
| OLD | NEW |