| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "chrome/browser/translate/translate_tab_helper.h" | 5 #include "chrome/browser/translate/translate_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 0)); | 294 0)); |
| 295 } | 295 } |
| 296 | 296 |
| 297 void TranslateTabHelper::DidNavigateAnyFrame( | 297 void TranslateTabHelper::DidNavigateAnyFrame( |
| 298 const content::LoadCommittedDetails& details, | 298 const content::LoadCommittedDetails& details, |
| 299 const content::FrameNavigateParams& params) { | 299 const content::FrameNavigateParams& params) { |
| 300 // Let the LanguageState clear its state. | 300 // Let the LanguageState clear its state. |
| 301 translate_driver_.DidNavigate(details); | 301 translate_driver_.DidNavigate(details); |
| 302 } | 302 } |
| 303 | 303 |
| 304 void TranslateTabHelper::WebContentsDestroyed( | 304 void TranslateTabHelper::WebContentsDestroyed() { |
| 305 content::WebContents* web_contents) { | |
| 306 // Translation process can be interrupted. | 305 // Translation process can be interrupted. |
| 307 // Destroying the TranslateManager now guarantees that it never has to deal | 306 // Destroying the TranslateManager now guarantees that it never has to deal |
| 308 // with NULL WebContents. | 307 // with NULL WebContents. |
| 309 translate_manager_.reset(); | 308 translate_manager_.reset(); |
| 310 } | 309 } |
| 311 | 310 |
| 312 #if defined(CLD2_DYNAMIC_MODE) | 311 #if defined(CLD2_DYNAMIC_MODE) |
| 313 void TranslateTabHelper::OnCLDDataRequested() { | 312 void TranslateTabHelper::OnCLDDataRequested() { |
| 314 // Quickly try to read s_cached_file_. If valid, the file handle is | 313 // Quickly try to read s_cached_file_. If valid, the file handle is |
| 315 // cached and can be used immediately. Else, queue the caching task to the | 314 // cached and can be used immediately. Else, queue the caching task to the |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 if (GetLanguageState().InTranslateNavigation()) | 529 if (GetLanguageState().InTranslateNavigation()) |
| 531 return; | 530 return; |
| 532 } | 531 } |
| 533 | 532 |
| 534 TranslateBubbleFactory::Show( | 533 TranslateBubbleFactory::Show( |
| 535 browser->window(), web_contents(), step, error_type); | 534 browser->window(), web_contents(), step, error_type); |
| 536 #else | 535 #else |
| 537 NOTREACHED(); | 536 NOTREACHED(); |
| 538 #endif | 537 #endif |
| 539 } | 538 } |
| OLD | NEW |