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.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "app/message_box_flags.h" | 9 #include "app/message_box_flags.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 infobar_index < tc->infobar_delegate_count(); | 1745 infobar_index < tc->infobar_delegate_count(); |
1746 ++infobar_index) { | 1746 ++infobar_index) { |
1747 DictionaryValue* infobar_item = new DictionaryValue; | 1747 DictionaryValue* infobar_item = new DictionaryValue; |
1748 InfoBarDelegate* infobar = tc->GetInfoBarDelegateAt(infobar_index); | 1748 InfoBarDelegate* infobar = tc->GetInfoBarDelegateAt(infobar_index); |
1749 if (infobar->AsConfirmInfoBarDelegate()) { | 1749 if (infobar->AsConfirmInfoBarDelegate()) { |
1750 // Also covers ThemeInstalledInfoBarDelegate and | 1750 // Also covers ThemeInstalledInfoBarDelegate and |
1751 // CrashedExtensionInfoBarDelegate. | 1751 // CrashedExtensionInfoBarDelegate. |
1752 infobar_item->SetString("type", "confirm_infobar"); | 1752 infobar_item->SetString("type", "confirm_infobar"); |
1753 ConfirmInfoBarDelegate* confirm_infobar = | 1753 ConfirmInfoBarDelegate* confirm_infobar = |
1754 infobar->AsConfirmInfoBarDelegate(); | 1754 infobar->AsConfirmInfoBarDelegate(); |
1755 infobar_item->SetString("text", | 1755 infobar_item->SetString("text", confirm_infobar->GetMessageText()); |
1756 WideToUTF16Hack(confirm_infobar->GetMessageText())); | 1756 infobar_item->SetString("link_text", confirm_infobar->GetLinkText()); |
1757 infobar_item->SetString("link_text", | |
1758 WideToUTF16Hack(confirm_infobar->GetLinkText())); | |
1759 ListValue* buttons_list = new ListValue; | 1757 ListValue* buttons_list = new ListValue; |
1760 int buttons = confirm_infobar->GetButtons(); | 1758 int buttons = confirm_infobar->GetButtons(); |
1761 if (ConfirmInfoBarDelegate::BUTTON_OK & buttons) { | 1759 if (ConfirmInfoBarDelegate::BUTTON_OK & buttons) { |
1762 StringValue* button_label = new StringValue( | 1760 StringValue* button_label = new StringValue( |
1763 confirm_infobar->GetButtonLabel( | 1761 confirm_infobar->GetButtonLabel( |
1764 ConfirmInfoBarDelegate::BUTTON_OK)); | 1762 ConfirmInfoBarDelegate::BUTTON_OK)); |
1765 buttons_list->Append(button_label); | 1763 buttons_list->Append(button_label); |
1766 } | 1764 } |
1767 if (ConfirmInfoBarDelegate::BUTTON_CANCEL & buttons) { | 1765 if (ConfirmInfoBarDelegate::BUTTON_CANCEL & buttons) { |
1768 StringValue* button_label = new StringValue( | 1766 StringValue* button_label = new StringValue( |
1769 confirm_infobar->GetButtonLabel( | 1767 confirm_infobar->GetButtonLabel( |
1770 ConfirmInfoBarDelegate::BUTTON_CANCEL)); | 1768 ConfirmInfoBarDelegate::BUTTON_CANCEL)); |
1771 buttons_list->Append(button_label); | 1769 buttons_list->Append(button_label); |
1772 } | 1770 } |
1773 infobar_item->Set("buttons", buttons_list); | 1771 infobar_item->Set("buttons", buttons_list); |
1774 } else if (infobar->AsAlertInfoBarDelegate()) { | 1772 } else if (infobar->AsAlertInfoBarDelegate()) { |
1775 infobar_item->SetString("type", "alert_infobar"); | 1773 infobar_item->SetString("type", "alert_infobar"); |
1776 AlertInfoBarDelegate* alert_infobar = | 1774 AlertInfoBarDelegate* alert_infobar = |
1777 infobar->AsAlertInfoBarDelegate(); | 1775 infobar->AsAlertInfoBarDelegate(); |
1778 infobar_item->SetString("text", | 1776 infobar_item->SetString("text", alert_infobar->GetMessageText()); |
1779 WideToUTF16Hack(alert_infobar->GetMessageText())); | |
1780 } else if (infobar->AsLinkInfoBarDelegate()) { | 1777 } else if (infobar->AsLinkInfoBarDelegate()) { |
1781 infobar_item->SetString("type", "link_infobar"); | 1778 infobar_item->SetString("type", "link_infobar"); |
1782 LinkInfoBarDelegate* link_infobar = infobar->AsLinkInfoBarDelegate(); | 1779 LinkInfoBarDelegate* link_infobar = infobar->AsLinkInfoBarDelegate(); |
1783 infobar_item->SetString("link_text", | 1780 infobar_item->SetString("link_text", link_infobar->GetLinkText()); |
1784 WideToUTF16Hack(link_infobar->GetLinkText())); | |
1785 } else if (infobar->AsTranslateInfoBarDelegate()) { | 1781 } else if (infobar->AsTranslateInfoBarDelegate()) { |
1786 infobar_item->SetString("type", "translate_infobar"); | 1782 infobar_item->SetString("type", "translate_infobar"); |
1787 TranslateInfoBarDelegate* translate_infobar = | 1783 TranslateInfoBarDelegate* translate_infobar = |
1788 infobar->AsTranslateInfoBarDelegate(); | 1784 infobar->AsTranslateInfoBarDelegate(); |
1789 infobar_item->SetString("original_lang_code", | 1785 infobar_item->SetString("original_lang_code", |
1790 translate_infobar->GetOriginalLanguageCode()); | 1786 translate_infobar->GetOriginalLanguageCode()); |
1791 infobar_item->SetString("target_lang_code", | 1787 infobar_item->SetString("target_lang_code", |
1792 translate_infobar->GetTargetLanguageCode()); | 1788 translate_infobar->GetTargetLanguageCode()); |
1793 } else if (infobar->AsExtensionInfoBarDelegate()) { | 1789 } else if (infobar->AsExtensionInfoBarDelegate()) { |
1794 infobar_item->SetString("type", "extension_infobar"); | 1790 infobar_item->SetString("type", "extension_infobar"); |
(...skipping 2755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4550 } | 4546 } |
4551 | 4547 |
4552 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { | 4548 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { |
4553 NOTIMPLEMENTED(); | 4549 NOTIMPLEMENTED(); |
4554 } | 4550 } |
4555 #endif // !defined(TOOLKIT_VIEWS) | 4551 #endif // !defined(TOOLKIT_VIEWS) |
4556 | 4552 |
4557 void AutomationProvider::ResetToDefaultTheme() { | 4553 void AutomationProvider::ResetToDefaultTheme() { |
4558 profile_->ClearTheme(); | 4554 profile_->ClearTheme(); |
4559 } | 4555 } |
OLD | NEW |