| 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_TAB_CONTENTS_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/tab_contents/navigation_controller.h" | 8 // TODO(jam): remove this file when all files have been converted. |
| 9 #include "ipc/ipc_channel.h" | 9 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 10 | |
| 11 struct ViewHostMsg_FrameNavigate_Params; | |
| 12 | |
| 13 // An observer API implemented by classes which are interested in various page | |
| 14 // load events from TabContents. They also get a chance to filter IPC messages. | |
| 15 class TabContentsObserver : public IPC::Channel::Listener { | |
| 16 public: | |
| 17 virtual void NavigateToPendingEntry() { } | |
| 18 | |
| 19 virtual void DidNavigateMainFramePostCommit( | |
| 20 const NavigationController::LoadCommittedDetails& details, | |
| 21 const ViewHostMsg_FrameNavigate_Params& params) { } | |
| 22 virtual void DidNavigateAnyFramePostCommit( | |
| 23 const NavigationController::LoadCommittedDetails& details, | |
| 24 const ViewHostMsg_FrameNavigate_Params& params) { } | |
| 25 | |
| 26 virtual void DidStartLoading() { } | |
| 27 virtual void DidStopLoading() { } | |
| 28 | |
| 29 #if 0 | |
| 30 // For unifying with delegate... | |
| 31 | |
| 32 // Notifies the delegate that this contents is starting or is done loading | |
| 33 // some resource. The delegate should use this notification to represent | |
| 34 // loading feedback. See TabContents::is_loading() | |
| 35 virtual void LoadingStateChanged(TabContents* contents) { } | |
| 36 // Called to inform the delegate that the tab content's navigation state | |
| 37 // changed. The |changed_flags| indicates the parts of the navigation state | |
| 38 // that have been updated, and is any combination of the | |
| 39 // |TabContents::InvalidateTypes| bits. | |
| 40 virtual void NavigationStateChanged(const TabContents* source, | |
| 41 unsigned changed_flags) { } | |
| 42 #endif | |
| 43 | |
| 44 protected: | |
| 45 TabContentsObserver(TabContents* tab_contents); | |
| 46 virtual ~TabContentsObserver(); | |
| 47 | |
| 48 // IPC::Channel::Listener implementation. | |
| 49 virtual bool OnMessageReceived(const IPC::Message& message); | |
| 50 | |
| 51 // IPC::Message::Sender implementation. | |
| 52 virtual bool Send(IPC::Message* message); | |
| 53 | |
| 54 TabContents* tab_contents() { return tab_contents_; } | |
| 55 int routing_id() { return routing_id_; } | |
| 56 | |
| 57 private: | |
| 58 friend class TabContents; | |
| 59 | |
| 60 void set_tab_contents(TabContents* tc) { tab_contents_ = tc; } | |
| 61 | |
| 62 TabContents* tab_contents_; | |
| 63 // The routing ID of the associated TabContents. | |
| 64 int routing_id_; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(TabContentsObserver); | |
| 67 }; | |
| 68 | 10 |
| 69 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ | 11 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ |
| OLD | NEW |