OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ | 5 #ifndef COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ |
6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ | 6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "components/infobars/core/infobar_delegate.h" | 12 #include "components/infobars/core/infobar_delegate.h" |
13 | 13 |
14 class ConfirmInfoBarDelegate; | 14 class ConfirmInfoBarDelegate; |
| 15 class GURL; |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class WebContents; | 18 class WebContents; |
18 } | 19 } |
19 | 20 |
20 namespace infobars { | 21 namespace infobars { |
21 | 22 |
22 class InfoBar; | 23 class InfoBar; |
23 | 24 |
24 // Provides access to creating, removing and enumerating info bars | 25 // Provides access to creating, removing and enumerating info bars |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void AddObserver(Observer* obs); | 94 void AddObserver(Observer* obs); |
94 void RemoveObserver(Observer* obs); | 95 void RemoveObserver(Observer* obs); |
95 | 96 |
96 // Returns the active entry ID. | 97 // Returns the active entry ID. |
97 virtual int GetActiveEntryID() = 0; | 98 virtual int GetActiveEntryID() = 0; |
98 | 99 |
99 // Returns a confirm infobar that owns |delegate|. | 100 // Returns a confirm infobar that owns |delegate|. |
100 virtual scoped_ptr<infobars::InfoBar> CreateConfirmInfoBar( | 101 virtual scoped_ptr<infobars::InfoBar> CreateConfirmInfoBar( |
101 scoped_ptr<ConfirmInfoBarDelegate> delegate) = 0; | 102 scoped_ptr<ConfirmInfoBarDelegate> delegate) = 0; |
102 | 103 |
| 104 // Opens a URL according to the specified |disposition|. |
| 105 virtual void OpenURL(const GURL& url, WindowOpenDisposition disposition) = 0; |
| 106 |
103 protected: | 107 protected: |
104 // Notifies the observer in |observer_list_|. | 108 // Notifies the observer in |observer_list_|. |
105 // TODO(droger): Absorb these methods back into their callers once virtual | 109 // TODO(droger): Absorb these methods back into their callers once virtual |
106 // overrides are removed (see http://crbug.com/354380). | 110 // overrides are removed (see http://crbug.com/354380). |
107 virtual void NotifyInfoBarAdded(InfoBar* infobar); | 111 virtual void NotifyInfoBarAdded(InfoBar* infobar); |
108 virtual void NotifyInfoBarRemoved(InfoBar* infobar, bool animate); | 112 virtual void NotifyInfoBarRemoved(InfoBar* infobar, bool animate); |
109 | 113 |
110 private: | 114 private: |
111 // InfoBars associated with this InfoBarManager. We own these pointers. | 115 // InfoBars associated with this InfoBarManager. We own these pointers. |
112 // However, this is not a ScopedVector, because we don't delete the infobars | 116 // However, this is not a ScopedVector, because we don't delete the infobars |
113 // directly once they've been added to this; instead, when we're done with an | 117 // directly once they've been added to this; instead, when we're done with an |
114 // infobar, we instruct it to delete itself and then orphan it. See | 118 // infobar, we instruct it to delete itself and then orphan it. See |
115 // RemoveInfoBarInternal(). | 119 // RemoveInfoBarInternal(). |
116 typedef std::vector<InfoBar*> InfoBars; | 120 typedef std::vector<InfoBar*> InfoBars; |
117 | 121 |
118 void RemoveInfoBarInternal(InfoBar* infobar, bool animate); | 122 void RemoveInfoBarInternal(InfoBar* infobar, bool animate); |
119 | 123 |
120 InfoBars infobars_; | 124 InfoBars infobars_; |
121 bool infobars_enabled_; | 125 bool infobars_enabled_; |
122 | 126 |
123 base::ObserverList<Observer, true> observer_list_; | 127 base::ObserverList<Observer, true> observer_list_; |
124 | 128 |
125 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); | 129 DISALLOW_COPY_AND_ASSIGN(InfoBarManager); |
126 }; | 130 }; |
127 | 131 |
128 } // namespace infobars | 132 } // namespace infobars |
129 | 133 |
130 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ | 134 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_MANAGER_H_ |
OLD | NEW |