| 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 CHROME_BROWSER_TRANSLATE_CHROME_TRANSLATE_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_TRANSLATE_CHROME_TRANSLATE_CLIENT_H_ |
| 6 #define CHROME_BROWSER_TRANSLATE_CHROME_TRANSLATE_CLIENT_H_ | 6 #define CHROME_BROWSER_TRANSLATE_CHROME_TRANSLATE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // ContentTranslateDriver::Observer implementation. | 105 // ContentTranslateDriver::Observer implementation. |
| 106 void OnLanguageDetermined( | 106 void OnLanguageDetermined( |
| 107 const translate::LanguageDetectionDetails& details) override; | 107 const translate::LanguageDetectionDetails& details) override; |
| 108 void OnPageTranslated(const std::string& original_lang, | 108 void OnPageTranslated(const std::string& original_lang, |
| 109 const std::string& translated_lang, | 109 const std::string& translated_lang, |
| 110 translate::TranslateErrors::Type error_type) override; | 110 translate::TranslateErrors::Type error_type) override; |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 explicit ChromeTranslateClient(content::WebContents* web_contents); | 113 explicit ChromeTranslateClient(content::WebContents* web_contents); |
| 114 friend class content::WebContentsUserData<ChromeTranslateClient>; | 114 friend class content::WebContentsUserData<ChromeTranslateClient>; |
| 115 FRIEND_TEST_ALL_PREFIXES(ChromeTranslateClientTest, |
| 116 LanguageEventShouldRecord); |
| 117 FRIEND_TEST_ALL_PREFIXES(ChromeTranslateClientTest, |
| 118 LanguageEventShouldNotRecord); |
| 115 | 119 |
| 116 // content::WebContentsObserver implementation. | 120 // content::WebContentsObserver implementation. |
| 117 void WebContentsDestroyed() override; | 121 void WebContentsDestroyed() override; |
| 118 | 122 |
| 119 // Shows the translate bubble. | 123 // Shows the translate bubble. |
| 120 ShowTranslateBubbleResult ShowBubble( | 124 ShowTranslateBubbleResult ShowBubble( |
| 121 translate::TranslateStep step, | 125 translate::TranslateStep step, |
| 122 translate::TranslateErrors::Type error_type); | 126 translate::TranslateErrors::Type error_type); |
| 123 | 127 |
| 124 translate::ContentTranslateDriver translate_driver_; | 128 translate::ContentTranslateDriver translate_driver_; |
| 125 std::unique_ptr<translate::TranslateManager> translate_manager_; | 129 std::unique_ptr<translate::TranslateManager> translate_manager_; |
| 126 | 130 |
| 127 // Model to be notified about detected language of every page visited. Not | 131 // Model to be notified about detected language of every page visited. Not |
| 128 // owned here. | 132 // owned here. |
| 129 translate::LanguageModel* language_model_; | 133 translate::LanguageModel* language_model_; |
| 130 | 134 |
| 131 DISALLOW_COPY_AND_ASSIGN(ChromeTranslateClient); | 135 DISALLOW_COPY_AND_ASSIGN(ChromeTranslateClient); |
| 132 }; | 136 }; |
| 133 | 137 |
| 134 #endif // CHROME_BROWSER_TRANSLATE_CHROME_TRANSLATE_CLIENT_H_ | 138 #endif // CHROME_BROWSER_TRANSLATE_CHROME_TRANSLATE_CLIENT_H_ |
| OLD | NEW |