Chromium Code Reviews| Index: chrome/browser/automation/testing_automation_provider.cc |
| diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc |
| index 30d1d3e90f6af07c10700baa966ed64d4184cb47..39de2c7d4a9be10ac8c554b81eabd380532a7d27 100644 |
| --- a/chrome/browser/automation/testing_automation_provider.cc |
| +++ b/chrome/browser/automation/testing_automation_provider.cc |
| @@ -53,6 +53,7 @@ |
| #include "chrome/browser/history/top_sites.h" |
| #include "chrome/browser/importer/importer_host.h" |
| #include "chrome/browser/importer/importer_list.h" |
| +#include "chrome/browser/infobars/infobar_tab_helper.h" |
| #include "chrome/browser/instant/instant_controller.h" |
| #include "chrome/browser/notifications/balloon.h" |
| #include "chrome/browser/notifications/balloon_collection.h" |
| @@ -1884,7 +1885,7 @@ void TestingAutomationProvider::GetInfoBarCount(int handle, size_t* count) { |
| TabContentsWrapper* wrapper = |
|
Peter Kasting
2011/08/31 18:47:32
Nit: Just combine these two lines
|
| TabContentsWrapper::GetCurrentWrapperForContents( |
| nav_controller->tab_contents()); |
| - *count = wrapper->infobar_count(); |
| + *count = wrapper->infobar_tab_helper()->infobar_count(); |
| } |
| } |
| } |
| @@ -1901,15 +1902,15 @@ void TestingAutomationProvider::ClickInfoBarAccept( |
| TabContentsWrapper* wrapper = |
|
Peter Kasting
2011/08/31 18:47:32
Nit: Convert this TCW* temp into an InfoBarTabHelp
|
| TabContentsWrapper::GetCurrentWrapperForContents( |
| nav_controller->tab_contents()); |
| - if (info_bar_index < wrapper->infobar_count()) { |
| + if (info_bar_index < wrapper->infobar_tab_helper()->infobar_count()) { |
| if (wait_for_navigation) { |
| new NavigationNotificationObserver(nav_controller, this, |
| reply_message, 1, false, false); |
| } |
| InfoBarDelegate* delegate = |
| TabContentsWrapper::GetCurrentWrapperForContents( |
| - nav_controller->tab_contents())->GetInfoBarDelegateAt( |
| - info_bar_index); |
| + nav_controller->tab_contents())->infobar_tab_helper()-> |
| + GetInfoBarDelegateAt(info_bar_index); |
| if (delegate->AsConfirmInfoBarDelegate()) |
| delegate->AsConfirmInfoBarDelegate()->Accept(); |
| success = true; |
| @@ -2529,9 +2530,10 @@ ListValue* TestingAutomationProvider::GetInfobarsInfo(TabContents* tc) { |
| ListValue* infobars = new ListValue; |
| TabContentsWrapper* wrapper = |
|
Peter Kasting
2011/08/31 18:47:32
Nit: Convert this TCW* temp into an InfoBarTabHelp
|
| TabContentsWrapper::GetCurrentWrapperForContents(tc); |
| - for (size_t i = 0; i < wrapper->infobar_count(); ++i) { |
| + for (size_t i = 0; i < wrapper->infobar_tab_helper()->infobar_count(); ++i) { |
| DictionaryValue* infobar_item = new DictionaryValue; |
| - InfoBarDelegate* infobar = wrapper->GetInfoBarDelegateAt(i); |
| + InfoBarDelegate* infobar = |
| + wrapper->infobar_tab_helper()->GetInfoBarDelegateAt(i); |
| if (infobar->AsConfirmInfoBarDelegate()) { |
| // Also covers ThemeInstalledInfoBarDelegate. |
| infobar_item->SetString("type", "confirm_infobar"); |
| @@ -2603,15 +2605,16 @@ void TestingAutomationProvider::PerformActionOnInfobar( |
| } |
| InfoBarDelegate* infobar = NULL; |
| size_t infobar_index = static_cast<size_t>(infobar_index_int); |
| - if (infobar_index >= tab_contents->infobar_count() || |
| - !(infobar = tab_contents->GetInfoBarDelegateAt(infobar_index))) { |
| + if (infobar_index >= tab_contents->infobar_tab_helper()->infobar_count() || |
|
Peter Kasting
2011/08/31 18:47:32
Nit: Can you factor this infobar_tab_helper() out
|
| + !(infobar = tab_contents->infobar_tab_helper()-> |
|
Peter Kasting
2011/08/31 18:47:32
Nit: This assignment can be pulled out of the cond
|
| + GetInfoBarDelegateAt(infobar_index))) { |
| reply.SendError(StringPrintf("No such infobar at index %" PRIuS, |
| infobar_index)); |
| return; |
| } |
| if ("dismiss" == action) { |
| infobar->InfoBarDismissed(); |
| - tab_contents->RemoveInfoBar(infobar); |
| + tab_contents->infobar_tab_helper()->RemoveInfoBar(infobar); |
| reply.SendSuccess(NULL); |
| return; |
| } |
| @@ -2623,10 +2626,10 @@ void TestingAutomationProvider::PerformActionOnInfobar( |
| } |
| if ("accept" == action) { |
| if (confirm_infobar->Accept()) |
| - tab_contents->RemoveInfoBar(infobar); |
| + tab_contents->infobar_tab_helper()->RemoveInfoBar(infobar); |
| } else if ("cancel" == action) { |
| if (confirm_infobar->Cancel()) |
| - tab_contents->RemoveInfoBar(infobar); |
| + tab_contents->infobar_tab_helper()->RemoveInfoBar(infobar); |
| } |
| reply.SendSuccess(NULL); |
| return; |
| @@ -3897,8 +3900,9 @@ TranslateInfoBarDelegate* GetTranslateInfoBarDelegate( |
| TabContents* tab_contents) { |
| TabContentsWrapper* wrapper = |
|
Peter Kasting
2011/08/31 18:47:32
Nit: Convert this TCW* temp into an InfoBarTabHelp
|
| TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| - for (size_t i = 0; i < wrapper->infobar_count(); i++) { |
| - InfoBarDelegate* infobar = wrapper->GetInfoBarDelegateAt(i); |
| + for (size_t i = 0; i < wrapper->infobar_tab_helper()->infobar_count(); i++) { |
| + InfoBarDelegate* infobar = |
| + wrapper->infobar_tab_helper()->GetInfoBarDelegateAt(i); |
| if (infobar->AsTranslateInfoBarDelegate()) |
| return infobar->AsTranslateInfoBarDelegate(); |
| } |
| @@ -4100,7 +4104,7 @@ void TestingAutomationProvider::SelectTranslateOption( |
| // This is the function called when an infobar is dismissed or when the |
| // user clicks the 'Nope' translate button. |
| translate_bar->TranslationDeclined(); |
| - tab_contents_wrapper->RemoveInfoBar(translate_bar); |
| + tab_contents_wrapper->infobar_tab_helper()->RemoveInfoBar(translate_bar); |
| reply.SendSuccess(NULL); |
| } else { |
| reply.SendError("Invalid string found for option."); |