Index: chrome/browser/automation/automation_provider.cc |
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc |
index bfe879f4f06f9e303dc7e97bd8d8cc36926bf634..5652cb3cb482e344afad245d678eddc0fded328d 100644 |
--- a/chrome/browser/automation/automation_provider.cc |
+++ b/chrome/browser/automation/automation_provider.cc |
@@ -2875,26 +2875,28 @@ void AutomationProvider::WaitUntilTranslateComplete( |
return; |
} |
- // If the translation is still pending, the observer will wait |
- // for it to finish and then reply. |
- if (tab_contents->language_state().translation_pending()) { |
- new PageTranslatedObserver(this, reply_message, tab_contents); |
- return; |
- } |
- // Otherwise send back the success or failure of the attempted translation |
- // based on the translate bar state. |
- AutomationJSONReply reply(this, reply_message); |
TranslateInfoBarDelegate* translate_bar = |
GetTranslateInfoBarDelegate(tab_contents); |
scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
+ |
if (!translate_bar) { |
return_value->SetBoolean(L"translation_success", false); |
- } else { |
- return_value->SetBoolean( |
- L"translation_success", |
- translate_bar->type() == TranslateInfoBarDelegate::AFTER_TRANSLATE); |
+ AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
+ return; |
} |
- reply.SendSuccess(return_value.get()); |
+ |
+ // If the translation is still pending, the observer will wait |
+ // for it to finish and then reply. |
+ if (translate_bar->type() == TranslateInfoBarDelegate::TRANSLATING) { |
+ new PageTranslatedObserver(this, reply_message, tab_contents); |
+ return; |
+ } |
+ |
+ // Otherwise send back the success or failure of the attempted translation. |
+ return_value->SetBoolean( |
+ L"translation_success", |
+ translate_bar->type() == TranslateInfoBarDelegate::AFTER_TRANSLATE); |
+ AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
} |
// Sample json input: { "command": "GetThemeInfo" } |