OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_RENDERER_TRANSLATE_HELPER_H_ | 5 #ifndef CHROME_RENDERER_TRANSLATE_HELPER_H_ |
6 #define CHROME_RENDERER_TRANSLATE_HELPER_H_ | 6 #define CHROME_RENDERER_TRANSLATE_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // page. Returns false if the call failed immediately. | 75 // page. Returns false if the call failed immediately. |
76 virtual bool StartTranslation(); | 76 virtual bool StartTranslation(); |
77 | 77 |
78 // Asks the Translate element in the page what the language of the page is. | 78 // Asks the Translate element in the page what the language of the page is. |
79 // Can only be called if a translation has happened and was successful. | 79 // Can only be called if a translation has happened and was successful. |
80 // Returns the language code on success, an empty string on failure. | 80 // Returns the language code on success, an empty string on failure. |
81 virtual std::string GetOriginalPageLanguage(); | 81 virtual std::string GetOriginalPageLanguage(); |
82 | 82 |
83 // Used in unit-tests. Makes the various tasks be posted immediately so that | 83 // Used in unit-tests. Makes the various tasks be posted immediately so that |
84 // the tests don't have to wait before checking states. | 84 // the tests don't have to wait before checking states. |
85 virtual bool DontDelayTasks() { return false; } | 85 virtual bool DontDelayTasks(); |
86 | 86 |
87 private: | 87 private: |
88 // Checks if the current running page translation is finished or errored and | 88 // Checks if the current running page translation is finished or errored and |
89 // notifies the browser accordingly. If the translation has not terminated, | 89 // notifies the browser accordingly. If the translation has not terminated, |
90 // posts a task to check again later. | 90 // posts a task to check again later. |
91 void CheckTranslateStatus(); | 91 void CheckTranslateStatus(); |
92 | 92 |
93 // Executes the JavaScript code in |script| in the main frame of | 93 // Executes the JavaScript code in |script| in the main frame of |
94 // |render_view_host_|. | 94 // |render_view_host_|. |
95 // Returns true if the code was executed successfully. | 95 // Returns true if the code was executed successfully. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 std::string source_lang_; | 129 std::string source_lang_; |
130 std::string target_lang_; | 130 std::string target_lang_; |
131 | 131 |
132 // Method factory used to make calls to TranslatePageImpl. | 132 // Method factory used to make calls to TranslatePageImpl. |
133 ScopedRunnableMethodFactory<TranslateHelper> method_factory_; | 133 ScopedRunnableMethodFactory<TranslateHelper> method_factory_; |
134 | 134 |
135 DISALLOW_COPY_AND_ASSIGN(TranslateHelper); | 135 DISALLOW_COPY_AND_ASSIGN(TranslateHelper); |
136 }; | 136 }; |
137 | 137 |
138 #endif // CHROME_RENDERER_TRANSLATE_HELPER_H_ | 138 #endif // CHROME_RENDERER_TRANSLATE_HELPER_H_ |
OLD | NEW |