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 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 explicit TranslateTabHelper(content::WebContents* web_contents); | 101 explicit TranslateTabHelper(content::WebContents* web_contents); |
102 friend class content::WebContentsUserData<TranslateTabHelper>; | 102 friend class content::WebContentsUserData<TranslateTabHelper>; |
103 | 103 |
104 // content::WebContentsObserver implementation. | 104 // content::WebContentsObserver implementation. |
105 virtual void NavigationEntryCommitted( | 105 virtual void NavigationEntryCommitted( |
106 const content::LoadCommittedDetails& load_details) OVERRIDE; | 106 const content::LoadCommittedDetails& load_details) OVERRIDE; |
107 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 107 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
108 virtual void DidNavigateAnyFrame( | 108 virtual void DidNavigateAnyFrame( |
109 const content::LoadCommittedDetails& details, | 109 const content::LoadCommittedDetails& details, |
110 const content::FrameNavigateParams& params) OVERRIDE; | 110 const content::FrameNavigateParams& params) OVERRIDE; |
111 virtual void WebContentsDestroyed( | 111 virtual void WebContentsDestroyed() OVERRIDE; |
112 content::WebContents* web_contents) OVERRIDE; | |
113 | 112 |
114 // Initiates translation once the page is finished loading. | 113 // Initiates translation once the page is finished loading. |
115 void InitiateTranslation(const std::string& page_lang, int attempt); | 114 void InitiateTranslation(const std::string& page_lang, int attempt); |
116 void OnLanguageDetermined(const LanguageDetectionDetails& details, | 115 void OnLanguageDetermined(const LanguageDetectionDetails& details, |
117 bool page_needs_translation); | 116 bool page_needs_translation); |
118 void OnPageTranslated(int32 page_id, | 117 void OnPageTranslated(int32 page_id, |
119 const std::string& original_lang, | 118 const std::string& original_lang, |
120 const std::string& translated_lang, | 119 const std::string& translated_lang, |
121 TranslateErrors::Type error_type); | 120 TranslateErrors::Type error_type); |
122 | 121 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 166 |
168 // Necessary for binding the callback to HandleCLDDataRequest on the blocking | 167 // Necessary for binding the callback to HandleCLDDataRequest on the blocking |
169 // pool and for delaying translation initialization until the page has | 168 // pool and for delaying translation initialization until the page has |
170 // finished loading on a reload. | 169 // finished loading on a reload. |
171 base::WeakPtrFactory<TranslateTabHelper> weak_pointer_factory_; | 170 base::WeakPtrFactory<TranslateTabHelper> weak_pointer_factory_; |
172 | 171 |
173 DISALLOW_COPY_AND_ASSIGN(TranslateTabHelper); | 172 DISALLOW_COPY_AND_ASSIGN(TranslateTabHelper); |
174 }; | 173 }; |
175 | 174 |
176 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ | 175 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ |
OLD | NEW |