| 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 CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ |
| 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
| 9 #include "content/browser/tab_contents/navigation_controller.h" | 9 #include "content/browser/tab_contents/navigation_controller.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 virtual void LoadingStateChanged(TabContents* contents) { } | 87 virtual void LoadingStateChanged(TabContents* contents) { } |
| 88 // Called to inform the delegate that the tab content's navigation state | 88 // Called to inform the delegate that the tab content's navigation state |
| 89 // changed. The |changed_flags| indicates the parts of the navigation state | 89 // changed. The |changed_flags| indicates the parts of the navigation state |
| 90 // that have been updated, and is any combination of the | 90 // that have been updated, and is any combination of the |
| 91 // |TabContents::InvalidateTypes| bits. | 91 // |TabContents::InvalidateTypes| bits. |
| 92 virtual void NavigationStateChanged(const TabContents* source, | 92 virtual void NavigationStateChanged(const TabContents* source, |
| 93 unsigned changed_flags) { } | 93 unsigned changed_flags) { } |
| 94 #endif | 94 #endif |
| 95 | 95 |
| 96 // IPC::Message::Sender implementation. | 96 // IPC::Message::Sender implementation. |
| 97 virtual bool Send(IPC::Message* message); | 97 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 98 int routing_id() const; | 98 int routing_id() const; |
| 99 | 99 |
| 100 protected: | 100 protected: |
| 101 // Use this constructor when the object is tied to a single TabContents for | 101 // Use this constructor when the object is tied to a single TabContents for |
| 102 // its entire lifetime. | 102 // its entire lifetime. |
| 103 explicit TabContentsObserver(TabContents* tab_contents); | 103 explicit TabContentsObserver(TabContents* tab_contents); |
| 104 | 104 |
| 105 // Use this constructor when the object wants to observe a TabContents for | 105 // Use this constructor when the object wants to observe a TabContents for |
| 106 // part of its lifetime. It can then call Observe() to start and stop | 106 // part of its lifetime. It can then call Observe() to start and stop |
| 107 // observing. | 107 // observing. |
| 108 TabContentsObserver(); | 108 TabContentsObserver(); |
| 109 | 109 |
| 110 virtual ~TabContentsObserver(); | 110 virtual ~TabContentsObserver(); |
| 111 | 111 |
| 112 // Start observing a different TabContents; used with the default constructor. | 112 // Start observing a different TabContents; used with the default constructor. |
| 113 void Observe(TabContents* tab_contents); | 113 void Observe(TabContents* tab_contents); |
| 114 | 114 |
| 115 // Invoked when the TabContents is being destroyed. Gives subclasses a chance | 115 // Invoked when the TabContents is being destroyed. Gives subclasses a chance |
| 116 // to cleanup. At the time this is invoked |tab_contents()| returns NULL. | 116 // to cleanup. At the time this is invoked |tab_contents()| returns NULL. |
| 117 // It is safe to delete 'this' from here. | 117 // It is safe to delete 'this' from here. |
| 118 virtual void TabContentsDestroyed(TabContents* tab); | 118 virtual void TabContentsDestroyed(TabContents* tab); |
| 119 | 119 |
| 120 // IPC::Channel::Listener implementation. | 120 // IPC::Channel::Listener implementation. |
| 121 virtual bool OnMessageReceived(const IPC::Message& message); | 121 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 122 | 122 |
| 123 TabContents* tab_contents() const { return tab_contents_; } | 123 TabContents* tab_contents() const { return tab_contents_; } |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 friend class TabContents; | 126 friend class TabContents; |
| 127 | 127 |
| 128 // Invoked from TabContents. Invokes TabContentsDestroyed and NULL out | 128 // Invoked from TabContents. Invokes TabContentsDestroyed and NULL out |
| 129 // |tab_contents_|. | 129 // |tab_contents_|. |
| 130 void TabContentsDestroyed(); | 130 void TabContentsDestroyed(); |
| 131 | 131 |
| 132 TabContents* tab_contents_; | 132 TabContents* tab_contents_; |
| 133 | 133 |
| 134 DISALLOW_COPY_AND_ASSIGN(TabContentsObserver); | 134 DISALLOW_COPY_AND_ASSIGN(TabContentsObserver); |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ | 137 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ |
| OLD | NEW |