OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 class TranslateManager { | 36 class TranslateManager { |
37 public: | 37 public: |
38 // TranslateTabHelper is expected to outlive the TranslateManager. | 38 // TranslateTabHelper is expected to outlive the TranslateManager. |
39 // |accept_language_pref_name| is the path for the preference for the | 39 // |accept_language_pref_name| is the path for the preference for the |
40 // accept-languages. | 40 // accept-languages. |
41 TranslateManager(TranslateTabHelper* helper, | 41 TranslateManager(TranslateTabHelper* helper, |
42 const std::string& accept_language_pref_name); | 42 const std::string& accept_language_pref_name); |
43 virtual ~TranslateManager(); | 43 virtual ~TranslateManager(); |
44 | 44 |
45 // Returns true if the URL can be translated. | |
46 static bool IsTranslatableURL(const GURL& url); | |
47 | |
48 // Returns the language to translate to. The language returned is the | 45 // Returns the language to translate to. The language returned is the |
49 // first language found in the following list that is supported by the | 46 // first language found in the following list that is supported by the |
50 // translation service: | 47 // translation service: |
51 // the UI language | 48 // the UI language |
52 // the accept-language list | 49 // the accept-language list |
53 // If no language is found then an empty string is returned. | 50 // If no language is found then an empty string is returned. |
54 static std::string GetTargetLanguage( | 51 static std::string GetTargetLanguage( |
55 const std::vector<std::string>& accept_languages_list); | 52 const std::vector<std::string>& accept_languages_list); |
56 | 53 |
57 // Returns the language to automatically translate to. |original_language| is | 54 // Returns the language to automatically translate to. |original_language| is |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 TranslateTabHelper* translate_tab_helper_; // Weak. | 111 TranslateTabHelper* translate_tab_helper_; // Weak. |
115 TranslateClient* translate_client_; // Weak. | 112 TranslateClient* translate_client_; // Weak. |
116 TranslateDriver* translate_driver_; // Weak. | 113 TranslateDriver* translate_driver_; // Weak. |
117 | 114 |
118 base::WeakPtrFactory<TranslateManager> weak_method_factory_; | 115 base::WeakPtrFactory<TranslateManager> weak_method_factory_; |
119 | 116 |
120 DISALLOW_COPY_AND_ASSIGN(TranslateManager); | 117 DISALLOW_COPY_AND_ASSIGN(TranslateManager); |
121 }; | 118 }; |
122 | 119 |
123 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ | 120 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ |
OLD | NEW |