OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ |
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ | 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // If no language is found then an empty string is returned. | 85 // If no language is found then an empty string is returned. |
86 static std::string GetTargetLanguage(PrefService* prefs); | 86 static std::string GetTargetLanguage(PrefService* prefs); |
87 | 87 |
88 // Let the caller decide if and when we should fetch the language list from | 88 // Let the caller decide if and when we should fetch the language list from |
89 // the translate server. This is a NOOP if switches::kDisableTranslate is set | 89 // the translate server. This is a NOOP if switches::kDisableTranslate is set |
90 // or if prefs::kEnableTranslate is set to false. | 90 // or if prefs::kEnableTranslate is set to false. |
91 void FetchLanguageListFromTranslateServer(PrefService* prefs); | 91 void FetchLanguageListFromTranslateServer(PrefService* prefs); |
92 | 92 |
93 // Allows caller to cleanup pending URLFetcher objects to make sure they | 93 // Allows caller to cleanup pending URLFetcher objects to make sure they |
94 // get released in the appropriate thread... Mainly for tests. | 94 // get released in the appropriate thread... Mainly for tests. |
95 void CleanupPendingUlrFetcher(); | 95 void CleanupPendingUrlFetcher(); |
96 | 96 |
97 // Translates the page contents from |source_lang| to |target_lang|. | 97 // Translates the page contents from |source_lang| to |target_lang|. |
98 // The actual translation might be performed asynchronously if the translate | 98 // The actual translation might be performed asynchronously if the translate |
99 // script is not yet available. | 99 // script is not yet available. |
100 void TranslatePage(content::WebContents* web_contents, | 100 void TranslatePage(content::WebContents* web_contents, |
101 const std::string& source_lang, | 101 const std::string& source_lang, |
102 const std::string& target_lang); | 102 const std::string& target_lang); |
103 | 103 |
104 // Reverts the contents of the page in |web_contents| to its original | 104 // Reverts the contents of the page in |web_contents| to its original |
105 // language. | 105 // language. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 scoped_ptr<TranslateScript> script_; | 218 scoped_ptr<TranslateScript> script_; |
219 | 219 |
220 // An instance of TranslateAcceptLanguages which manages Accept languages of | 220 // An instance of TranslateAcceptLanguages which manages Accept languages of |
221 // each profiles. | 221 // each profiles. |
222 scoped_ptr<TranslateAcceptLanguages> accept_languages_; | 222 scoped_ptr<TranslateAcceptLanguages> accept_languages_; |
223 | 223 |
224 DISALLOW_COPY_AND_ASSIGN(TranslateManager); | 224 DISALLOW_COPY_AND_ASSIGN(TranslateManager); |
225 }; | 225 }; |
226 | 226 |
227 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ | 227 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ |
OLD | NEW |