| 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "components/translate/content/common/translate_messages.h" | 9 #include "components/translate/content/common/translate_messages.h" |
| 10 #include "components/translate/core/browser/translate_download_manager.h" | 10 #include "components/translate/core/browser/translate_download_manager.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 // an infobar, it must be done after that. | 199 // an infobar, it must be done after that. |
| 200 base::MessageLoop::current()->PostTask( | 200 base::MessageLoop::current()->PostTask( |
| 201 FROM_HERE, | 201 FROM_HERE, |
| 202 base::Bind(&ContentTranslateDriver::InitiateTranslation, | 202 base::Bind(&ContentTranslateDriver::InitiateTranslation, |
| 203 weak_pointer_factory_.GetWeakPtr(), | 203 weak_pointer_factory_.GetWeakPtr(), |
| 204 translate_manager_->GetLanguageState().original_language(), | 204 translate_manager_->GetLanguageState().original_language(), |
| 205 0)); | 205 0)); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void ContentTranslateDriver::DidNavigateAnyFrame( | 208 void ContentTranslateDriver::DidNavigateAnyFrame( |
| 209 content::RenderFrameHost* render_frame_host, |
| 209 const content::LoadCommittedDetails& details, | 210 const content::LoadCommittedDetails& details, |
| 210 const content::FrameNavigateParams& params) { | 211 const content::FrameNavigateParams& params) { |
| 211 // Let the LanguageState clear its state. | 212 // Let the LanguageState clear its state. |
| 212 const bool reload = | 213 const bool reload = |
| 213 details.entry->GetTransitionType() == ui::PAGE_TRANSITION_RELOAD || | 214 details.entry->GetTransitionType() == ui::PAGE_TRANSITION_RELOAD || |
| 214 details.type == content::NAVIGATION_TYPE_SAME_PAGE; | 215 details.type == content::NAVIGATION_TYPE_SAME_PAGE; |
| 215 translate_manager_->GetLanguageState().DidNavigate( | 216 translate_manager_->GetLanguageState().DidNavigate( |
| 216 details.is_in_page, details.is_main_frame, reload); | 217 details.is_in_page, details.is_main_frame, reload); |
| 217 } | 218 } |
| 218 | 219 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 TranslateErrors::Type error_type) { | 253 TranslateErrors::Type error_type) { |
| 253 translate_manager_->PageTranslated( | 254 translate_manager_->PageTranslated( |
| 254 original_lang, translated_lang, error_type); | 255 original_lang, translated_lang, error_type); |
| 255 FOR_EACH_OBSERVER( | 256 FOR_EACH_OBSERVER( |
| 256 Observer, | 257 Observer, |
| 257 observer_list_, | 258 observer_list_, |
| 258 OnPageTranslated(original_lang, translated_lang, error_type)); | 259 OnPageTranslated(original_lang, translated_lang, error_type)); |
| 259 } | 260 } |
| 260 | 261 |
| 261 } // namespace translate | 262 } // namespace translate |
| OLD | NEW |