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

Unified Diff: components/translate/content/renderer/translate_helper.h

Issue 2919343007: Check |errorCode| of translate.js and notify to Browser (Closed)
Patch Set: Addressed review comments. Created 3 years, 6 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: components/translate/content/renderer/translate_helper.h
diff --git a/components/translate/content/renderer/translate_helper.h b/components/translate/content/renderer/translate_helper.h
index 622e7183fc6e8c11a6ab71b4fd263b0f8523f749..fb7d1e4c9bb539949eeb7742432a3aec97791314 100644
--- a/components/translate/content/renderer/translate_helper.h
+++ b/components/translate/content/renderer/translate_helper.h
@@ -64,6 +64,10 @@ class TranslateHelper : public content::RenderFrameObserver,
// translation.
virtual bool HasTranslationFailed();
+ // Returns the error code generated in translate library if there was an
+ // error. Otherwise, returns |fallback| value.
+ virtual int64_t GetErrorCodeWithFallback(TranslateErrors::Type fallback);
+
// Starts the translation by calling the translate library. This method
// should only be called when the translate script has been injected in the
// page. Returns false if the call failed immediately.
@@ -98,6 +102,12 @@ class TranslateHelper : public content::RenderFrameObserver,
// run successfully. Otherwise, returns 0.0.
virtual double ExecuteScriptAndGetDoubleResult(const std::string& script);
+ // Executes the JavaScript code in |script| in the main frame of RenderView.
+ // and returns the integer value returned by the script evaluation if the
+ // script was run successfully. Otherwise, returns |fallback| value.
+ virtual int64_t ExecuteScriptAndGetIntegerResult(const std::string& script,
+ int64_t fallback);
+
private:
// Converts language code to the one used in server supporting list.
static void ConvertLanguageCodeSynonym(std::string* code);

Powered by Google App Engine
This is Rietveld 408576698