| 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 #include "chrome/browser/translate/chrome_translate_client.h" | 5 #include "chrome/browser/translate/chrome_translate_client.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 *target = | 168 *target = |
| 169 translate::TranslateManager::GetTargetLanguage(translate_prefs.get()); | 169 translate::TranslateManager::GetTargetLanguage(translate_prefs.get()); |
| 170 } | 170 } |
| 171 | 171 |
| 172 // static | 172 // static |
| 173 void ChromeTranslateClient::BindContentTranslateDriver( | 173 void ChromeTranslateClient::BindContentTranslateDriver( |
| 174 content::RenderFrameHost* render_frame_host, | 174 content::RenderFrameHost* render_frame_host, |
| 175 const service_manager::BindSourceInfo& source_info, |
| 175 translate::mojom::ContentTranslateDriverRequest request) { | 176 translate::mojom::ContentTranslateDriverRequest request) { |
| 176 content::WebContents* web_contents = | 177 content::WebContents* web_contents = |
| 177 content::WebContents::FromRenderFrameHost(render_frame_host); | 178 content::WebContents::FromRenderFrameHost(render_frame_host); |
| 178 if (!web_contents) | 179 if (!web_contents) |
| 179 return; | 180 return; |
| 180 | 181 |
| 181 ChromeTranslateClient* instance = | 182 ChromeTranslateClient* instance = |
| 182 ChromeTranslateClient::FromWebContents(web_contents); | 183 ChromeTranslateClient::FromWebContents(web_contents); |
| 183 // We try to bind to the driver, but if driver is not ready for now or totally | 184 // We try to bind to the driver, but if driver is not ready for now or totally |
| 184 // not available for this render frame host, the request will be just dropped. | 185 // not available for this render frame host, the request will be just dropped. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 return ShowTranslateBubbleResult::SUCCESS; | 364 return ShowTranslateBubbleResult::SUCCESS; |
| 364 } | 365 } |
| 365 | 366 |
| 366 return TranslateBubbleFactory::Show(browser->window(), web_contents(), step, | 367 return TranslateBubbleFactory::Show(browser->window(), web_contents(), step, |
| 367 error_type); | 368 error_type); |
| 368 #else | 369 #else |
| 369 NOTREACHED(); | 370 NOTREACHED(); |
| 370 return ShowTranslateBubbleResult::SUCCESS; | 371 return ShowTranslateBubbleResult::SUCCESS; |
| 371 #endif | 372 #endif |
| 372 } | 373 } |
| OLD | NEW |