| 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 "content/browser/tab_contents/navigation_controller.h" | 8 #include "content/browser/tab_contents/navigation_controller.h" |
| 9 #include "ipc/ipc_channel.h" | 9 #include "ipc/ipc_channel.h" |
| 10 | 10 |
| 11 struct ViewHostMsg_FrameNavigate_Params; | 11 struct ViewHostMsg_FrameNavigate_Params; |
| 12 | 12 |
| 13 // An observer API implemented by classes which are interested in various page | 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. | 14 // load events from TabContents. They also get a chance to filter IPC messages. |
| 15 class TabContentsObserver : public IPC::Channel::Listener, | 15 class TabContentsObserver : public IPC::Channel::Listener, |
| 16 public IPC::Message::Sender { | 16 public IPC::Message::Sender { |
| 17 public: | 17 public: |
| 18 // Use this as a member variable in a class that uses the emptry constructor | 18 // Use this as a member variable in a class that uses the empty constructor |
| 19 // version of this interface. | 19 // version of this interface. |
| 20 class Registrar { | 20 class Registrar { |
| 21 public: | 21 public: |
| 22 explicit Registrar(TabContentsObserver* observer); | 22 explicit Registrar(TabContentsObserver* observer); |
| 23 ~Registrar(); | 23 ~Registrar(); |
| 24 | 24 |
| 25 // Call this to start observing a tab. Passing in NULL resets it. | 25 // Call this to start observing a tab. Passing in NULL resets it. |
| 26 // This can only be used to watch one tab at a time. If you call this and | 26 // This can only be used to watch one tab at a time. If you call this and |
| 27 // you're already observing another tab, the old tab won't be observed | 27 // you're already observing another tab, the old tab won't be observed |
| 28 // afterwards. | 28 // afterwards. |
| 29 void Observe(TabContents* tab); | 29 void Observe(TabContents* tab); |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 TabContentsObserver* observer_; | 32 TabContentsObserver* observer_; |
| 33 TabContents* tab_; | 33 TabContents* tab_; |
| 34 | 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(Registrar); | 35 DISALLOW_COPY_AND_ASSIGN(Registrar); |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 virtual void NavigateToPendingEntry(); | 38 virtual void NavigateToPendingEntry( |
| 39 const GURL& url, |
| 40 NavigationController::ReloadType reload_type); |
| 39 | 41 |
| 40 virtual void DidNavigateMainFramePostCommit( | 42 virtual void DidNavigateMainFramePostCommit( |
| 41 const NavigationController::LoadCommittedDetails& details, | 43 const NavigationController::LoadCommittedDetails& details, |
| 42 const ViewHostMsg_FrameNavigate_Params& params); | 44 const ViewHostMsg_FrameNavigate_Params& params); |
| 43 virtual void DidNavigateAnyFramePostCommit( | 45 virtual void DidNavigateAnyFramePostCommit( |
| 44 const NavigationController::LoadCommittedDetails& details, | 46 const NavigationController::LoadCommittedDetails& details, |
| 45 const ViewHostMsg_FrameNavigate_Params& params); | 47 const ViewHostMsg_FrameNavigate_Params& params); |
| 46 virtual void OnProvisionalChangeToMainFrameUrl(const GURL& url); | 48 virtual void OnProvisionalChangeToMainFrameUrl(const GURL& url); |
| 47 | 49 |
| 48 virtual void DidStartLoading(); | 50 virtual void DidStartLoading(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 107 |
| 106 TabContents* tab_contents_; | 108 TabContents* tab_contents_; |
| 107 | 109 |
| 108 // The routing ID of the associated TabContents. | 110 // The routing ID of the associated TabContents. |
| 109 int routing_id_; | 111 int routing_id_; |
| 110 | 112 |
| 111 DISALLOW_COPY_AND_ASSIGN(TabContentsObserver); | 113 DISALLOW_COPY_AND_ASSIGN(TabContentsObserver); |
| 112 }; | 114 }; |
| 113 | 115 |
| 114 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ | 116 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_OBSERVER_H_ |
| OLD | NEW |