| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/automation/automation_provider_observers.h" | 5 #include "chrome/browser/automation/automation_provider_observers.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
| (...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 std::map<TranslateInfoBarDelegate::Type, std::string> type_to_string; | 988 std::map<TranslateInfoBarDelegate::Type, std::string> type_to_string; |
| 989 type_to_string[TranslateInfoBarDelegate::BEFORE_TRANSLATE] = | 989 type_to_string[TranslateInfoBarDelegate::BEFORE_TRANSLATE] = |
| 990 "BEFORE_TRANSLATE"; | 990 "BEFORE_TRANSLATE"; |
| 991 type_to_string[TranslateInfoBarDelegate::TRANSLATING] = | 991 type_to_string[TranslateInfoBarDelegate::TRANSLATING] = |
| 992 "TRANSLATING"; | 992 "TRANSLATING"; |
| 993 type_to_string[TranslateInfoBarDelegate::AFTER_TRANSLATE] = | 993 type_to_string[TranslateInfoBarDelegate::AFTER_TRANSLATE] = |
| 994 "AFTER_TRANSLATE"; | 994 "AFTER_TRANSLATE"; |
| 995 type_to_string[TranslateInfoBarDelegate::TRANSLATION_ERROR] = | 995 type_to_string[TranslateInfoBarDelegate::TRANSLATION_ERROR] = |
| 996 "TRANSLATION_ERROR"; | 996 "TRANSLATION_ERROR"; |
| 997 | 997 |
| 998 bar_info->SetBoolean("always_translate_lang_button_showing", |
| 999 translate_bar_->ShouldShowAlwaysTranslateButton()); |
| 1000 bar_info->SetBoolean("never_translate_lang_button_showing", |
| 1001 translate_bar_->ShouldShowNeverTranslateButton()); |
| 998 bar_info->SetString("bar_state", type_to_string[translate_bar_->type()]); | 1002 bar_info->SetString("bar_state", type_to_string[translate_bar_->type()]); |
| 999 bar_info->SetString("target_lang_code", | 1003 bar_info->SetString("target_lang_code", |
| 1000 translate_bar_->GetTargetLanguageCode()); | 1004 translate_bar_->GetTargetLanguageCode()); |
| 1001 bar_info->SetString("original_lang_code", | 1005 bar_info->SetString("original_lang_code", |
| 1002 translate_bar_->GetOriginalLanguageCode()); | 1006 translate_bar_->GetOriginalLanguageCode()); |
| 1003 return_value->Set("translate_bar", bar_info); | 1007 return_value->Set("translate_bar", bar_info); |
| 1004 } | 1008 } |
| 1005 AutomationJSONReply(automation_, reply_message_) | 1009 AutomationJSONReply(automation_, reply_message_) |
| 1006 .SendSuccess(return_value.get()); | 1010 .SendSuccess(return_value.get()); |
| 1007 delete this; | 1011 delete this; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 if (tab_contents_->infobar_delegate_count() == count_) { | 1215 if (tab_contents_->infobar_delegate_count() == count_) { |
| 1212 ConditionMet(); | 1216 ConditionMet(); |
| 1213 } | 1217 } |
| 1214 } | 1218 } |
| 1215 | 1219 |
| 1216 void WaitForInfobarCountObserver::ConditionMet() { | 1220 void WaitForInfobarCountObserver::ConditionMet() { |
| 1217 registrar_.RemoveAll(); | 1221 registrar_.RemoveAll(); |
| 1218 AutomationJSONReply(automation_, reply_message_).SendSuccess(NULL); | 1222 AutomationJSONReply(automation_, reply_message_).SendSuccess(NULL); |
| 1219 delete this; | 1223 delete this; |
| 1220 } | 1224 } |
| OLD | NEW |