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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 | 12 |
| 13 class GURL; |
| 14 |
13 namespace web { | 15 namespace web { |
14 | 16 |
15 struct FaviconURL; | 17 struct FaviconURL; |
16 struct LoadCommittedDetails; | 18 struct LoadCommittedDetails; |
17 class WebState; | 19 class WebState; |
18 class WebStateImpl; | 20 class WebStateImpl; |
19 | 21 |
20 enum class PageLoadCompletionStatus : bool { SUCCESS = 0, FAILURE = 1 }; | 22 enum class PageLoadCompletionStatus : bool { SUCCESS = 0, FAILURE = 1 }; |
21 | 23 |
22 // An observer API implemented by classes which are interested in various page | 24 // An observer API implemented by classes which are interested in various page |
(...skipping 14 matching lines...) Expand all Loading... |
37 virtual void NavigationItemCommitted( | 39 virtual void NavigationItemCommitted( |
38 const LoadCommittedDetails& load_details) {} | 40 const LoadCommittedDetails& load_details) {} |
39 | 41 |
40 // Called when the current page is loaded. | 42 // Called when the current page is loaded. |
41 virtual void PageLoaded(PageLoadCompletionStatus load_completion_status) {} | 43 virtual void PageLoaded(PageLoadCompletionStatus load_completion_status) {} |
42 | 44 |
43 // Called when the interstitial is dismissed by the user. | 45 // Called when the interstitial is dismissed by the user. |
44 virtual void InsterstitialDismissed() {} | 46 virtual void InsterstitialDismissed() {} |
45 | 47 |
46 // Called on URL hash change events. | 48 // Called on URL hash change events. |
47 virtual void URLHashChanged() {} | 49 virtual void UrlHashChanged() {} |
48 | 50 |
49 // Called on history state change events. | 51 // Called on history state change events. |
50 virtual void HistoryStateChanged() {} | 52 virtual void HistoryStateChanged() {} |
51 | 53 |
52 // Called on form submission. |user_interaction| is true if the user | 54 // Called on form submission. |user_initiated| is true if the user |
53 // interacted with the page. | 55 // interacted with the page. |
54 virtual void DocumentSubmitted(const std::string& form_name, | 56 virtual void DocumentSubmitted(const std::string& form_name, |
55 bool user_interaction) {} | 57 bool user_initiated) {} |
56 | 58 |
57 // Called when the user is typing on a form field, with |error| indicating if | 59 // Called when the user is typing on a form field, with |error| indicating if |
58 // there is any error when parsing the form field information. | 60 // there is any error when parsing the form field information. |
59 // |key_code| may be kInvalidFormKeyCode if there is no key code. | 61 // |key_code| may be kInvalidFormKeyCode if there is no key code. |
60 virtual void FormActivityRegistered(const std::string& form_name, | 62 virtual void FormActivityRegistered(const std::string& form_name, |
61 const std::string& field_name, | 63 const std::string& field_name, |
62 const std::string& type, | 64 const std::string& type, |
63 const std::string& value, | 65 const std::string& value, |
64 int key_code, | 66 int key_code, |
65 bool error) {} | 67 bool input_missing) {} |
66 | 68 |
67 // Invoked when new FaviconURL candidates are received. | 69 // Notifies the observer that the requestAutocomplete API was invoked from |
68 virtual void FaviconURLUpdated(const std::vector<FaviconURL>& candidates) {} | 70 // |source_url| for the form with the specified |form_name|. |
| 71 // |user_initiated| indicates whether the API was invoked in response to a |
| 72 // user interaction. |
| 73 virtual void AutocompleteRequested(const GURL& source_url, |
| 74 const std::string& form_name, |
| 75 bool user_initiated) {} |
| 76 |
| 77 // Invoked when new favicon URL candidates are received. |
| 78 virtual void FaviconUrlUpdated(const std::vector<FaviconURL>& candidates) {} |
69 | 79 |
70 // Invoked when the WebState is being destroyed. Gives subclasses a chance | 80 // Invoked when the WebState is being destroyed. Gives subclasses a chance |
71 // to cleanup. | 81 // to cleanup. |
72 virtual void WebStateDestroyed() {} | 82 virtual void WebStateDestroyed() {} |
73 | 83 |
74 protected: | 84 protected: |
75 // Use this constructor when the object is tied to a single WebState for | 85 // Use this constructor when the object is tied to a single WebState for |
76 // its entire lifetime. | 86 // its entire lifetime. |
77 explicit WebStateObserver(WebState* web_state); | 87 explicit WebStateObserver(WebState* web_state); |
78 | 88 |
(...skipping 14 matching lines...) Expand all Loading... |
93 void ResetWebState(); | 103 void ResetWebState(); |
94 | 104 |
95 WebState* web_state_; | 105 WebState* web_state_; |
96 | 106 |
97 DISALLOW_COPY_AND_ASSIGN(WebStateObserver); | 107 DISALLOW_COPY_AND_ASSIGN(WebStateObserver); |
98 }; | 108 }; |
99 | 109 |
100 } // namespace web | 110 } // namespace web |
101 | 111 |
102 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ | 112 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_OBSERVER_H_ |
OLD | NEW |