| 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 18 matching lines...) Expand all Loading... |
| 29 class PrefService; | 29 class PrefService; |
| 30 | 30 |
| 31 namespace translate { | 31 namespace translate { |
| 32 class LanguageModel; | 32 class LanguageModel; |
| 33 class LanguageState; | 33 class LanguageState; |
| 34 class TranslateAcceptLanguages; | 34 class TranslateAcceptLanguages; |
| 35 class TranslatePrefs; | 35 class TranslatePrefs; |
| 36 class TranslateManager; | 36 class TranslateManager; |
| 37 } // namespace translate | 37 } // namespace translate |
| 38 | 38 |
| 39 enum class ShowTranslateBubbleResult; |
| 40 |
| 39 class ChromeTranslateClient | 41 class ChromeTranslateClient |
| 40 : public translate::TranslateClient, | 42 : public translate::TranslateClient, |
| 41 public translate::ContentTranslateDriver::Observer, | 43 public translate::ContentTranslateDriver::Observer, |
| 42 public content::WebContentsObserver, | 44 public content::WebContentsObserver, |
| 43 public content::WebContentsUserData<ChromeTranslateClient> { | 45 public content::WebContentsUserData<ChromeTranslateClient> { |
| 44 public: | 46 public: |
| 45 ~ChromeTranslateClient() override; | 47 ~ChromeTranslateClient() override; |
| 46 | 48 |
| 47 // Gets the LanguageState associated with the page. | 49 // Gets the LanguageState associated with the page. |
| 48 translate::LanguageState& GetLanguageState(); | 50 translate::LanguageState& GetLanguageState(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 translate::TranslateErrors::Type error_type) override; | 112 translate::TranslateErrors::Type error_type) override; |
| 111 | 113 |
| 112 private: | 114 private: |
| 113 explicit ChromeTranslateClient(content::WebContents* web_contents); | 115 explicit ChromeTranslateClient(content::WebContents* web_contents); |
| 114 friend class content::WebContentsUserData<ChromeTranslateClient>; | 116 friend class content::WebContentsUserData<ChromeTranslateClient>; |
| 115 | 117 |
| 116 // content::WebContentsObserver implementation. | 118 // content::WebContentsObserver implementation. |
| 117 void WebContentsDestroyed() override; | 119 void WebContentsDestroyed() override; |
| 118 | 120 |
| 119 // Shows the translate bubble. | 121 // Shows the translate bubble. |
| 120 void ShowBubble(translate::TranslateStep step, | 122 ShowTranslateBubbleResult ShowBubble( |
| 121 translate::TranslateErrors::Type error_type); | 123 translate::TranslateStep step, |
| 124 translate::TranslateErrors::Type error_type); |
| 122 | 125 |
| 123 translate::ContentTranslateDriver translate_driver_; | 126 translate::ContentTranslateDriver translate_driver_; |
| 124 std::unique_ptr<translate::TranslateManager> translate_manager_; | 127 std::unique_ptr<translate::TranslateManager> translate_manager_; |
| 125 | 128 |
| 126 // Model to be notified about detected language of every page visited. Not | 129 // Model to be notified about detected language of every page visited. Not |
| 127 // owned here. | 130 // owned here. |
| 128 translate::LanguageModel* language_model_; | 131 translate::LanguageModel* language_model_; |
| 129 | 132 |
| 130 DISALLOW_COPY_AND_ASSIGN(ChromeTranslateClient); | 133 DISALLOW_COPY_AND_ASSIGN(ChromeTranslateClient); |
| 131 }; | 134 }; |
| 132 | 135 |
| 133 #endif // CHROME_BROWSER_TRANSLATE_CHROME_TRANSLATE_CLIENT_H_ | 136 #endif // CHROME_BROWSER_TRANSLATE_CHROME_TRANSLATE_CLIENT_H_ |
| OLD | NEW |