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

Unified Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 190063006: Infobar Componentization Proof of Concept (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixes Created 6 years, 9 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: 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 656dfc6a6b8b1a25b01c0bd3c9532be8b5667c89..a3719a440696e92ab7a30e56b070d39371156884 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -64,6 +64,7 @@
#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/infobars/confirm_infobar_delegate.h"
#include "chrome/browser/infobars/infobar.h"
+#include "chrome/browser/infobars/infobar_manager.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/notifications/balloon.h"
@@ -1996,9 +1997,10 @@ base::ListValue* TestingAutomationProvider::GetInfobarsInfo(WebContents* wc) {
// Each infobar may have different properties depending on the type.
base::ListValue* infobars = new base::ListValue;
InfoBarService* infobar_service = InfoBarService::FromWebContents(wc);
- for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
+ InfoBarManager& infobar_manager = infobar_service->infobar_manager();
+ for (size_t i = 0; i < infobar_manager.infobar_count(); ++i) {
base::DictionaryValue* infobar_item = new base::DictionaryValue;
- InfoBarDelegate* infobar = infobar_service->infobar_at(i)->delegate();
+ InfoBarDelegate* infobar = infobar_manager.infobar_at(i)->delegate();
switch (infobar->GetInfoBarAutomationType()) {
case InfoBarDelegate::CONFIRM_INFOBAR:
infobar_item->SetString("type", "confirm_infobar");
@@ -2074,17 +2076,18 @@ void TestingAutomationProvider::PerformActionOnInfobar(
InfoBarService* infobar_service =
InfoBarService::FromWebContents(web_contents);
- if (infobar_index >= infobar_service->infobar_count()) {
+ InfoBarManager& infobar_manager = infobar_service->infobar_manager();
+ if (infobar_index >= infobar_manager.infobar_count()) {
reply.SendError(base::StringPrintf("No such infobar at index %" PRIuS,
infobar_index));
return;
}
- InfoBar* infobar = infobar_service->infobar_at(infobar_index);
+ InfoBar* infobar = infobar_manager.infobar_at(infobar_index);
InfoBarDelegate* infobar_delegate = infobar->delegate();
if (action == "dismiss") {
infobar_delegate->InfoBarDismissed();
- infobar_service->RemoveInfoBar(infobar);
+ infobar_manager.RemoveInfoBar(infobar);
reply.SendSuccess(NULL);
return;
}
@@ -2097,7 +2100,7 @@ void TestingAutomationProvider::PerformActionOnInfobar(
}
if ((action == "accept") ?
confirm_infobar_delegate->Accept() : confirm_infobar_delegate->Cancel())
- infobar_service->RemoveInfoBar(infobar);
+ infobar_manager.RemoveInfoBar(infobar);
reply.SendSuccess(NULL);
return;
}

Powered by Google App Engine
This is Rietveld 408576698