| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ |
| 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ | 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 | 9 |
| 10 namespace web { | 10 namespace web { |
| 11 | 11 |
| 12 struct LoadCommittedDetails; | 12 struct LoadCommittedDetails; |
| 13 class WebState; | 13 class WebState; |
| 14 class WebStateImpl; | 14 class WebStateImpl; |
| 15 | 15 |
| 16 // An observer API implemented by classes which are interested in various page | 16 // An observer API implemented by classes which are interested in various page |
| 17 // load events from WebState. | 17 // load events from WebState. |
| 18 class WebStateObserver { | 18 class WebStateObserver { |
| 19 public: | 19 public: |
| 20 // Returns the web state associated with this observer. | 20 // Returns the web state associated with this observer. |
| 21 WebState* web_state() const { return web_state_; } | 21 WebState* web_state() const { return web_state_; } |
| 22 | 22 |
| 23 // This method is invoked when a new non-pending navigation item is created. | 23 // This method is invoked when a new non-pending navigation item is created. |
| 24 // This corresponds to one NavigationManager item being created | 24 // This corresponds to one NavigationManager item being created |
| 25 // (in the case of new navigations) or renavigated to (for back/forward | 25 // (in the case of new navigations) or renavigated to (for back/forward |
| 26 // navigations). | 26 // navigations). |
| 27 virtual void NavigationItemCommitted( | 27 virtual void NavigationItemCommitted( |
| 28 const LoadCommittedDetails& load_details) {}; | 28 const LoadCommittedDetails& load_details) {} |
| 29 | 29 |
| 30 // Called when the current page is loaded. | 30 // Called when the current page is loaded. |
| 31 virtual void PageLoaded() {}; | 31 virtual void PageLoaded() {} |
| 32 | 32 |
| 33 // Called on URL hash change events. | 33 // Called on URL hash change events. |
| 34 virtual void URLHashChanged() {}; | 34 virtual void URLHashChanged() {} |
| 35 | 35 |
| 36 // Called on history state change events. | 36 // Called on history state change events. |
| 37 virtual void HistoryStateChanged() {}; | 37 virtual void HistoryStateChanged() {} |
| 38 | 38 |
| 39 // Invoked when the WebState is being destroyed. Gives subclasses a chance | 39 // Invoked when the WebState is being destroyed. Gives subclasses a chance |
| 40 // to cleanup. | 40 // to cleanup. |
| 41 virtual void WebStateDestroyed() {} | 41 virtual void WebStateDestroyed() {} |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 // Use this constructor when the object is tied to a single WebState for | 44 // Use this constructor when the object is tied to a single WebState for |
| 45 // its entire lifetime. | 45 // its entire lifetime. |
| 46 explicit WebStateObserver(WebState* web_state); | 46 explicit WebStateObserver(WebState* web_state); |
| 47 | 47 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 62 void ResetWebState(); | 62 void ResetWebState(); |
| 63 | 63 |
| 64 WebState* web_state_; | 64 WebState* web_state_; |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(WebStateObserver); | 66 DISALLOW_COPY_AND_ASSIGN(WebStateObserver); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace web | 69 } // namespace web |
| 70 | 70 |
| 71 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ | 71 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ |
| OLD | NEW |