| 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 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ |
| 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Sets the sequence number of the current page, for use while sending | 47 // Sets the sequence number of the current page, for use while sending |
| 48 // messages to the renderer. | 48 // messages to the renderer. |
| 49 void set_current_seq_no(int page_seq_no) { page_seq_no_ = page_seq_no; } | 49 void set_current_seq_no(int page_seq_no) { page_seq_no_ = page_seq_no; } |
| 50 | 50 |
| 51 // Returns the language to translate to. The language returned is the | 51 // Returns the language to translate to. The language returned is the |
| 52 // first language found in the following list that is supported by the | 52 // first language found in the following list that is supported by the |
| 53 // translation service: | 53 // translation service: |
| 54 // the UI language | 54 // the UI language |
| 55 // the accept-language list | 55 // the accept-language list |
| 56 // If no language is found then an empty string is returned. | 56 // If no language is found then an empty string is returned. |
| 57 static std::string GetTargetLanguage( | 57 static std::string GetTargetLanguage(const TranslatePrefs* prefs); |
| 58 const std::vector<std::string>& accept_languages_list); | |
| 59 | 58 |
| 60 // Returns the language to automatically translate to. |original_language| is | 59 // Returns the language to automatically translate to. |original_language| is |
| 61 // the webpage's original language. | 60 // the webpage's original language. |
| 62 static std::string GetAutoTargetLanguage(const std::string& original_language, | 61 static std::string GetAutoTargetLanguage(const std::string& original_language, |
| 63 TranslatePrefs* translate_prefs); | 62 TranslatePrefs* translate_prefs); |
| 64 | 63 |
| 65 // Translates the page contents from |source_lang| to |target_lang|. | 64 // Translates the page contents from |source_lang| to |target_lang|. |
| 66 // The actual translation might be performed asynchronously if the translate | 65 // The actual translation might be performed asynchronously if the translate |
| 67 // script is not yet available. | 66 // script is not yet available. |
| 68 void TranslatePage(const std::string& source_lang, | 67 void TranslatePage(const std::string& source_lang, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // By default, don't offer to translate in builds lacking an API key. For | 130 // By default, don't offer to translate in builds lacking an API key. For |
| 132 // testing, set to true to offer anyway. | 131 // testing, set to true to offer anyway. |
| 133 static bool ignore_missing_key_for_testing_; | 132 static bool ignore_missing_key_for_testing_; |
| 134 | 133 |
| 135 DISALLOW_COPY_AND_ASSIGN(TranslateManager); | 134 DISALLOW_COPY_AND_ASSIGN(TranslateManager); |
| 136 }; | 135 }; |
| 137 | 136 |
| 138 } // namespace translate | 137 } // namespace translate |
| 139 | 138 |
| 140 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ | 139 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ |
| OLD | NEW |