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( |
131 StartLanguageDetection(); | 131 web::PageLoadCompletionStatus load_completion_status) { |
| 132 if (load_completion_status == web::PageLoadCompletionStatus::SUCCESS) |
| 133 StartLanguageDetection(); |
132 } | 134 } |
133 | 135 |
134 void LanguageDetectionController::URLHashChanged() { | 136 void LanguageDetectionController::URLHashChanged() { |
135 StartLanguageDetection(); | 137 StartLanguageDetection(); |
136 } | 138 } |
137 | 139 |
138 void LanguageDetectionController::HistoryStateChanged() { | 140 void LanguageDetectionController::HistoryStateChanged() { |
139 StartLanguageDetection(); | 141 StartLanguageDetection(); |
140 } | 142 } |
141 | 143 |
142 void LanguageDetectionController::WebStateDestroyed() { | 144 void LanguageDetectionController::WebStateDestroyed() { |
143 web_state()->RemoveScriptCommandCallback(kCommandPrefix); | 145 web_state()->RemoveScriptCommandCallback(kCommandPrefix); |
144 } | 146 } |
145 | 147 |
146 } // namespace translate | 148 } // namespace translate |
OLD | NEW |