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

Unified Diff: chrome/browser/api/infobars/infobar_tab_service.h

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
Index: chrome/browser/api/infobars/infobar_tab_service.h
diff --git a/chrome/browser/api/infobars/infobar_tab_service.h b/chrome/browser/api/infobars/infobar_tab_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..c99cb81ad87963ef56e60cbc77fddbb5cfd240b6
--- /dev/null
+++ b/chrome/browser/api/infobars/infobar_tab_service.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_API_INFOBARS_INFOBAR_TAB_SERVICE_H_
+#define CHROME_BROWSER_API_INFOBARS_INFOBAR_TAB_SERVICE_H_
+
+namespace content {
+class WebContents;
+}
+
+class InfoBarDelegate;
+class TabContents;
+
+// Provides access to creating, removing and enumerating info bars
+// attached to a tab.
+class InfoBarTabService {
+ public:
+ // Retrieves the InfoBarTabService for a given tab.
+ static InfoBarTabService* ForTab(TabContents* tab_contents);
+
+ virtual ~InfoBarTabService() {}
+
+ // Adds an InfoBar for the specified |delegate|.
+ //
+ // If infobars are disabled for this tab or the tab already has a delegate
+ // which returns true for InfoBarDelegate::EqualsDelegate(delegate),
+ // |delegate| is closed immediately without being added.
+ //
+ // Returns whether |delegate| was successfully added.
+ virtual bool AddInfoBar(InfoBarDelegate* delegate) = 0;
+
+ // Removes the InfoBar for the specified |delegate|.
+ //
+ // If infobars are disabled for this tab, this will do nothing, on the
+ // assumption that the matching AddInfoBar() call will have already closed the
+ // delegate (see above).
+ virtual void RemoveInfoBar(InfoBarDelegate* delegate) = 0;
+
+ // Replaces one infobar with another, without any animation in between.
+ //
+ // If infobars are disabled for this tab, |new_delegate| is closed immediately
+ // without being added, and nothing else happens.
+ //
+ // Returns whether |new_delegate| was successfully added.
+ //
+ // NOTE: This does not perform any EqualsDelegate() checks like AddInfoBar().
+ virtual bool ReplaceInfoBar(InfoBarDelegate* old_delegate,
+ InfoBarDelegate* new_delegate) = 0;
+
+ // Returns the number of infobars for this tab.
+ virtual size_t GetInfoBarCount() const = 0;
+
+ // Returns the infobar at the given |index|.
+ //
+ // Warning: Does not sanity check |index|.
+ virtual InfoBarDelegate* GetInfoBarDelegateAt(size_t index) = 0;
+
+ // Retrieve the WebContents for the tab this service is associated with.
+ virtual content::WebContents* GetWebContents() = 0;
+};
+
+#endif // CHROME_BROWSER_API_INFOBARS_INFOBAR_TAB_SERVICE_H_
« no previous file with comments | « chrome/browser/api/infobars/infobar_delegate.cc ('k') | chrome/browser/api/infobars/link_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698