| 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 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/ui/translate/translate_bubble_model.h" | 12 #include "chrome/browser/ui/translate/translate_bubble_model.h" |
| 13 #include "components/translate/content/browser/content_translate_driver.h" | 13 #include "components/translate/content/browser/content_translate_driver.h" |
| 14 #include "components/translate/core/browser/translate_client.h" | 14 #include "components/translate/core/browser/translate_client.h" |
| 15 #include "components/translate/core/browser/translate_step.h" | 15 #include "components/translate/core/browser/translate_step.h" |
| 16 #include "components/translate/core/common/translate_errors.h" | 16 #include "components/translate/core/common/translate_errors.h" |
| 17 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
| 18 #include "content/public/browser/web_contents_user_data.h" | 18 #include "content/public/browser/web_contents_user_data.h" |
| 19 #include "services/service_manager/public/cpp/bind_source_info.h" |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 class BrowserContext; | 22 class BrowserContext; |
| 22 class WebContents; | 23 class WebContents; |
| 23 } // namespace content | 24 } // namespace content |
| 24 | 25 |
| 25 class PrefService; | 26 class PrefService; |
| 26 | 27 |
| 27 namespace translate { | 28 namespace translate { |
| 28 class LanguageModel; | 29 class LanguageModel; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 static translate::TranslateManager* GetManagerFromWebContents( | 66 static translate::TranslateManager* GetManagerFromWebContents( |
| 66 content::WebContents* web_contents); | 67 content::WebContents* web_contents); |
| 67 | 68 |
| 68 // Gets |source| and |target| language for translation. | 69 // Gets |source| and |target| language for translation. |
| 69 static void GetTranslateLanguages(content::WebContents* web_contents, | 70 static void GetTranslateLanguages(content::WebContents* web_contents, |
| 70 std::string* source, | 71 std::string* source, |
| 71 std::string* target); | 72 std::string* target); |
| 72 | 73 |
| 73 static void BindContentTranslateDriver( | 74 static void BindContentTranslateDriver( |
| 74 content::RenderFrameHost* render_frame_host, | 75 content::RenderFrameHost* render_frame_host, |
| 76 const service_manager::BindSourceInfo& source_info, |
| 75 translate::mojom::ContentTranslateDriverRequest request); | 77 translate::mojom::ContentTranslateDriverRequest request); |
| 76 | 78 |
| 77 // Gets the associated TranslateManager. | 79 // Gets the associated TranslateManager. |
| 78 translate::TranslateManager* GetTranslateManager(); | 80 translate::TranslateManager* GetTranslateManager(); |
| 79 | 81 |
| 80 // Gets the associated WebContents. Returns NULL if the WebContents is being | 82 // Gets the associated WebContents. Returns NULL if the WebContents is being |
| 81 // destroyed. | 83 // destroyed. |
| 82 content::WebContents* GetWebContents(); | 84 content::WebContents* GetWebContents(); |
| 83 | 85 |
| 84 // TranslateClient implementation. | 86 // TranslateClient implementation. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 std::unique_ptr<translate::TranslateManager> translate_manager_; | 125 std::unique_ptr<translate::TranslateManager> translate_manager_; |
| 124 | 126 |
| 125 // Model to be notified about detected language of every page visited. Not | 127 // Model to be notified about detected language of every page visited. Not |
| 126 // owned here. | 128 // owned here. |
| 127 translate::LanguageModel* language_model_; | 129 translate::LanguageModel* language_model_; |
| 128 | 130 |
| 129 DISALLOW_COPY_AND_ASSIGN(ChromeTranslateClient); | 131 DISALLOW_COPY_AND_ASSIGN(ChromeTranslateClient); |
| 130 }; | 132 }; |
| 131 | 133 |
| 132 #endif // CHROME_BROWSER_TRANSLATE_CHROME_TRANSLATE_CLIENT_H_ | 134 #endif // CHROME_BROWSER_TRANSLATE_CHROME_TRANSLATE_CLIENT_H_ |
| OLD | NEW |