| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_TAB_CONTENTS_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_INFOBAR_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // Returns true if the supplied |delegate| is equal to this one. Equality is | 63 // Returns true if the supplied |delegate| is equal to this one. Equality is |
| 64 // left to the implementation to define. This function is called by the | 64 // left to the implementation to define. This function is called by the |
| 65 // TabContents when determining whether or not a delegate should be added | 65 // TabContents when determining whether or not a delegate should be added |
| 66 // because a matching one already exists. If this function returns true, the | 66 // because a matching one already exists. If this function returns true, the |
| 67 // TabContents will not add the new delegate because it considers one to | 67 // TabContents will not add the new delegate because it considers one to |
| 68 // already be present. | 68 // already be present. |
| 69 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const; | 69 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const; |
| 70 | 70 |
| 71 // Returns true if the InfoBar should be closed automatically after the page | 71 // Returns true if the InfoBar should be closed automatically after the page |
| 72 // is navigated. The default behavior is to return true if the page is | 72 // is navigated. The default behavior is to return true if the user initiated |
| 73 // navigated somewhere else or reloaded. | 73 // navigation somewhere else or reloaded. |
| 74 virtual bool ShouldExpire( | 74 virtual bool ShouldExpire( |
| 75 const NavigationController::LoadCommittedDetails& details) const; | 75 const NavigationController::LoadCommittedDetails& details) const; |
| 76 | 76 |
| 77 // Called when the user clicks on the close button to dismiss the infobar. | 77 // Called when the user clicks on the close button to dismiss the infobar. |
| 78 virtual void InfoBarDismissed(); | 78 virtual void InfoBarDismissed(); |
| 79 | 79 |
| 80 // Called after the InfoBar is closed. The delegate is free to delete itself | 80 // Called after the InfoBar is closed. The delegate is free to delete itself |
| 81 // at this point. | 81 // at this point. |
| 82 virtual void InfoBarClosed(); | 82 virtual void InfoBarClosed(); |
| 83 | 83 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 101 // Provided to subclasses as a convenience to initialize the state of this | 101 // Provided to subclasses as a convenience to initialize the state of this |
| 102 // object. If |contents| is non-NULL, its active entry's unique ID will be | 102 // object. If |contents| is non-NULL, its active entry's unique ID will be |
| 103 // stored using StoreActiveEntryUniqueID automatically. | 103 // stored using StoreActiveEntryUniqueID automatically. |
| 104 explicit InfoBarDelegate(TabContents* contents); | 104 explicit InfoBarDelegate(TabContents* contents); |
| 105 | 105 |
| 106 // Store the unique id for the active entry in the specified TabContents, to | 106 // Store the unique id for the active entry in the specified TabContents, to |
| 107 // be used later upon navigation to determine if this InfoBarDelegate should | 107 // be used later upon navigation to determine if this InfoBarDelegate should |
| 108 // be expired from |contents_|. | 108 // be expired from |contents_|. |
| 109 void StoreActiveEntryUniqueID(TabContents* contents); | 109 void StoreActiveEntryUniqueID(TabContents* contents); |
| 110 | 110 |
| 111 private: | |
| 112 // The unique id of the active NavigationEntry of the TabContents that we were | 111 // The unique id of the active NavigationEntry of the TabContents that we were |
| 113 // opened for. Used to help expire on navigations. | 112 // opened for. Used to help expire on navigations. |
| 114 int contents_unique_id_; | 113 int contents_unique_id_; |
| 115 | 114 |
| 115 private: |
| 116 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); | 116 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 #endif // CHROME_BROWSER_TAB_CONTENTS_INFOBAR_DELEGATE_H_ | 119 #endif // CHROME_BROWSER_TAB_CONTENTS_INFOBAR_DELEGATE_H_ |
| OLD | NEW |