| 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/language_detection_controller.h" | 5 #include "components/translate/ios/browser/language_detection_controller.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 DetectionDetails details; | 121 DetectionDetails details; |
| 122 details.content_language = http_content_language; | 122 details.content_language = http_content_language; |
| 123 details.html_root_language = html_lang; | 123 details.html_root_language = html_lang; |
| 124 details.adopted_language = language; | 124 details.adopted_language = language; |
| 125 language_detection_callbacks_.Notify(details); | 125 language_detection_callbacks_.Notify(details); |
| 126 } | 126 } |
| 127 | 127 |
| 128 // web::WebStateObserver implementation: | 128 // web::WebStateObserver implementation: |
| 129 | 129 |
| 130 void LanguageDetectionController::PageLoaded() { | 130 void LanguageDetectionController::PageLoaded(bool load_success) { |
| 131 StartLanguageDetection(); | 131 if (load_success) |
| 132 StartLanguageDetection(); |
| 132 } | 133 } |
| 133 | 134 |
| 134 void LanguageDetectionController::URLHashChanged() { | 135 void LanguageDetectionController::URLHashChanged() { |
| 135 StartLanguageDetection(); | 136 StartLanguageDetection(); |
| 136 } | 137 } |
| 137 | 138 |
| 138 void LanguageDetectionController::HistoryStateChanged() { | 139 void LanguageDetectionController::HistoryStateChanged() { |
| 139 StartLanguageDetection(); | 140 StartLanguageDetection(); |
| 140 } | 141 } |
| 141 | 142 |
| 142 void LanguageDetectionController::WebStateDestroyed() { | 143 void LanguageDetectionController::WebStateDestroyed() { |
| 143 web_state()->RemoveScriptCommandCallback(kCommandPrefix); | 144 web_state()->RemoveScriptCommandCallback(kCommandPrefix); |
| 144 } | 145 } |
| 145 | 146 |
| 146 } // namespace translate | 147 } // namespace translate |
| OLD | NEW |