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/content/browser/content_translate_driver.h" | 5 #include "components/translate/content/browser/content_translate_driver.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 213 } |
214 | 214 |
215 void ContentTranslateDriver::DidFinishNavigation( | 215 void ContentTranslateDriver::DidFinishNavigation( |
216 content::NavigationHandle* navigation_handle) { | 216 content::NavigationHandle* navigation_handle) { |
217 if (!navigation_handle->HasCommitted()) | 217 if (!navigation_handle->HasCommitted()) |
218 return; | 218 return; |
219 | 219 |
220 // Let the LanguageState clear its state. | 220 // Let the LanguageState clear its state. |
221 const bool reload = | 221 const bool reload = |
222 navigation_handle->GetReloadType() != content::ReloadType::NONE || | 222 navigation_handle->GetReloadType() != content::ReloadType::NONE || |
223 navigation_handle->IsSamePage(); | 223 navigation_handle->IsSameDocument(); |
224 translate_manager_->GetLanguageState().DidNavigate( | 224 translate_manager_->GetLanguageState().DidNavigate( |
225 navigation_handle->IsSamePage(), navigation_handle->IsInMainFrame(), | 225 navigation_handle->IsSameDocument(), navigation_handle->IsInMainFrame(), |
226 reload); | 226 reload); |
227 } | 227 } |
228 | 228 |
229 void ContentTranslateDriver::OnPageAway(int page_seq_no) { | 229 void ContentTranslateDriver::OnPageAway(int page_seq_no) { |
230 pages_.erase(page_seq_no); | 230 pages_.erase(page_seq_no); |
231 } | 231 } |
232 | 232 |
233 // mojom::ContentTranslateDriver implementation. | 233 // mojom::ContentTranslateDriver implementation. |
234 void ContentTranslateDriver::RegisterPage( | 234 void ContentTranslateDriver::RegisterPage( |
235 mojom::PagePtr page, | 235 mojom::PagePtr page, |
(...skipping 23 matching lines...) Expand all Loading... |
259 if (cancelled) | 259 if (cancelled) |
260 return; | 260 return; |
261 | 261 |
262 translate_manager_->PageTranslated( | 262 translate_manager_->PageTranslated( |
263 original_lang, translated_lang, error_type); | 263 original_lang, translated_lang, error_type); |
264 for (auto& observer : observer_list_) | 264 for (auto& observer : observer_list_) |
265 observer.OnPageTranslated(original_lang, translated_lang, error_type); | 265 observer.OnPageTranslated(original_lang, translated_lang, error_type); |
266 } | 266 } |
267 | 267 |
268 } // namespace translate | 268 } // namespace translate |
OLD | NEW |