| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_WEB_NAVIGATION_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_NAVIGATION_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_WEB_NAVIGATION_OBSERVER_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_WEB_NAVIGATION_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/tab_contents/navigation_controller.h" | 8 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 9 #include "ipc/ipc_channel.h" |
| 9 | 10 |
| 10 struct ViewHostMsg_FrameNavigate_Params; | 11 struct ViewHostMsg_FrameNavigate_Params; |
| 11 | 12 |
| 12 // 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 |
| 13 // load events from TabContents. | 14 // load events from TabContents. They also get a chance to filter IPC messages. |
| 14 | 15 class WebNavigationObserver : public IPC::Channel::Listener { |
| 15 // TODO(pink): Is it worth having a bitfield where certain clients can only | |
| 16 // register for certain events? Is the extra function call worth the added pain | |
| 17 // on the caller to build the bitfield? | |
| 18 | |
| 19 class WebNavigationObserver { | |
| 20 public: | 16 public: |
| 21 // For removing PasswordManager deps... | |
| 22 | |
| 23 virtual void NavigateToPendingEntry() { } | 17 virtual void NavigateToPendingEntry() { } |
| 24 | 18 |
| 25 virtual void DidNavigateMainFramePostCommit( | 19 virtual void DidNavigateMainFramePostCommit( |
| 26 const NavigationController::LoadCommittedDetails& details, | 20 const NavigationController::LoadCommittedDetails& details, |
| 27 const ViewHostMsg_FrameNavigate_Params& params) { } | 21 const ViewHostMsg_FrameNavigate_Params& params) { } |
| 28 virtual void DidNavigateAnyFramePostCommit( | 22 virtual void DidNavigateAnyFramePostCommit( |
| 29 const NavigationController::LoadCommittedDetails& details, | 23 const NavigationController::LoadCommittedDetails& details, |
| 30 const ViewHostMsg_FrameNavigate_Params& params) { } | 24 const ViewHostMsg_FrameNavigate_Params& params) { } |
| 31 | 25 |
| 32 virtual void DidStartLoading() { } | 26 virtual void DidStartLoading() { } |
| 33 virtual void DidStopLoading() { } | 27 virtual void DidStopLoading() { } |
| 34 | 28 |
| 35 // TODO(beng): These should move from here once PasswordManager is able to | 29 // IPC::Channel::Listener implementation. |
| 36 // establish its own private communication protocol to the | 30 virtual bool OnMessageReceived(const IPC::Message& message) { return false; } |
| 37 // renderer. | |
| 38 virtual void PasswordFormsFound( | |
| 39 const std::vector<webkit_glue::PasswordForm>& forms) { } | |
| 40 virtual void PasswordFormsVisible( | |
| 41 const std::vector<webkit_glue::PasswordForm>& visible_forms) { } | |
| 42 | 31 |
| 43 #if 0 | 32 #if 0 |
| 44 // For unifying with delegate... | 33 // For unifying with delegate... |
| 45 | 34 |
| 46 // Notifies the delegate that this contents is starting or is done loading | 35 // Notifies the delegate that this contents is starting or is done loading |
| 47 // some resource. The delegate should use this notification to represent | 36 // some resource. The delegate should use this notification to represent |
| 48 // loading feedback. See TabContents::is_loading() | 37 // loading feedback. See TabContents::is_loading() |
| 49 virtual void LoadingStateChanged(TabContents* contents) { } | 38 virtual void LoadingStateChanged(TabContents* contents) { } |
| 50 // Called to inform the delegate that the tab content's navigation state | 39 // Called to inform the delegate that the tab content's navigation state |
| 51 // changed. The |changed_flags| indicates the parts of the navigation state | 40 // changed. The |changed_flags| indicates the parts of the navigation state |
| 52 // that have been updated, and is any combination of the | 41 // that have been updated, and is any combination of the |
| 53 // |TabContents::InvalidateTypes| bits. | 42 // |TabContents::InvalidateTypes| bits. |
| 54 virtual void NavigationStateChanged(const TabContents* source, | 43 virtual void NavigationStateChanged(const TabContents* source, |
| 55 unsigned changed_flags) { } | 44 unsigned changed_flags) { } |
| 56 #endif | 45 #endif |
| 57 }; | 46 }; |
| 58 | 47 |
| 59 #endif // CHROME_BROWSER_TAB_CONTENTS_WEB_NAVIGATION_OBSERVER_H_ | 48 #endif // CHROME_BROWSER_TAB_CONTENTS_WEB_NAVIGATION_OBSERVER_H_ |
| OLD | NEW |