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 enum class PageLoadCompletionStatus : bool { SUCCESS = 0, FAILURE = 1 }; | |
stuartmorgan
2015/01/06 23:43:57
This feels pretty compressed; unless git cl format
| |
17 | |
16 // An observer API implemented by classes which are interested in various page | 18 // An observer API implemented by classes which are interested in various page |
17 // load events from WebState. | 19 // load events from WebState. |
18 class WebStateObserver { | 20 class WebStateObserver { |
19 public: | 21 public: |
20 // Returns the web state associated with this observer. | 22 // Returns the web state associated with this observer. |
21 WebState* web_state() const { return web_state_; } | 23 WebState* web_state() const { return web_state_; } |
22 | 24 |
23 // This method is invoked when a new non-pending navigation item is created. | 25 // This method is invoked when a new non-pending navigation item is created. |
24 // This corresponds to one NavigationManager item being created | 26 // This corresponds to one NavigationManager item being created |
25 // (in the case of new navigations) or renavigated to (for back/forward | 27 // (in the case of new navigations) or renavigated to (for back/forward |
26 // navigations). | 28 // navigations). |
27 virtual void NavigationItemCommitted( | 29 virtual void NavigationItemCommitted( |
28 const LoadCommittedDetails& load_details) {} | 30 const LoadCommittedDetails& load_details) {} |
29 | 31 |
30 // Called when the current page is loaded. | 32 // Called when the current page is loaded. |
31 virtual void PageLoaded() {} | 33 virtual void PageLoaded(PageLoadCompletionStatus load_completion_status) {} |
32 | 34 |
33 // Called on URL hash change events. | 35 // Called on URL hash change events. |
34 virtual void URLHashChanged() {} | 36 virtual void URLHashChanged() {} |
35 | 37 |
36 // Called on history state change events. | 38 // Called on history state change events. |
37 virtual void HistoryStateChanged() {} | 39 virtual void HistoryStateChanged() {} |
38 | 40 |
39 // Invoked when the WebState is being destroyed. Gives subclasses a chance | 41 // Invoked when the WebState is being destroyed. Gives subclasses a chance |
40 // to cleanup. | 42 // to cleanup. |
41 virtual void WebStateDestroyed() {} | 43 virtual void WebStateDestroyed() {} |
(...skipping 20 matching lines...) Expand all Loading... | |
62 void ResetWebState(); | 64 void ResetWebState(); |
63 | 65 |
64 WebState* web_state_; | 66 WebState* web_state_; |
65 | 67 |
66 DISALLOW_COPY_AND_ASSIGN(WebStateObserver); | 68 DISALLOW_COPY_AND_ASSIGN(WebStateObserver); |
67 }; | 69 }; |
68 | 70 |
69 } // namespace web | 71 } // namespace web |
70 | 72 |
71 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ | 73 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ |
OLD | NEW |