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

Unified Diff: chrome/browser/infobars/infobar_tab_helper.cc

Issue 10830353: Introduce InfoBarTabService API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments, merge to LKGR Created 8 years, 4 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
« no previous file with comments | « chrome/browser/infobars/infobar_tab_helper.h ('k') | chrome/browser/infobars/infobars_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/infobars/infobar_tab_helper.cc
diff --git a/chrome/browser/infobars/infobar_tab_helper.cc b/chrome/browser/infobars/infobar_tab_helper.cc
index 405661f8907773a159715f4f4c47bfe10583b793..275df5789f4a7bbc5de008b41f2188d8c00ceb90 100644
--- a/chrome/browser/infobars/infobar_tab_helper.cc
+++ b/chrome/browser/infobars/infobar_tab_helper.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/api/infobars/infobar_delegate.h"
#include "chrome/browser/infobars/infobar.h"
#include "chrome/browser/infobars/insecure_content_infobar_delegate.h"
+#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/render_messages.h"
#include "content/public/browser/navigation_controller.h"
@@ -16,6 +17,10 @@
using content::NavigationController;
using content::WebContents;
+InfoBarTabService* InfoBarTabService::ForTab(TabContents* tab) {
+ return tab->infobar_tab_helper();
+}
+
InfoBarTabHelper::InfoBarTabHelper(WebContents* web_contents)
: content::WebContentsObserver(web_contents),
infobars_enabled_(true) {
@@ -94,10 +99,18 @@ bool InfoBarTabHelper::ReplaceInfoBar(InfoBarDelegate* old_delegate,
return true;
}
+size_t InfoBarTabHelper::GetInfoBarCount() const {
+ return infobars_.size();
+}
+
InfoBarDelegate* InfoBarTabHelper::GetInfoBarDelegateAt(size_t index) {
return infobars_[index];
}
+content::WebContents* InfoBarTabHelper::GetWebContents() {
+ return content::WebContentsObserver::web_contents();
+}
+
void InfoBarTabHelper::RemoveInfoBarInternal(InfoBarDelegate* delegate,
bool animate) {
if (!infobars_enabled_) {
@@ -129,7 +142,7 @@ void InfoBarTabHelper::RemoveInfoBarInternal(InfoBarDelegate* delegate,
void InfoBarTabHelper::RemoveAllInfoBars(bool animate) {
while (!infobars_.empty())
- RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate);
+ RemoveInfoBarInternal(GetInfoBarDelegateAt(GetInfoBarCount() - 1), animate);
}
void InfoBarTabHelper::OnDidBlockDisplayingInsecureContent() {
« no previous file with comments | « chrome/browser/infobars/infobar_tab_helper.h ('k') | chrome/browser/infobars/infobars_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698