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_IOS_BROWSER_IOS_TRANSLATE_DRIVER_H_ | 5 #ifndef COMPONENTS_TRANSLATE_IOS_BROWSER_IOS_TRANSLATE_DRIVER_H_ |
6 #define COMPONENTS_TRANSLATE_IOS_BROWSER_IOS_TRANSLATE_DRIVER_H_ | 6 #define COMPONENTS_TRANSLATE_IOS_BROWSER_IOS_TRANSLATE_DRIVER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 const std::string& target_lang) override; | 57 const std::string& target_lang) override; |
58 void RevertTranslation(int page_seq_no) override; | 58 void RevertTranslation(int page_seq_no) override; |
59 bool IsOffTheRecord() override; | 59 bool IsOffTheRecord() override; |
60 const std::string& GetContentsMimeType() override; | 60 const std::string& GetContentsMimeType() override; |
61 const GURL& GetLastCommittedURL() override; | 61 const GURL& GetLastCommittedURL() override; |
62 const GURL& GetVisibleURL() override; | 62 const GURL& GetVisibleURL() override; |
63 bool HasCurrentPage() override; | 63 bool HasCurrentPage() override; |
64 void OpenUrlInNewTab(const GURL& url) override; | 64 void OpenUrlInNewTab(const GURL& url) override; |
65 | 65 |
66 private: | 66 private: |
67 // Called when the translation was successfull. | 67 // Called when the translation was successful. |
68 void TranslationDidSucceed(const std::string& source_lang, | 68 void TranslationDidSucceed(const std::string& source_lang, |
69 const std::string& target_lang, | 69 const std::string& target_lang, |
70 int page_seq_no, | 70 int page_seq_no, |
71 const std::string& original_page_language, | 71 const std::string& original_page_language, |
72 double translation_time); | 72 double translation_time); |
73 // Checks if the current running page translation is finished or errored and | 73 // Checks if the current running page translation is finished or errored and |
74 // notifies the browser accordingly. If the translation has not terminated, | 74 // notifies the browser accordingly. If the translation has not terminated, |
75 // posts a task to check again later. | 75 // posts a task to check again later. |
76 // Similar to TranslateHelper::CheckTranslateStatus on desktop. | 76 // Similar to TranslateHelper::CheckTranslateStatus on desktop. |
77 void CheckTranslateStatus(const std::string& source_language, | 77 void CheckTranslateStatus(const std::string& source_language, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 std::string target_language_; | 118 std::string target_language_; |
119 | 119 |
120 base::WeakPtrFactory<IOSTranslateDriver> weak_method_factory_; | 120 base::WeakPtrFactory<IOSTranslateDriver> weak_method_factory_; |
121 | 121 |
122 DISALLOW_COPY_AND_ASSIGN(IOSTranslateDriver); | 122 DISALLOW_COPY_AND_ASSIGN(IOSTranslateDriver); |
123 }; | 123 }; |
124 | 124 |
125 } // namespace translate | 125 } // namespace translate |
126 | 126 |
127 #endif // COMPONENTS_TRANSLATE_IOS_BROWSER_IOS_TRANSLATE_DRIVER_H_ | 127 #endif // COMPONENTS_TRANSLATE_IOS_BROWSER_IOS_TRANSLATE_DRIVER_H_ |
OLD | NEW |