Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2595)

Unified Diff: chrome/browser/translate/chrome_translate_client.cc

Issue 2143383002: [Translate] Migrate IPCs to Mojo interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix trybots Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/translate/chrome_translate_client.cc
diff --git a/chrome/browser/translate/chrome_translate_client.cc b/chrome/browser/translate/chrome_translate_client.cc
index 6bf702d1fce2d69070b1485488969f93add3ee60..24b1aeb738a227ae1dca48138272d34092131221 100644
--- a/chrome/browser/translate/chrome_translate_client.cc
+++ b/chrome/browser/translate/chrome_translate_client.cc
@@ -25,7 +25,6 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
-#include "components/translate/content/common/translate_messages.h"
#include "components/translate/core/browser/language_state.h"
#include "components/translate/core/browser/page_translated_details.h"
#include "components/translate/core/browser/translate_accept_languages.h"
@@ -138,6 +137,27 @@ void ChromeTranslateClient::GetTranslateLanguages(
translate::TranslateManager::GetTargetLanguage(translate_prefs.get());
}
+// static
+void ChromeTranslateClient::BindContentTranslateDriver(
+ content::RenderFrameHost* render_frame_host,
+ translate::mojom::ContentTranslateDriverRequest request) {
+ content::WebContents* web_contents =
+ content::WebContents::FromRenderFrameHost(render_frame_host);
+ if (!web_contents)
+ return;
+
+ ChromeTranslateClient* instance =
+ ChromeTranslateClient::FromWebContents(web_contents);
+ // We try to bind to the driver, but if driver is not ready for now or totally
+ // not available for this render frame host, the request will be just dropped.
+ // This would cause the message pipe to be closed, which will raise a
+ // connection error on the peer side.
+ if (!instance)
+ return;
+
+ instance->translate_driver().BindRequest(std::move(request));
+}
+
translate::TranslateManager* ChromeTranslateClient::GetTranslateManager() {
return translate_manager_.get();
}

Powered by Google App Engine
This is Rietveld 408576698